bgg-ottawa-sell-club/e2e/hide-game.test.js

27 lines
691 B
JavaScript
Raw Permalink Normal View History

2024-02-09 17:49:22 +00:00
import { test, expect } from '@playwright/test';
test('hide game', async ({ page }) => {
await page.goto('/');
2024-02-09 18:43:54 +00:00
let nbr_games = 0;
await expect(async () => {
nbr_games = await page
.locator('.game')
.all()
.then((games) => games.length);
expect(nbr_games).toBeGreaterThan(0);
}).toPass();
2024-02-09 17:49:22 +00:00
await page.getByRole('button', { name: 'visibility' }).first().click();
await expect(async () => {
const one_hidden = await page
2024-02-09 18:43:54 +00:00
.locator('.game')
2024-02-09 17:49:22 +00:00
.all()
.then((games) => games.length);
expect(one_hidden).toEqual(nbr_games - 1);
}).toPass({ timeout: 10_000 });
});