Skip to content

Commit c9fa931

Browse files
committed
fix: add retry 2 for failing e2e tests
1 parent 92b7c1e commit c9fa931

File tree

3 files changed

+37
-31
lines changed

3 files changed

+37
-31
lines changed

ci/dev/test-e2e.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../.."
66
cd test
7-
# TODO@jsjoeio remove the test-match
8-
PASSWORD=e45432jklfdsab CODE_SERVER_ADDRESS=http://localhost:8080 yarn folio --config=config.ts --test-match login.test.ts --reporter=list
7+
PASSWORD=e45432jklfdsab CODE_SERVER_ADDRESS=http://localhost:8080 yarn folio --config=config.ts --reporter=list
98
}
109

1110
main "$@"

test/config.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ globalSetup(async () => {
5151
const config: Config = {
5252
testDir: path.join(__dirname, "e2e"), // Search for tests in this directory.
5353
timeout: 30000, // Each test is given 30 seconds.
54-
}
55-
56-
if (process.env.CI) {
57-
config.retries = 2 // Retry failing tests 2 times
54+
retries: 2, // Retry failing tests 2 times
5855
}
5956

6057
setConfig(config)

test/e2e/openHelpAbout.test.ts

+35-25
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,45 @@ import { test, expect } from "@playwright/test"
22
import { CODE_SERVER_ADDRESS, STORAGE } from "../utils/constants"
33

44
test.describe("Open Help > About", () => {
5-
test.beforeEach(async ({ page }) => {
6-
// Create a new context with the saved storage state
7-
// so we don't have to logged in
8-
// TODO@jsjoeio reset context and use storageState
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) {
912
const storageState = JSON.parse(STORAGE) || {}
10-
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
11-
})
13+
options.contextOptions = {
14+
storageState,
15+
}
16+
}
1217

13-
test("should see a 'Help' then 'About' button in the Application Menu that opens a dialog", async ({ page }) => {
14-
// Make sure the editor actually loaded
15-
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"))
1625

17-
// Click the Application menu
18-
await page.click("[aria-label='Application Menu']")
19-
// See the Help button
20-
const helpButton = "a.action-menu-item span[aria-label='Help']"
21-
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))
2231

23-
// Hover the helpButton
24-
await page.hover(helpButton)
32+
// Hover the helpButton
33+
await page.hover(helpButton)
2534

26-
// see the About button and click it
27-
const aboutButton = "a.action-menu-item span[aria-label='About']"
28-
expect(await page.isVisible(aboutButton))
29-
// NOTE: it won't work unless you hover it first
30-
await page.hover(aboutButton)
31-
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)
3241

33-
const codeServerText = "text=code-server"
34-
expect(await page.isVisible(codeServerText))
35-
})
42+
const codeServerText = "text=code-server"
43+
expect(await page.isVisible(codeServerText))
44+
},
45+
)
3646
})

0 commit comments

Comments
 (0)