Skip to content

Latest commit

 

History

History
26 lines (25 loc) · 1.03 KB

README.md

File metadata and controls

26 lines (25 loc) · 1.03 KB

Initial setup

It is recommended to install Playwright's official Visual Studio Code extension for a better testing experience and an interactive GUI.

Shared functions

Create a .env file in the root folder of the project for your user credentials and host URL. HOST, USER and PASSWORD are the environment variables required to run shared functions.

Here's an example .env file contents:

export HOST="https://localhost:4173"
export ACCOUNT_USERNAME="user"
export ACCOUNT_PASSWORD="user"

Using shared variables

Importing shared functions from shared.ts:

import { login, host } from  './shared';


Usage of shared functions in tests:

test('Test', async ({ page }) => {
    await login(page); // Login
    await page.goto(`${host}/test/`); // Go to /test route
});

Playwright Docs

You can check Playwright documentation page for more details, guides and information.