🥝
Cypress Notlari
  • 🥑1. Cypress – Giriş
  • 📐2. Cypress Kurulum
  • 🥳3. Test Runner
  • 🔥4. Cypress ile İlk Test
  • ⚔️5. Cypress Destekleyen Tarayıcılar
  • 🦇6. Cypress Basit Komutlar
  • 👾7. Cypress Değişkenler (Variables)
  • 😎8. Cypress Aliases
  • 👻9. Cypress Locators
  • ☝️10. Cypress Assertions(iddia)
  • 📔11. Cypress Metin Doğrulaması
  • 🧞12. Cypress Eşzamansız Davranış(Asynchronous Behavior)
  • 🦊13. Cypress XHR ile çalışma
  • ✅14. Cypress Checkbox
  • 🍪15. Cypress Cookie İşlemleri
  • ☘️16. Cypress Get ve Post İşlemleri
  • 🦆17. Api Response Data Type Kontrolu
  • ☔18. Chai Json Schema
  • 🥳19. Chai ile Schema Oluşturma Örnekleri
  • 🇲🇬20. Cypress Fixtures
  • 🆓21. Cypress — Dashboard Hackliyoruz
  • 🎥22. Cypress Screenshotlar ve Videolar
  • 😋23. Cypress Debugging
  • 🛃24. Cypress Custom Commands
  • 📖25. Cypress Environment Variables
  • 🪝26. Cypress Hooks
  • 🎑27. Cypress Reports
  • ⛳28.Best Practices
  • Kaynakça
Powered by GitBook
On this page

12. Cypress Eşzamansız Davranış(Asynchronous Behavior)

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

Aşağıda Cypress'teki asenkron davranışa bir örnek verelim.

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")
    })
})

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:

describe("async ous behavior", () => {
    it("Promise", () => {
        // test step to launch a URL
        cy.visit("https://accounts.google.com")
            .then(() => {
                return cy.get('h1#heading')
            })
    })
})
Previous11. Cypress Metin DoğrulamasıNext13. Cypress XHR ile çalışma

Last updated 2 years ago

🧞