-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create README.md (use content from core repo)
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Initial setup | ||
It is recommended to install Playwright's official Visual Studio Code [extension](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright) 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: | ||
```bash | ||
export HOST="https://localhost:4173" | ||
export ACCOUNT_USERNAME="user" | ||
export ACCOUNT_PASSWORD="user" | ||
``` | ||
### Using shared variables | ||
Importing shared functions from `shared.ts`: | ||
```typescript | ||
import { login, host } from './shared'; | ||
``` | ||
\ | ||
Usage of shared functions in tests: | ||
```typescript | ||
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](https://playwright.dev/docs/intro) for more details, guides and information. |