Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to use 1.46 #42

Merged
merged 18 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/template-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
environment:
name: ${{ inputs.TESTGROUP }}
url: https://testresults.marcusfelling.com/${{ inputs.TESTGROUP }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
container:
image: mcr.microsoft.com/playwright:v1.38.0-jammy
image: mcr.microsoft.com/playwright:v1.46.0-jammy
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: main

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
Expand All @@ -38,10 +38,10 @@ jobs:
working-directory: ${{ inputs.TESTGROUP }}
run: |
npx playwright install
HOME=/root npx playwright test
HOME=/root npx playwright test --retries 0

- name: Upload HTML report as artifact. To troubleshoot failures, extract .zip and double-click index.html.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ inputs.TESTGROUP }}
Expand Down
87 changes: 23 additions & 64 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ jobs:
name: "android tests"
if: ${{ false }} # disable for experimental
timeout-minutes: 60
runs-on: macos-11
runs-on: macos-12
env:
TESTGROUP: android
environment:
name: android
url: https://testresults.marcusfelling.com/${{ env.TESTGROUP }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: main

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
Expand All @@ -49,33 +49,28 @@ jobs:
HOME=/root npx playwright test

- name: Upload HTML report as artifact. To troubleshoot failures, extract .zip and double-click index.html.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TESTGROUP }}
path: |
playwright-report

basicTests:
uses: ./.github/workflows/template-test.yml
with:
TESTGROUP: basic

chromeExtensionTests:
name: "chrome-extension tests"
timeout-minutes: 60
runs-on: macos-11
runs-on: macos-12
env:
TESTGROUP: chrome-extension
environment:
name: chrome-extension
url: https://testresults.marcusfelling.com/${{ env.TESTGROUP }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: main

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
Expand All @@ -93,7 +88,7 @@ jobs:
npx playwright test --headed --project=chromium

- name: Upload HTML report as artifact. To troubleshoot failures, extract .zip and double-click index.html.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TESTGROUP }}
Expand All @@ -109,20 +104,20 @@ jobs:
fixturesTests:
name: "fixtures tests"
timeout-minutes: 60
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
container:
image: mcr.microsoft.com/playwright:v1.38.0-jammy
image: mcr.microsoft.com/playwright:v1.46.0-jammy
env:
TESTGROUP: fixtures
environment:
name: fixtures
url: https://testresults.marcusfelling.com/${{ env.TESTGROUP }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: main

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
Expand All @@ -139,7 +134,7 @@ jobs:
HOME=/root npx playwright test test-fixture.spec.ts

- name: Upload HTML report as artifact. To troubleshoot failures, extract .zip and double-click index.html.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TESTGROUP }}
Expand All @@ -149,9 +144,9 @@ jobs:
githubAPITests:
name: "github-api tests"
timeout-minutes: 60
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
container:
image: mcr.microsoft.com/playwright:v1.38.0-jammy
image: mcr.microsoft.com/playwright:v1.46.0-jammy
env:
TESTGROUP: github-api
BASEURL: https://api.github.com # Playwright tests use this for baseURL
Expand All @@ -161,11 +156,11 @@ jobs:
name: github-api
url: https://testresults.marcusfelling.com/${{ env.TESTGROUP }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: main

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
Expand All @@ -182,7 +177,7 @@ jobs:
HOME=/root npx playwright test

- name: Upload HTML report as artifact. To troubleshoot failures, extract .zip and double-click index.html.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TESTGROUP }}
Expand All @@ -192,9 +187,9 @@ jobs:
name: "oauth tests"
timeout-minutes: 60
if: ${{ false }} # disable for now for bot detection
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
container:
image: mcr.microsoft.com/playwright:v1.38.0-jammy
image: mcr.microsoft.com/playwright:v1.46.0-jammy
env:
TESTGROUP: oauth
BASEURL: https://courses.ultimateqa.com/users/sign_in # Playwright tests use this for baseURL
Expand All @@ -205,11 +200,11 @@ jobs:
name: oauth
url: https://testresults.marcusfelling.com/${{ env.TESTGROUP }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: main

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
Expand All @@ -226,7 +221,7 @@ jobs:
HOME=/root npx playwright test

- name: Upload HTML report as artifact. To troubleshoot failures, extract .zip and double-click index.html.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TESTGROUP }}
Expand Down Expand Up @@ -256,39 +251,3 @@ jobs:
with:
TESTGROUP: visual-comparison
BASEURL: https://playwright.dev

publishTestResults:
name: "Publish Test Results to to testresults.marcusfelling.com"
needs:
[
accessibilityTests,
androidTests,
basicTests,
chromeExtensionTests,
dragAndDropTests,
fixturesTests,
githubAPITests,
oauthTests,
performanceTests,
svgomgTests,
todomvcTests,
visualComparisonTests,
]
runs-on: ubuntu-22.04
if: always()
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
id: download

- name: Publish to GH Pages
if: always()
uses: peaceiris/[email protected]
with:
external_repository: MarcusFelling/demo.reports
publish_branch: main
personal_token: ${{ secrets.PERSONAL_TOKEN }}
publish_dir: ${{steps.download.outputs.download-path}}
keep_files: true
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,6 @@ The [test.yml](../../actions/workflows/test.yml) GitHub Action workflow is used

