Skip to content

Commit dea6330

Browse files
committed
test: add failing test case
1 parent 1eb41fd commit dea6330

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
type: lesson
3+
title: Layout change from
4+
template: default
5+
mainCommand: node index.mjs
6+
previews:
7+
- title: "Custom preview"
8+
port: 8000
9+
---
10+
11+
# Navigation test - Layout change from
12+
13+
This page should show previw
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
type: lesson
3+
title: Layout change to
4+
previews: false
5+
terminal:
6+
panels:
7+
- ["terminal", "Custom Terminal"]
8+
---
9+
10+
# Navigation test - Layout change to
11+
12+
This page should not show previw. It should show terminal instead.

e2e/src/content/tutorial/tests/navigation/meta.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ lessons:
55
- page-one
66
- page-two
77
- page-three
8+
- layout-change-from
9+
- layout-change-to
810
mainCommand: ''
911
prepareCommands: []
1012
---

e2e/test/navigation.test.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { test, expect } from '@playwright/test';
22

3-
const BASE_URL = '/tests/navigation/page-one';
3+
const BASE_URL = '/tests/navigation';
44

55
test('user can navigate between lessons using nav bar links', async ({ page }) => {
6-
await page.goto(BASE_URL);
6+
await page.goto(`${BASE_URL}/page-one`);
77
await expect(page.getByRole('heading', { level: 1, name: 'Navigation test - Page one' })).toBeVisible();
88

99
// navigate forwards
@@ -21,10 +21,32 @@ test('user can navigate between lessons using nav bar links', async ({ page }) =
2121
});
2222

2323
test('user can navigate between lessons using breadcrumbs', async ({ page }) => {
24-
await page.goto(BASE_URL);
24+
await page.goto(`${BASE_URL}/page-one`);
2525

2626
await page.getByRole('button', { name: 'Tests / Navigation / Page one' }).click({ force: true });
2727
await page.getByRole('region', { name: 'Navigation' }).getByRole('link', { name: 'Page three' }).click();
2828

2929
await expect(page.getByRole('heading', { level: 1, name: 'Navigation test - Page three' })).toBeVisible();
3030
});
31+
32+
test("user should see metadata's layout changes after navigation (#318)", async ({ page }) => {
33+
await page.goto(`${BASE_URL}/layout-change-from`);
34+
35+
// first page should have preview visible
36+
await expect(page.getByRole('heading', { level: 1, name: 'Navigation test - Layout change from' })).toBeVisible();
37+
await expect(page.getByText('Custom preview')).toBeVisible();
38+
39+
await page.getByRole('link', { name: 'Layout change to' }).click();
40+
await expect(page.getByRole('heading', { level: 1, name: 'Navigation test - Layout change to' })).toBeVisible();
41+
42+
// second page should have preview hidden, terminal visible
43+
44+
/* eslint-disable multiline-comment-style */
45+
// TODO: Requires #245
46+
// await expect(page.getByText('Preparing Environment')).not.toBeVisible();
47+
48+
await expect(page.getByRole('tab', { name: 'Custom Terminal', selected: true })).toBeVisible();
49+
await expect(page.getByRole('tabpanel', { name: 'Custom Terminal' })).toContainText('~/tutorial', {
50+
useInnerText: true,
51+
});
52+
});

0 commit comments

Comments
 (0)