Skip to content

Commit

Permalink
test: using playwright in my squash site, still not working for the t…
Browse files Browse the repository at this point in the history
…ransition between pages

::by sergio giraldo
@ 20240728T1134CEST, gpg signed
  • Loading branch information
sergiorgiraldo committed Jul 28, 2024
1 parent 50dc708 commit 4f24695
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ITERATION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.13
0.0.14
41 changes: 40 additions & 1 deletion playwright/squash/tests/squash.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test('check fields to reserve court', async ({ page }) => {
test('reserve a court and expect alert', async ({ page }) => {
await page.locator('ul li a').nth(0).click();

await page.fill('#reservationDate','2022-11-11');
await page.fill('#reservationDate', '2022-11-11');

await page.fill('#reservationTime', '12:00');

Expand All @@ -74,4 +74,43 @@ test('reserve a court and expect alert', async ({ page }) => {
await page.click('button[type="submit"]');

await dialogPromise;
});

//all reservations
test('check link to get courts reserved', async ({ page }) => {
await page.locator('ul li a').nth(1).click();

await expect(page).toHaveTitle(/Alle Reserveringen/);
});

test('reserve a court and expect to be shown', async ({ page }) => {
//first reserve
await page.locator('ul li a').nth(0).click();

const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const formattedDate = tomorrow.toISOString().split('T')[0];
await page.fill('#reservationDate', formattedDate);

await page.fill('#reservationTime', '12:00');

await page.fill('#courtNumber', '1');

await page.fill('#reservationName', 'test-foo-bar');

const dialogPromise = new Promise(resolve => {
page.once('dialog', async dialog => {
await dialog.accept();
resolve(null);
});
});

await page.click('button[type="submit"]');

await dialogPromise;

//go to reservation list
await page.locator('ul li a').nth(0).click();
const reservations = page.locator('#reservationTable tbody tr');
expect(reservations).toHaveText('test-foo-bar');
});

0 comments on commit 4f24695

Please sign in to comment.