-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fd1aed
commit 99c14d4
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,62 @@ | ||
--- | ||
description: >- | ||
Cypress, JavaScript tabanlı node.js'den türetilmiştir. Cypress komutları, node | ||
sunucusuna bağımlı oldukları için doğası gereği senkrondur. Asenkron akış test | ||
adımının yürütme için önceki adıma bağlı o | ||
--- | ||
|
||
# 12. Cypress Eşzamansız Davranış(Asynchronous Behavior) | ||
|
||
Aşağıda Cypress'teki asenkron davranışa bir örnek verelim. | ||
|
||
```javascript | ||
describe("async ous behavior", () => { | ||
it("senerio 1", () => { | ||
// test step to launch a URL | ||
cy.visit("https://accounts.google.com") | ||
|
||
// identify element | ||
cy.get('h1#headingText').find('span').should('have.text', 'Signin') | ||
|
||
cy.get('h1#headingText').find('span') | ||
.then(() => { | ||
const t = e.text() | ||
|
||
//get in console | ||
console.log(t) | ||
}) | ||
|
||
console.log("cypress notlari") | ||
}) | ||
}) | ||
``` | ||
|
||
<figure><img src=".gitbook/assets/Screenshot 2023-02-21 at 09.10.43.png" alt=""><figcaption></figcaption></figure> | ||
|
||
## Promise | ||
|
||
Cypress komutları, her adımın sırayla yürütüleceği ve aynı anda tetiklenmeyeceği şekilde tasarlanmıştır. Ancak, birbiri ardına sıralanırlar. Böylece akışı senkronize hale getirir. Bu Promise ile sağlanır. | ||
|
||
|
||
|
||
#### Modes in Promise | ||
|
||
Bir Promise, bir komutun yürütülme durumunu kategorize etmek için üç moda sahiptir. | ||
|
||
* **Resolved:** Test adımı başarıyla çalışırsa bu sonuç oluşur. | ||
* **Pending:** Test adımı çalıştırma sonucu bekleniyorsa sonuç budur | ||
* **Rejected:** Test adımı başarısız bir şekilde çalışırsa sonuç bu olur. | ||
|
||
#### Example for Promise in Cypress: | ||
|
||
```javascript | ||
describe("async ous behavior", () => { | ||
it("Promise", () => { | ||
// test step to launch a URL | ||
cy.visit("https://accounts.google.com") | ||
.then(() => { | ||
return cy.get('h1#heading') | ||
}) | ||
}) | ||
}) | ||
``` |