better
This commit is contained in:
parent
b9485e4097
commit
0c0f08b350
1 changed files with 1565 additions and 1579 deletions
|
|
@ -5,14 +5,19 @@ test('the home page explains the app and its guides fit the screen', async ({ pa
|
|||
page.on('pageerror', (error) => errors.push(error.message));
|
||||
await page.goto('/');
|
||||
await expect(page.getByRole('heading', { level: 1 })).toHaveText(
|
||||
'A great floorstarts witha little planning.',
|
||||
'A great floor starts with a little planning.',
|
||||
);
|
||||
await expect(page.getByRole('heading', { name: 'Scotia or skirting board?' })).toBeVisible();
|
||||
await expect(page.getByRole('link', { name: 'Plan my floor' })).toHaveCount(2);
|
||||
await expect(page.getByRole('link', { name: 'Plan my floor' })).toHaveCount(1);
|
||||
await expect(page.getByRole('link', { name: 'Plan my floor' }).first()).toBeInViewport();
|
||||
await page.getByRole('link', { name: 'First time fitting a floor?' }).click();
|
||||
await expect(page).toHaveURL(/#guide$/);
|
||||
await expect(page.getByRole('heading', { name: /Your first floor/ })).toBeInViewport();
|
||||
await expect(page.getByRole('link', { name: 'Open planner' })).toBeInViewport();
|
||||
const header = await page.getByRole('banner').boundingBox();
|
||||
const guide = await page.getByRole('heading', { name: /Your first floor/ }).boundingBox();
|
||||
expect(header!.y).toBe(0);
|
||||
expect(guide!.y).toBeGreaterThanOrEqual(header!.height);
|
||||
await page.reload();
|
||||
await expect(page.getByRole('heading', { name: /Your first floor/ })).toBeInViewport();
|
||||
await page.getByRole('link', { name: 'Back to top' }).click();
|
||||
|
|
@ -26,16 +31,19 @@ test('the home page explains the app and its guides fit the screen', async ({ pa
|
|||
for (const [name, selector] of [
|
||||
['header', '.landing-header'],
|
||||
['hero', '.landing-hero'],
|
||||
['closing', '.landing-final-cta'],
|
||||
]) {
|
||||
test(`the ${name} CTA opens a working planner and browser history returns home`, async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
if (name === 'header') {
|
||||
await page.getByRole('contentinfo').scrollIntoViewIfNeeded();
|
||||
await expect(page.getByRole('link', { name: 'Open planner' })).toBeInViewport();
|
||||
}
|
||||
await page.locator(selector).locator('a[href="?planner"]').click();
|
||||
await expect(page.getByRole('heading', { name: 'Room measurements' })).toBeVisible();
|
||||
await expect(page.getByLabel('Room width', { exact: true })).toHaveValue('4800');
|
||||
await expect(page).toHaveURL(/\?version=1&/);
|
||||
await expect(page).toHaveURL(/\?version=\d+&/);
|
||||
await page.getByLabel('Room name', { exact: true }).fill('My first floor');
|
||||
const projectUrl = page.url();
|
||||
await page.reload();
|
||||
|
|
|
|||
Loading…
Reference in a new issue