Skip to content

Commit

Permalink
Tests - Check if HTTP is between 200 included and 400 excluded
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Feb 12, 2025
1 parent 6ee8d05 commit b215b16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/end2end/playwright/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Page } from '@playwright/test';
export async function auth_using_login(page: Page, login: string, password: string, user_file: string) {
await expect(async () => {
const response = await page.goto('admin.php/auth/login?auth_url_return=%2Findex.php');
expect(response.status()).toBe(200);
expect(response.status()).toBeLessThan(400);
}).toPass({
intervals: [1_000, 2_000, 10_000],
timeout: 60_000
Expand Down
10 changes: 7 additions & 3 deletions tests/end2end/playwright/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export async function gotoMap(url, page, mapMustLoad = true, layersInTreeView =

await expect(async () => {
const response = await page.goto(url);
expect(response.status()).toBe(200);
expect(response.status()).toBeLessThan(400);
}).toPass({
intervals: [1_000, 2_000, 10_000],
timeout: 60_000
Expand Down Expand Up @@ -146,7 +146,7 @@ export async function reloadMap(page, check = true) {

await expect(async () => {
const response = await page.reload();
expect(response.status()).toBe(200);
expect(response.status()).toBeLessThan(400);
}).toPass({
intervals: [1_000, 2_000, 10_000],
timeout: 60_000
Expand Down Expand Up @@ -216,7 +216,11 @@ export async function expectParametersToContain(title, parameters, expectedParam

await expect(
searchParams.size,
`Check "${title}" : Not enough parameters compared to expected :\nGot ${Array.from(searchParams.keys()).join(', ')}!`
`Check "${title}" : Not enough parameters compared to expected :\n
Got ${searchParams.size}\n
Expected ${Object.keys(expectedParameters).length}\n
Detail got ${Array.from(searchParams.keys()).join(', ')}\n
Detail expected ${Object.keys(expectedParameters).join(', ')}`
).toBeGreaterThanOrEqual(Object.keys(expectedParameters).length)

for (const param in expectedParameters) {
Expand Down

0 comments on commit b215b16

Please sign in to comment.