Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The mock tests run the app against the mock backend in
`src/app/mocks/`. Each test gets a new browser context, so it starts with
fresh mock data. The mock backend keeps creates, edits and deletes in session
storage, so a change stays after `page.reload()` in the same test.
A request that has no mock handler fails with a 404 and writes
`[mock] No handler for <method> <url>` to the browser console.

## Run the tests

Expand Down
16 changes: 12 additions & 4 deletions e2e/src/admin.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Page } from '@playwright/test';
import { expect, seedSession, test } from './fixtures/test-fixtures';
import {
expect,
seedMockData,
seedSession,
test,
} from './fixtures/test-fixtures';
import { AdminPage } from './pages';

/**
Expand Down Expand Up @@ -71,7 +76,10 @@ const TENANT = {
/** Tenant as saved by the mock staff API */
async function storedTenant(page: Page): Promise<typeof TENANT> {
return page.evaluate(
() => JSON.parse(sessionStorage.getItem('PLACEOS.mocks.tenants'))[0],
() =>
JSON.parse(
sessionStorage.getItem('PLACEOS.mocks.api_staff_v1_tenants'),
)[0],
);
}

Expand Down Expand Up @@ -197,7 +205,7 @@ test.describe('Admin', () => {

test.describe('Maximum booking length', () => {
test.beforeEach(async ({ page }) => {
await seedSession(page, 'tenants', [TENANT]);
await seedSession(page, 'api_staff_v1_tenants', [TENANT]);
await admin.gotoSection('staff-api');
});

Expand Down Expand Up @@ -289,7 +297,7 @@ test.describe('Admin', () => {

test.describe('US-ADM-011: Manage API Keys', () => {
test.beforeEach(async ({ page }) => {
await seedSession(page, 'api_keys', API_KEYS);
await seedMockData(page, 'api_keys', API_KEYS);
await admin.gotoSection('api-keys');
await admin.selectApiKeyDomain();
});
Expand Down
Loading
Loading