WIP specs for guest creation
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Successful in 40s
Add copyright notice / copyright_notice (pull_request) Successful in 54s
Build Nginx-based docker image / build-static-assets (push) Successful in 5m28s
Playwright Tests / test (pull_request) Failing after 14m3s

This commit is contained in:
Manuel Bustillo 2025-06-01 23:46:25 +02:00
parent e8551dd877
commit 3748805377

View File

@ -1,29 +1,36 @@
import { test, expect, Page } from '@playwright/test'
import { mock } from 'node:test';
const mockGuestsAPI = ({ page }: { page: Page }) => {
page.route('*/**/api/default/guests', async route => {
const json = [
{
"id": "f4a09c28-40ea-4553-90a5-96935a59cac6",
"status": "tentative",
"name": "Kristofer Rohan DVM",
"group": {
"id": "2fcb8b22-6b07-4c34-92e3-a2535dbc5b14",
"name": "Childhood friends",
}
},
{
"id": "bd585c40-0937-4cde-960a-bb23acfd6f18",
"status": "invited",
"name": "Olevia Quigley Jr.",
"group": {
"id": "da8edf26-3e1e-4cbb-b985-450c49fffe01",
"name": "Work",
}
},
];
if (route.request().method() === 'GET') {
const json = [
{
"id": "f4a09c28-40ea-4553-90a5-96935a59cac6",
"status": "tentative",
"name": "Kristofer Rohan DVM",
"group": {
"id": "2fcb8b22-6b07-4c34-92e3-a2535dbc5b14",
"name": "Childhood friends",
}
},
{
"id": "bd585c40-0937-4cde-960a-bb23acfd6f18",
"status": "invited",
"name": "Olevia Quigley Jr.",
"group": {
"id": "da8edf26-3e1e-4cbb-b985-450c49fffe01",
"name": "Work",
}
},
];
await route.fulfill({ json })
await route.fulfill({ json })
} else if (route.request().method() === 'POST') {
const json = {};
await route.fulfill({ json });
}
})
}
@ -92,6 +99,28 @@ test('should display the list of guests', async ({ page }) => {
await expect(page.getByRole('row').nth(2).locator('svg')).toHaveCount(2);
});
test('should allow creating a new guest', async ({ page }) => {
await mockGuestsAPI({ page });
await mockGroupsAPI({ page });
await page.goto('/default/dashboard/guests');
await page.getByRole('button', { name: 'Add new' }).click();
await page.getByRole('dialog').getByLabel('Name').fill('John Snow');
await page.keyboard.press('Tab');
await page.keyboard.press('ArrowDown');
await page.keyboard.press('ArrowDown');
await page.keyboard.press('Enter');
await page.keyboard.press('Tab');
await page.keyboard.press('ArrowDown');
await page.keyboard.press('ArrowDown');
await page.keyboard.press('Enter');
await page.getByRole('dialog').getByRole('button', { name: 'Create' }).click();
});
test('should display the list of groups', async ({ page }) => {
await mockGroupsAPI({ page });