-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5242 from 3liz/backport-5239-to-release_3_8
[Backport release_3_8] Tests - Improve Playright tests with works and tags
- Loading branch information
Showing
6 changed files
with
54 additions
and
44 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 |
---|---|---|
|
@@ -27,6 +27,9 @@ jobs: | |
working-directory: tests | ||
env: | ||
CYPRESS_CI: TRUE | ||
PLAYWRIGHT_FORCE_TTY: true | ||
PLAYWRIGHT_LIST_PRINT_STEPS: true | ||
FORCE_COLOR: true | ||
# For testing only | ||
# PHP_VERSION: 8.3 | ||
# LZMPOSTGISVERSION: 16-3 | ||
|
@@ -162,11 +165,18 @@ jobs: | |
cd end2end | ||
npx playwright install --with-deps chromium | ||
- name: Run Playwright tests | ||
id: test-playwright | ||
- name: Run Playwright tests read-only | ||
id: test-playwright-read-only | ||
run: | | ||
cd end2end | ||
npx playwright test --project=end2end | ||
npx playwright test --grep @readonly --project=end2end | ||
- name: Run Playwright tests not tagged read-only | ||
id: test-playwright-not-read-only | ||
if: success() || steps.test-playwright-not-read-only.conclusion == 'failure' | ||
run: | | ||
cd end2end | ||
npx playwright test --workers 1 --grep-invert @readonly --project=end2end | ||
# - name: Generate PG dump from Playwright | ||
# if: failure() | ||
|
@@ -203,7 +213,7 @@ jobs: | |
- name: Cypress run | ||
id: test-cypress | ||
# Always run, even if playwright has failed | ||
if: always() | ||
if: success() || steps.test-playwright-not-read-only.conclusion == 'failure' || steps.test-playwright-not-read-only.conclusion == 'failure' | ||
uses: cypress-io/[email protected] | ||
with: | ||
browser: chrome | ||
|
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
12 changes: 0 additions & 12 deletions
12
tests/end2end/cypress/integration/error_occurred-ghaction.js
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
// @ts-check | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.describe('Dataviz API tests', | ||
{ | ||
tag: ['@requests', '@readonly'], | ||
}, () => { | ||
|
||
test('Test JSON data for plot 0 - Municipalities', async ({request}) => { | ||
const response = await request.get( | ||
'/index.php/dataviz/service?repository=testsrepository&project=dataviz', | ||
{ | ||
params:{ | ||
'request': 'getPlot', | ||
'plot_id': '0', | ||
} | ||
}); | ||
expect(response.status()).toBe(200); | ||
expect(response.headers()['content-type']).toBe('application/json'); | ||
const json = await response.json(); | ||
expect(json).toHaveProperty('title', 'Municipalities'); | ||
expect(json).toHaveProperty('data'); | ||
expect(json.data).toHaveLength(1); | ||
expect(json.data[0]).toHaveProperty('type', 'bar'); | ||
expect(json.data[0]).toHaveProperty('x'); | ||
expect(json.data[0].x).toStrictEqual(["Grabels", "Clapiers", "Montferrier-sur-Lez", "Saint-Jean-de-Védas", "Lattes", "Montpellier", "Lavérune", "Juvignac", "Le Crès", "Castelnau-le-Lez"]); | ||
expect(json.data[0]).toHaveProperty('y'); | ||
expect(json.data[0].y).toStrictEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); | ||
expect(json).toHaveProperty('layout') | ||
}); | ||
}); |