Skip to content

Commit

Permalink
Merge pull request #64 from swup/feat/playwright-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hirasso authored Nov 14, 2023
2 parents 2d5e4d5 + b2332df commit f405134
Show file tree
Hide file tree
Showing 27 changed files with 1,396 additions and 31 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: E2E tests

on:
push:
branches: [main, master, next]
pull_request:
workflow_dispatch:

jobs:
run-tests:
name: E2E tests
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Check out repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 18

- run: npm ci
- run: npm run build
- run: npx playwright install --with-deps

- name: Run tests
run: npx playwright test --config ./tests/config/playwright.config.ts

- uses: daun/playwright-report-summary@v2
with:
report-file: playwright-results.json
10 changes: 4 additions & 6 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: Unit tests

on:
push:
branches: [ main, master, next ]
branches: [main, master, next]
pull_request:
workflow_dispatch:

jobs:
run-tests:
Expand All @@ -20,11 +21,8 @@ jobs:
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Bundle library
run: npm run build
- run: npm ci
- run: npm run build

- name: Run tests
run: npm run test:unit
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ Thumbs.db
dist
*.tgz
src/packages

# Testing tools and outputs
/tests/reports/
/tests/results/
/tests/fixtures/dist/
/playwright/.cache/
/playwright-report/
/coverage
.nyc_output
report.json
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<div class="shields">

<!--[![npm version](https://img.shields.io/npm/v/@swup/fragment-plugin.svg)](https://www.npmjs.com/package/@swup/fragment-plugin) -->
[![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)
[![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)
[![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)
[![License](https://img.shields.io/github/license/swup/fragment-plugin.svg)](https://github.com/swup/fragment-plugin/blob/master/LICENSE)

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

```html
<div id="swup" class="transition-main">
<div id="swup" class="transition-main" class="transition-main">
<!-- This should be placed above everything else, like a modal -->
<main id="user" class="modal">
<h1>User 1</h1>
Expand Down
Loading

0 comments on commit f405134

Please sign in to comment.