-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
371 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: End to end Tests | ||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
jobs: | ||
test: | ||
timeout-minutes: 10 | ||
defaults: | ||
run: | ||
working-directory: ./tests/end-to-end | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up cargo cache | ||
uses: Swatinem/rust-cache@378c8285a4eaf12899d11bea686a763e906956af | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: 'npm' | ||
cache-dependency-path: ./tests/end-to-end/package-lock.json | ||
- name: Install dependencies | ||
run: > | ||
npm ci | ||
npx playwright install --with-deps chromium | ||
- name: build sqlpage | ||
run: cargo build | ||
working-directory: ./examples/official-site | ||
- name: start official site and wait for it to be ready | ||
timeout-minutes: 1 | ||
run: > | ||
cargo run 2>/tmp/stderrlog & | ||
tail -f /tmp/stderrlog | grep -q "started successfully" | ||
working-directory: ./examples/official-site | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
- name: show server logs | ||
if: failure() | ||
run: cat /tmp/stderrlog | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const BASE = 'http://localhost:8080/'; | ||
|
||
test('Open documentation', async ({ page }) => { | ||
await page.goto(BASE); | ||
|
||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle("SQLPage"); | ||
|
||
// open the submenu | ||
await page.getByText('Documentation', { exact: true }).first().click(); | ||
await page.getByText('All Components').click(); | ||
const components = ['form', 'map', 'chart', 'button']; | ||
for (const component of components) { | ||
await expect(page.getByRole('link', { name: component }).first()).toBeVisible(); | ||
} | ||
}); | ||
|
||
test('chart', async ({ page }) => { | ||
await page.goto(BASE + '/documentation.sql?component=chart#component'); | ||
await expect(page.getByText('Loading...')).not.toBeVisible(); | ||
await expect(page.locator('.apexcharts-canvas').first()).toBeVisible(); | ||
}); | ||
|
||
test('map', async ({ page }) => { | ||
await page.goto(BASE + '/documentation.sql?component=map#component'); | ||
await expect(page.getByText('Loading...')).not.toBeVisible(); | ||
await expect(page.locator('.leaflet-marker-icon').first()).toBeVisible(); | ||
}); | ||
|
||
test('form example', async ({ page }) => { | ||
await page.goto(BASE + '/examples/multistep-form'); | ||
// Single selection matching the value or label | ||
await page.getByLabel('From').selectOption('Paris'); | ||
await page.getByText('Next').click(); | ||
await page.getByLabel(/\bTo\b/).selectOption('Mexico'); | ||
await page.getByText('Next').click(); | ||
await page.getByLabel('Number of Adults').fill('1'); | ||
await page.getByText('Next').click(); | ||
await page.getByLabel('Passenger 1 (adult)').fill('John Doe'); | ||
await page.getByText('Book the flight').click(); | ||
await expect(page.getByText('John Doe').first()).toBeVisible(); | ||
}); | ||
|
||
test('File upload', async ({ page }) => { | ||
await page.goto(BASE); | ||
await page.getByText('Examples', { exact: true }).click(); | ||
await page.getByText('File uploads').click(); | ||
const my_svg = '<svg><text y="20">Hello World</text></svg>'; | ||
// @ts-ignore | ||
const buffer = Buffer.from(my_svg); | ||
await page.getByLabel('Picture').setInputFiles({ | ||
name: 'small.svg', | ||
mimeType: 'image/svg+xml', | ||
buffer, | ||
}); | ||
await page.getByRole('button', { name: 'Upload picture' }).click(); | ||
await expect(page.locator('img[src^=data]').first().getAttribute('src')).resolves.toBe('data:image/svg+xml;base64,' + buffer.toString('base64')); | ||
}); |
Oops, something went wrong.