These files are an illustration of the benefits available in playwright test projects. It leverages parallelization and composed fixtures to create a matrix of tests for different combinations of test environments, browsers, and resolutions. The following is a brief description of the files in their execution order:
-
playwright.config.ts
: This is the entry point for the Playwright tests. It defines the configuration for the tests and uses thegetProjects
function to generate a matrix of tests for different combinations of environments, browsers, and resolutions. -
getProjects.ts
: This file defines a functiongetProjects
that generates a matrix of tests for different combinations of environments, browsers, and resolutions. The function can be customized with specific environments, browsers, and resolutions to test. -
params.ts
: This file defines several constants and types related to the testable environments, browsers, and resolutions. It also defines the typesTestableEnvironment
,TestableBrowser
, andTestableResolution
. -
fixtures.ts
: This file defines fixtures for the tests. Fixtures are reusable test components that can be used across multiple tests. In this case, the fixtures include aTestableEnvironment
and aloginPage
. There's also a worker fixture for aUser
. -
loginPage.ts
: This file exports a function that returns an object with alogin
method. Thelogin
method navigates to a URL (based on the environment), fills in the username and password fields, and clicks the submit button. -
user.ts
: This file defines aUser
type and agetUser
function. ThegetUser
function creates a user with a unique username by appending an index to the provided username. -
test.spec.ts
: This file contains an example test that uses theloginPage
anduser
fixtures. The test logs in with the user's username and password.