Skip to content

Commit 7ac0101

Browse files
committed
fix: Fixed job to install hugo
1 parent 9c942a0 commit 7ac0101

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

.github/workflows/playwright.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,36 @@ jobs:
1919
uses: actions/checkout@v3
2020
- name: Install dependencies
2121
run: cd tests && npm ci
22+
- name: Setup Hugo
23+
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
24+
with:
25+
hugo-version: "0.134.2"
26+
extended: true
2227
- name: Install Playwright browsers
2328
run: npx playwright install --with-deps
2429
- name: Run Playwright tests
30+
id: test-visual
2531
run: make tests
2632
- uses: actions/upload-artifact@v4
27-
if: ${{ !cancelled() }}
33+
if: ${{ !cancelled() && failure() && steps.test-visual.conclusion == 'failure' }}
2834
with:
2935
name: playwright-report
3036
path: tests/playwright-report/
31-
retention-days: 30
37+
retention-days: 3
3238
- uses: actions/upload-artifact@v4
33-
if: ${{ !cancelled() }}
39+
if: ${{ !cancelled() && failure() && steps.test-visual.conclusion == 'failure' }}
3440
with:
3541
name: test-results
3642
path: tests/test-results/
37-
retention-days: 30
43+
retention-days: 3
44+
- name: Update the screenshots based on Ubuntu env on GH
45+
id: test-visual-update
46+
if: ${{ failure() && steps.test-visual.conclusion == 'failure' }}
47+
run: make tests-update-screenshots
48+
- name: Upload updated Playwright screenshots
49+
uses: actions/upload-artifact@v4
50+
if: ${{ failure() && steps.test-visual-update.conclusion == 'success' }}
51+
with:
52+
name: playwright-screenshots-updated
53+
path: tests/src/__screenshots__/**/*.png
54+
retention-days: 3

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ WRITE_FLAG := --write
66
list help::
77
$(info Available Make targets:)
88
@echo "<COMMON>"
9-
@echo " list | help: Print these available make targets"
9+
@echo " list | help: Print these available make targets"
1010
@echo "<LINTING AND FORMATTING>"
11-
@echo " biome-format: Runs the biome formatter."
12-
@echo " biome-lint: Runs the biome linter."
13-
@echo " biome-all: Runs both the lint and formatting commands."
11+
@echo " biome-format: Runs the biome formatter."
12+
@echo " biome-lint: Runs the biome linter."
13+
@echo " biome-all: Runs both the lint and formatting commands."
1414
@echo " (Set BIOME_ARGS to add additional arguments to biome command (ex: make biome-all BIOME_ARGS=write))"
1515
@echo "<PRE-COMMIT>"
16-
@echo " setup-pre-commit: Sets up pre-commit (assuming it is installed)"
16+
@echo " setup-pre-commit: Sets up pre-commit (assuming it is installed)"
1717
@echo "<PLAYWRIGHT TESTS>"
18-
@echo " test: Runs playwright against the old theme."
18+
@echo " test: Runs playwright against the old theme."
19+
@echo " tests-update-screenshots: Runs playwright against the old theme."
1920

2021
.PHONY: biome-format biome-lint biome-all setup-pre-commit tests
2122
FLAG :=
@@ -41,4 +42,6 @@ setup-pre-commit:
4142
fi
4243

4344
tests:
44-
cd tests && npx playwright test
45+
cd tests && npx playwright test
46+
tests-update-screenshots:
47+
cd tests && npx playwright test --update-snapshots

tests/playwright.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default defineConfig({
1414
screenshots: 'only-on-failure',
1515
video: 'retain-on-failure',
1616
trace: 'on-first-retry',
17+
timezoneId: 'America/Los_Angeles',
1718
},
1819
projects: [
1920
{
@@ -28,10 +29,6 @@ export default defineConfig({
2829
name: 'webkit',
2930
use: { ...devices['Desktop Safari'] },
3031
},
31-
{
32-
name: 'Mobile Chrome',
33-
use: { ...devices['Pixel 5'] },
34-
},
3532
],
3633
webServer: {
3734
command: `cd ../exampleSite && hugo mod get && hugo --gc -e production && hugo serve --port ${PORT}`,

tests/src/visual-regression.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ test.describe('Testing old theme', () => {
99
await page.evaluate(() => {
1010
// switch to old theme
1111
useNewTheme(false);
12+
window.scrollTo(0, 0);
1213
});
13-
await page.waitForTimeout(500);
14+
await page.waitForFunction(() => window.scrollY === 0);
1415
await page.screenshot({
1516
path: './test-results/example-site-snapshot.png',
1617
fullPage: true,

0 commit comments

Comments
 (0)