From a121373be03d9015635a301037ffd620ce34fa40 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Fri, 24 Feb 2023 15:48:14 +0100 Subject: [PATCH] Add basic documentation --- tests/playwright/README.md | 14 ++++++++++++++ tests/playwright/example.spec.js | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tests/playwright/README.md diff --git a/tests/playwright/README.md b/tests/playwright/README.md new file mode 100644 index 000000000..48e70b36a --- /dev/null +++ b/tests/playwright/README.md @@ -0,0 +1,14 @@ +# Playwright Testing + +## Local Environment Variables +Allows using environment variables inside the tests. + +- Duplicate `.env.sample` and rename it as `.env`, set values and add new variables if needed. + +## Run Tests +``` +$ npx playwright test +$ npx playwright test example.spec.js --headed +$ npx playwright test example.spec.js --debug +$ npx playwright test -g "Test name here" +``` diff --git a/tests/playwright/example.spec.js b/tests/playwright/example.spec.js index 903559648..789a68e19 100644 --- a/tests/playwright/example.spec.js +++ b/tests/playwright/example.spec.js @@ -1,6 +1,6 @@ const { test, expect } = require('@playwright/test'); -test('has ngrok url', async ({page, baseURL}) => { +test('has title', async ({ page }) => { await page.goto('/'); - await expect(page).toHaveURL(baseURL); + await expect(page).toHaveTitle(/WooCommerce PayPal Payments/); });