**[visual-comparison](./visual-comparison/tests/example.spec.ts)** - visually compares snapshots with golden screenshots and text content for playwright.dev landing page.

## Publish each HTML report to their respective directory

When the above tests are finished, the results are published to GitHub pages:

* [testresults.marcusfelling.com/accessibility](https://testresults.marcusfelling.com/accessibility)
* [testresults.marcusfelling.com/basic](https://testresults.marcusfelling.com/basic)
* [testresults.marcusfelling.com/chrome-extension](https://testresults.marcusfelling.com/chrome-extension)
* [testresults.marcusfelling.com/drag-and-drop](https://testresults.marcusfelling.com/drag-and-drop)
* [testresults.marcusfelling.com/fixtures](https://testresults.marcusfelling.com/fixtures)
* [testresults.marcusfelling.com/github-api](https://testresults.marcusfelling.com/github-api)
* [testresults.marcusfelling.com/oauth](https://testresults.marcusfelling.com/oauth)
* [testresults.marcusfelling.com/performance](https://testresults.marcusfelling.com/performance)
* [testresults.marcusfelling.com/svgomg](https://testresults.marcusfelling.com/svgomg)
* [testresults.marcusfelling.com/todomvc](https://testresults.marcusfelling.com/todomvc)
* [testresults.marcusfelling.com/visual-comparison](https://testresults.marcusfelling.com/visual-comparison)

## Configuration

The [baseURL](https://playwright.dev/docs/api/class-testoptions#test-options-base-url) value for most tests is set via [.env file](https://github.com/motdotla/dotenv) that you'll find at the root of each folder. Typically this file is gitignored; by including it in this demo repo, it makes running and sharing these tests easier.
Expand Down
2 changes: 1 addition & 1 deletion basic/1-getting-started.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

test('basic test', async ({page}) => {
await page.goto('https://todomvc.com/examples/vanilla-es6/');
await page.goto('https://todomvc.com/examples/javascript-es6/dist/');

// Use locators to represent a selector and re-use them
const inputBox = page.locator('input.new-todo');
Expand Down
6 changes: 3 additions & 3 deletions basic/2-actions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

test.beforeEach(async ({page}) => {
await page.goto('https://todomvc.com/examples/vanilla-es6/');
await page.goto('https://todomvc.com/examples/javascript-es6/dist/');
});

/**
Expand Down Expand Up @@ -29,7 +29,7 @@ test('basic interaction', async ({page}) => {
*/
test('element selectors', async ({page}) => {
// When no selector engine is specified, Playwright will use the css selector engine.
await page.type('.header input', 'Learn Playwright');
await page.fill('.header input', 'Learn Playwright');
// So the selector above is the same as the following:
await page.press('css=.header input', 'Enter');

Expand All @@ -47,5 +47,5 @@ test('element selectors', async ({page}) => {
await page.click('text=Completed >> visible=true');

// XPath selector
await page.click('xpath=//html/body/section/section/label');
await page.click('xpath=//html/body/section/main/div/label');
});
13 changes: 3 additions & 10 deletions basic/3-assertions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

test.beforeEach(async ({page}) => {
await page.goto('https://todomvc.com/examples/vanilla-es6/');
await page.goto('https://todomvc.com/examples/javascript-es6/dist/');
});

/**
Expand All @@ -10,8 +10,8 @@ test.beforeEach(async ({page}) => {
*/
test('should be able to use assertions', async ({page}) => {
await test.step('toHaveTitle/toHaveURL', async () => {
await expect(page).toHaveTitle('Vanilla ES6 • TodoMVC');
await expect(page).toHaveURL('https://todomvc.com/examples/vanilla-es6/');
await expect(page).toHaveTitle('TodoMVC: JavaScript Es6 Webpack');
await expect(page).toHaveURL('https://todomvc.com/examples/javascript-es6/dist/');
});

await test.step('toBeEmpty/toHaveValue', async () => {
Expand Down Expand Up @@ -40,12 +40,5 @@ test('should be able to use assertions', async ({page}) => {
await test.step('toBeVisible/toBeHidden', async () => {
await expect(page.locator('text=Buy milk')).toBeVisible();
await page.click('text=Active');
await expect(page.locator('text=Buy milk')).toBeHidden();
});

await test.step('toHaveClass/toHaveCSS', async () => {
await expect(page.locator('[placeholder="What needs to be done?"]')).toHaveClass('new-todo');
await page.click('text=Clear completed');
await expect(page.locator('.main')).toHaveCSS('display', 'none');
});
});
2 changes: 1 addition & 1 deletion basic/4-file-uploads.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const fileToUpload = __filename; // '__filename' is the current test file.
* input. Once the event was emitted we set the file and submit the form.
* @see https://playwright.dev/docs/api/class-filechooser
*/
test('should be able to upload files', async ({page, context}) => {
test('should be able to upload files', async ({page}) => {
await page.goto('/file-uploads.html');
const [fileChooser] = await Promise.all([
page.waitForEvent('filechooser'),
Expand Down
Loading
Loading