Skip to content

Commit f405134

Browse files
authored
Merge pull request #64 from swup/feat/playwright-tests
2 parents 2d5e4d5 + b2332df commit f405134

27 files changed

+1396
-31
lines changed

.github/workflows/e2e-tests.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: E2E tests
2+
3+
on:
4+
push:
5+
branches: [main, master, next]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
run-tests:
11+
name: E2E tests
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
15+
steps:
16+
- name: Check out repo
17+
uses: actions/checkout@v3
18+
19+
- name: Set up node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
- run: npm ci
25+
- run: npm run build
26+
- run: npx playwright install --with-deps
27+
28+
- name: Run tests
29+
run: npx playwright test --config ./tests/config/playwright.config.ts
30+
31+
- uses: daun/playwright-report-summary@v2
32+
with:
33+
report-file: playwright-results.json

.github/workflows/unit-tests.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ name: Unit tests
22

33
on:
44
push:
5-
branches: [ main, master, next ]
5+
branches: [main, master, next]
66
pull_request:
7+
workflow_dispatch:
78

89
jobs:
910
run-tests:
@@ -20,11 +21,8 @@ jobs:
2021
with:
2122
node-version: 18
2223

23-
- name: Install dependencies
24-
run: npm ci
25-
26-
- name: Bundle library
27-
run: npm run build
24+
- run: npm ci
25+
- run: npm run build
2826

2927
- name: Run tests
3028
run: npm run test:unit

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@ Thumbs.db
66
dist
77
*.tgz
88
src/packages
9+
10+
# Testing tools and outputs
11+
/tests/reports/
12+
/tests/results/
13+
/tests/fixtures/dist/
14+
/playwright/.cache/
15+
/playwright-report/
16+
/coverage
17+
.nyc_output
18+
report.json

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<div class="shields">
44

55
<!--[![npm version](https://img.shields.io/npm/v/@swup/fragment-plugin.svg)](https://www.npmjs.com/package/@swup/fragment-plugin) -->
6-
[![Test status](https://img.shields.io/github/actions/workflow/status/swup/fragment-plugin/unit-tests.yml?branch=master&label=unit%20tests)](https://github.com/swup/fragment-plugin/actions/workflows/unit-tests.yml)
6+
[![Unit Tests](https://img.shields.io/github/actions/workflow/status/swup/fragment-plugin/unit-tests.yml?branch=master&label=vitest)](https://github.com/swup/fragment-plugin/actions/workflows/unit-tests.yml)
7+
[![E2E Tests](https://img.shields.io/github/actions/workflow/status/swup/fragment-plugin/e2e-tests.yml?branch=master&label=playwright)](https://github.com/swup/fragment-plugin/actions/workflows/e2e-tests.yml)
78
[![License](https://img.shields.io/github/license/swup/fragment-plugin.svg)](https://github.com/swup/fragment-plugin/blob/master/LICENSE)
89

910
</div>
@@ -92,7 +93,7 @@ container.
9293
```html
9394
<body>
9495
<header>Website</header>
95-
<main id="swup" class="transition-main">
96+
<main id="swup" class="transition-main" class="transition-main">
9697
<h1>Users</h1>
9798
<!-- A list of filters for the users: selecting one will update the list below -->
9899
<ul>
@@ -370,7 +371,7 @@ If all elements of a visit are `<template>` elements, the `out`/`in`-animation w
370371
Suppose you have an overlay that you want to present like a modal, above all other content:
371372

372373
```html
373-
<div id="swup" class="transition-main">
374+
<div id="swup" class="transition-main" class="transition-main">
374375
<!-- This should be placed above everything else, like a modal -->
375376
<main id="user" class="modal">
376377
<h1>User 1</h1>

0 commit comments

Comments
 (0)