|
1 |
| -/// <reference types="jest-playwright-preset" /> |
| 1 | +import { test, expect } from "@playwright/test" |
2 | 2 | import { CODE_SERVER_ADDRESS, STORAGE } from "../utils/constants"
|
3 | 3 |
|
4 |
| -describe("Open Help > About", () => { |
5 |
| - beforeEach(async () => { |
6 |
| - // Create a new context with the saved storage state |
7 |
| - // so we don't have to logged in |
| 4 | +test.describe("Open Help > About", () => { |
| 5 | + // Create a new context with the saved storage state |
| 6 | + // so we don't have to logged in |
| 7 | + const options: any = {} |
| 8 | + // TODO@jsjoeio |
| 9 | + // Fix this once https://github.com/microsoft/playwright-test/issues/240 |
| 10 | + // is fixed |
| 11 | + if (STORAGE) { |
8 | 12 | const storageState = JSON.parse(STORAGE) || {}
|
9 |
| - await jestPlaywright.resetContext({ |
| 13 | + options.contextOptions = { |
10 | 14 | storageState,
|
11 |
| - }) |
12 |
| - await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" }) |
13 |
| - }) |
| 15 | + } |
| 16 | + } |
14 | 17 |
|
15 |
| - it("should see a 'Help' then 'About' button in the Application Menu that opens a dialog", async () => { |
16 |
| - // Make sure the editor actually loaded |
17 |
| - expect(await page.isVisible("div.monaco-workbench")) |
| 18 | + test( |
| 19 | + "should see a 'Help' then 'About' button in the Application Menu that opens a dialog", |
| 20 | + options, |
| 21 | + async ({ page }) => { |
| 22 | + await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" }) |
| 23 | + // Make sure the editor actually loaded |
| 24 | + expect(await page.isVisible("div.monaco-workbench")) |
18 | 25 |
|
19 |
| - // Click the Application menu |
20 |
| - await page.click("[aria-label='Application Menu']") |
21 |
| - // See the Help button |
22 |
| - const helpButton = "a.action-menu-item span[aria-label='Help']" |
23 |
| - expect(await page.isVisible(helpButton)) |
| 26 | + // Click the Application menu |
| 27 | + await page.click("[aria-label='Application Menu']") |
| 28 | + // See the Help button |
| 29 | + const helpButton = "a.action-menu-item span[aria-label='Help']" |
| 30 | + expect(await page.isVisible(helpButton)) |
24 | 31 |
|
25 |
| - // Hover the helpButton |
26 |
| - await page.hover(helpButton) |
| 32 | + // Hover the helpButton |
| 33 | + await page.hover(helpButton) |
27 | 34 |
|
28 |
| - // see the About button and click it |
29 |
| - const aboutButton = "a.action-menu-item span[aria-label='About']" |
30 |
| - expect(await page.isVisible(aboutButton)) |
31 |
| - // NOTE: it won't work unless you hover it first |
32 |
| - await page.hover(aboutButton) |
33 |
| - await page.click(aboutButton) |
| 35 | + // see the About button and click it |
| 36 | + const aboutButton = "a.action-menu-item span[aria-label='About']" |
| 37 | + expect(await page.isVisible(aboutButton)) |
| 38 | + // NOTE: it won't work unless you hover it first |
| 39 | + await page.hover(aboutButton) |
| 40 | + await page.click(aboutButton) |
34 | 41 |
|
35 |
| - const codeServerText = "text=code-server" |
36 |
| - expect(await page.isVisible(codeServerText)) |
37 |
| - }) |
| 42 | + const codeServerText = "text=code-server" |
| 43 | + expect(await page.isVisible(codeServerText)) |
| 44 | + }, |
| 45 | + ) |
38 | 46 | })
|
0 commit comments