Playwright Test is based on the concept of the test fixtures. Test fixtures are used to establish an environment for each test, giving the test everything it needs and nothing else. Test fixtures are isolated between tests, which gives Playwright Test following benefits:
The video is a tutorial on using fixtures in the Playwright test runner. The host explains that fixtures are an important feature and there are two types: test fixtures and worker fixtures. The video focuses on the test fixture and demonstrates how to create a custom fixture.
The host starts by creating a new file called "my-fixtures.ts" which serves as the base file for the fixture. They import the test
function from the Playwright test runner and declare a type called kaushik
which includes a string variable called hey
. They then create a new variable called fixture
and use the extend
function to extend the baseTest
fixture, passing in the kaushik
type as the generic. Within the fixture
function, they write their test code, accessing the hey
variable within a test block.
The host then creates a test file called "my-test.test.ts" where they import the myFixture
and use it to create a test. They log the value of hey
and then use the expect
function to assert that the value is uppercase. They run the test and demonstrate that it passes. They also demonstrate how to access the testInfo
object within a test, showing the status of the test.
The host concludes the video by summarizing the key points about fixtures and mentioning that they will cover more topics related to fixtures in future videos.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].