forked from stackblitz/tutorialkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminal.test.ts
36 lines (25 loc) · 1.38 KB
/
terminal.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { test, expect } from '@playwright/test';
const BASE_URL = '/tests/terminal';
test('user can open terminal', async ({ page }) => {
await page.goto(`${BASE_URL}/default`);
await expect(page.getByRole('heading', { level: 1, name: 'Terminal test - Default' })).toBeVisible();
const tab = page.getByRole('tab', { name: 'Terminal' });
const panel = page.getByRole('tabpanel', { name: 'Terminal' });
/* eslint-disable multiline-comment-style */
// TODO: Requires #245
// await expect(tab).not.toBeVisible();
// await expect(panel).not.toBeVisible();
// terminal toggle can take a while to hydrate on page load, click until responsive
await expect(async () => {
await page.getByRole('button', { name: 'Toggle Terminal' }).click();
await expect(tab).toBeVisible({ timeout: 100 });
await expect(panel).toBeVisible({ timeout: 100 });
}).toPass();
await expect(panel).toContainText('~/tutorial', { useInnerText: true });
});
test('user can see terminal open by default', async ({ page }) => {
await page.goto(`${BASE_URL}/open-by-default`);
await expect(page.getByRole('heading', { level: 1, name: 'Terminal test - Open by default' })).toBeVisible();
await expect(page.getByRole('tab', { name: 'Terminal', selected: true })).toBeVisible();
await expect(page.getByRole('tabpanel', { name: 'Terminal' })).toContainText('~/tutorial', { useInnerText: true });
});