Skip to content

Commit c8d6d07

Browse files
authored
Merge pull request #480 from geolonia/ci/add-e2e-tests
Add e2e test job to CI workflow
2 parents 4620423 + 865d171 commit c8d6d07

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,29 @@ jobs:
4949
dist/
5050
docs/
5151
52+
e2e:
53+
runs-on: ubuntu-latest
54+
timeout-minutes: 30
55+
needs: build
56+
steps:
57+
- uses: actions/checkout@v6
58+
- uses: actions/setup-node@v6
59+
with:
60+
node-version: '22.x'
61+
cache: 'npm'
62+
- run: npm ci
63+
- name: Install Playwright
64+
run: npx playwright install --with-deps chromium
65+
- name: Run e2e tests
66+
run: npm run e2e
67+
- name: Upload Playwright report
68+
uses: actions/upload-artifact@v7
69+
if: ${{ !cancelled() }}
70+
with:
71+
name: playwright-report
72+
path: playwright-report/
73+
retention-days: 7
74+
5275
gh-pages:
5376
name: 'Host with GitHub Pages'
5477
runs-on: ubuntu-latest
@@ -87,6 +110,7 @@ jobs:
87110
contents: read
88111
needs:
89112
- build
113+
- e2e
90114
- act-test
91115
if: startsWith(github.ref, 'refs/tags/v')
92116
steps:
@@ -113,7 +137,7 @@ jobs:
113137
run: npm publish --access=public --tag=next
114138

115139
deploy:
116-
needs: build
140+
needs: [build, e2e]
117141
runs-on: ubuntu-latest
118142
if: startsWith(github.ref, 'refs/tags/v')
119143

e2e/basic.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from '@playwright/test';
22
import { Geolonia } from '../src/embed';
3-
import { TEST_URL, waitForMapLoad } from './helper';
3+
import { TEST_URL, waitForMapLoad, waitForStyleLoad } from './helper';
44

55
declare global {
66
interface Window {
@@ -57,6 +57,7 @@ test.describe('1. 基本的な地図表示', () => {
5757
test('1.4 アトリビューションが表示されていること', async ({ page }) => {
5858
await page.goto(`${TEST_URL}/basic.html`);
5959
await waitForMapLoad(page);
60+
await waitForStyleLoad(page);
6061

6162
// CustomAttributionControl は Shadow DOM 内にアトリビューションを描画する
6263
const attributionText = await page.evaluate(() => {

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default defineConfig({
2222
/* Opt out of parallel tests on CI. */
2323
workers: process.env.CI ? 1 : undefined,
2424
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
25-
reporter: 'html',
25+
reporter: 'list',
2626
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2727
use: {
2828
/* Base URL to use in actions like `await page.goto('/')`. */

0 commit comments

Comments
 (0)