-
Notifications
You must be signed in to change notification settings - Fork 0
Setup Playwright UI monitoring to stabilise automated dependency updates #11
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,6 @@ | ||
| # To get started with Dependabot version updates, you'll need to specify which | ||
| # package ecosystems to update and where the package manifests are located. | ||
| # Please see the documentation for all configuration options: | ||
| # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
|
||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "" # See documentation for possible values | ||
| directory: "/" # Location of package manifests | ||
| - package-ecosystem: "npm" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "monthly" | ||
| interval: "weekly" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Playwright tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["master"] | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to pin the node version? |
||
| cache: npm | ||
| - run: npm ci | ||
| - run: npx playwright install --with-deps chromium | ||
| - run: npm run build-only -- --mode dev | ||
| - run: npm run test:e2e -- --project=chromium | ||
| - uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: playwright-report | ||
| path: playwright-report/ | ||
| retention-days: 30 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename the file to better suite the content.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also test the content and snapshot after a city has been searched |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,41 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| // See here how to get started: | ||
| // https://playwright.dev/docs/intro | ||
| test('visits the app root url', async ({ page }) => { | ||
| await page.goto('/'); | ||
| await expect(page.locator('div.greetings > h1')).toHaveText('You did it!'); | ||
| }) | ||
| test.describe('Home page', () => { | ||
| test.beforeEach(async ({ context }) => { | ||
| await context.clearCookies(); | ||
| await context.addInitScript(() => localStorage.clear()); | ||
|
Comment on lines
+5
to
+6
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? |
||
| }); | ||
|
|
||
| test('shows header with logo and city search input', async ({ page }) => { | ||
| await page.goto('/'); | ||
|
|
||
| await expect(page.locator('header')).toBeVisible(); | ||
| await expect(page.locator('header a[href="/about"] img')).toBeVisible(); | ||
| await expect(page.locator('.vs__search')).toBeVisible(); | ||
| await expect(page.locator('.vs__search')).toHaveAttribute('placeholder', 'Enter a city name. Ex: Paris'); | ||
| await expect(page.locator('button[aria-label="Use device location"]')).toBeVisible(); | ||
| }); | ||
|
|
||
| test('matches screenshot', async ({ page }) => { | ||
| await page.goto('/'); | ||
| await expect(page).toHaveScreenshot('home.png'); | ||
| }); | ||
| }); | ||
|
|
||
| test.describe('About page', () => { | ||
| test('shows settings and info sections', async ({ page }) => { | ||
| await page.goto('/about'); | ||
|
|
||
| await expect(page.locator('header a[href="/"]')).toBeVisible(); | ||
| await expect(page.locator('h3').filter({ hasText: 'Models' })).toBeVisible(); | ||
| await expect(page.locator('h3').filter({ hasText: 'Forecast length' })).toBeVisible(); | ||
| await expect(page.locator('h3').filter({ hasText: 'Build date' })).toBeVisible(); | ||
| await expect(page.locator('h3').filter({ hasText: 'Source code' })).toBeVisible(); | ||
| await expect(page.locator('a[href="https://github.com/artonge/meteo"]')).toBeVisible(); | ||
| }); | ||
|
|
||
| test('matches screenshot', async ({ page }) => { | ||
| await page.goto('/about'); | ||
| await expect(page).toHaveScreenshot('about.png'); | ||
| }); | ||
| }); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change needed? |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those needs to be pined