Skip to content

Commit

Permalink
[end2end] cors and projet filename test converted from cypress to pla…
Browse files Browse the repository at this point in the history
…ywright (#4009)

* cors and projet filename converted from cypress to playwright

* create dedicated end2end conf to ignore local tests
  • Loading branch information
nworr authored Dec 11, 2023
1 parent a81a3de commit 4089de0
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:

- name: Run Playwright tests
id: test-playwright
run: cd end2end && npx playwright test --project=chromium
run: cd end2end && npx playwright test --project=end2end

- name: Notify in case of playwright failure, from mainstream branches only
uses: peter-evans/commit-comment@v3
Expand Down
20 changes: 0 additions & 20 deletions tests/end2end/cypress/integration/cors.js

This file was deleted.

This file was deleted.

8 changes: 8 additions & 0 deletions tests/end2end/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ export default defineConfig({
dependencies: ['setup'],
},

{
name: 'end2end',
use: {
browserName: 'chromium',
},
dependencies: ['setup'],
testIgnore: '**/localonly/**',
},
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
Expand Down
15 changes: 15 additions & 0 deletions tests/end2end/playwright/dot-or-space-in-project-filename.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test';

test.describe('Filename with dot or space', () => {

test('projet with dot or space can be loaded', async ({ page }) => {
// project file with dot
await page.goto('/index.php/view/map/?repository=testsrepository&project=base_layers.withdot');await expect(page.locator(
'#node-quartiers')).toBeVisible();
// project file with space
await page.goto('/index.php/view/map/?repository=testsrepository&project=base_layers+with+space');await expect(page.locator(

'#node-quartiers')).toBeVisible();
});

});
24 changes: 24 additions & 0 deletions tests/end2end/playwright/localonly/cors.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { test, expect } from '@playwright/test';

test.describe('Cors', function () {

test('send authorized request', async function ({ page }, testInfo) {
await page.goto('http://othersite.local:8130');
await page.locator('#launch-request').click();
await expect(page.locator('#status')).toHaveText('200');
await expect(page.locator('#response')).not.toBeEmpty();
expect(testInfo.stderr).toHaveLength(0);

});


test('send unauthorized request', async function ({ page }, testInfo) {
await page.goto(
'http://othersite.local:8130');
await page.locator('#launch-request-bad').click();
await expect(page.locator('#status_bad')).toBeEmpty();
await expect(page.locator('#response_bad')).toBeEmpty();
expect(testInfo.stderr).not.toBe('');
});

});

0 comments on commit 4089de0

Please sign in to comment.