Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Writing Integration Tests with Selenium & Jest | Browser Automation with Selenium
Introduction to QA Automation Testing
course content

Conteúdo do Curso

Introduction to QA Automation Testing

Introduction to QA Automation Testing

1. Introduction to Automation Testing
2. Using a Test Automation Framework
3. Browser Automation with Selenium
4. Intro to Intermediate Automation Testing

bookWriting Integration Tests with Selenium & Jest

For writing test cases with Selenium & Jest, we need to make sure that the browser window is correctly initialized before any tests. We can use the beforeAll block to ensure that the browser window is initialized before the tests start executing:

It's important to define the driver variable outside of this block to ensure that we can access it from the test blocks.

Once the test cases are done executing, we need to make sure the browser window is closed:

The remainder of the process is very similar to how we would write any other kind of tests, except in this case it would involve the use of methods that control the browser to perform tests. For-example, the following test case registers a new user on our twitter application:

In the above code, the timeout value for this test case is manually set to 10000 or 10 seconds because Selenium test cases can potentially take longer than the default 5000 (5 seconds) timeout.

It is important to note that the test cases must contain at least one assertion, also known as an expect statement. The success or failure of the test case are decided by the results of the assertions.

Following is the full code of the test script used in the video:

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 6
We're sorry to hear that something went wrong. What happened?
some-alt