Playwright, didn’t know I missed it 
       ======================================
       
       
       
       
 (TXT) Playwright laughs, Selenium cries (.svg) 
       
       Introduction 
       -------------
       
       
       For a recent project I was introduced to Playwright . It promises reliable end-to-end testing for web applications. After initially being skeptical (due to experiences with other test automation tools), I was soon amazed by the ease of use and stability. 
       
 (HTM) Playwright 
       - In a nutshell  -
       
       
       The installation worked flawlessly and the interactive running mode ( playwright test --ui ) provides immediate insight into how a test runs. The interactive generation of code for tests ( playwright codegen ) also works very well without generating bloat. 
       
       - A little caveat  -
       
       
       At first, I didn’t realize that: 
       
       - actions  are async (and must therefore be await ed) 
       - locators  are not async 
       - locators are lazy 
       - expectations are async or sync 
       
       This implies that the following assertions can both be true if you are testing a dynamic page: 1 
       
 (DIR) 1
       
       The above test will pass if there is initially a single section on the page, and it is later removed by the tested application. I was surprised! 
       
       
       Using Arrange-Act-Assert (AAA) 
       -------------------------------
       
       
       Works nicely because the locators are lazy. You can set them up while the elements do not exist. Also note the inexact match for the message. 
       
       
       You can see the laziness of the locators here; before the goto the inputs and buttons do not exist, but the tests succeed. 
       
       
       Conclusion 
       -----------
       
       
       All in all, Playwright is a pleasant discovery for me! 
       
       - Notes  -
       
       ----------------------------------
       -  I used TypeScript here, but Playwright supports multiple languages. ↩︎  
       
       I used TypeScript here, but Playwright supports multiple languages. ↩︎ 
       
 (DIR) ↩︎
 (DIR) previous Software engineering, een volwassen vak?
       
 (DIR) next Full-text document indexing - part Ⅰ
       
       
       Related 
       --------
       
 (DIR) shakehands
 (IMG) shakehands (.png)