fix: add retry 2 for failing e2e tests

This commit is contained in:
Joe Previte 2021-04-14 12:01:17 -07:00
parent 92b7c1e9a8
commit c9fa931a0b
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
3 changed files with 37 additions and 31 deletions

View File

@ -4,8 +4,7 @@ set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
cd test
# TODO@jsjoeio remove the test-match
PASSWORD=e45432jklfdsab CODE_SERVER_ADDRESS=http://localhost:8080 yarn folio --config=config.ts --test-match login.test.ts --reporter=list
PASSWORD=e45432jklfdsab CODE_SERVER_ADDRESS=http://localhost:8080 yarn folio --config=config.ts --reporter=list
}
main "$@"

View File

@ -51,10 +51,7 @@ globalSetup(async () => {
const config: Config = {
testDir: path.join(__dirname, "e2e"), // Search for tests in this directory.
timeout: 30000, // Each test is given 30 seconds.
}
if (process.env.CI) {
config.retries = 2 // Retry failing tests 2 times
retries: 2, // Retry failing tests 2 times
}
setConfig(config)

View File

@ -2,15 +2,24 @@ import { test, expect } from "@playwright/test"
import { CODE_SERVER_ADDRESS, STORAGE } from "../utils/constants"
test.describe("Open Help > About", () => {
test.beforeEach(async ({ page }) => {
// Create a new context with the saved storage state
// so we don't have to logged in
// TODO@jsjoeio reset context and use storageState
const options: any = {}
// TODO@jsjoeio
// Fix this once https://github.com/microsoft/playwright-test/issues/240
// is fixed
if (STORAGE) {
const storageState = JSON.parse(STORAGE) || {}
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
})
options.contextOptions = {
storageState,
}
}
test("should see a 'Help' then 'About' button in the Application Menu that opens a dialog", async ({ page }) => {
test(
"should see a 'Help' then 'About' button in the Application Menu that opens a dialog",
options,
async ({ page }) => {
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
// Make sure the editor actually loaded
expect(await page.isVisible("div.monaco-workbench"))
@ -32,5 +41,6 @@ test.describe("Open Help > About", () => {
const codeServerText = "text=code-server"
expect(await page.isVisible(codeServerText))
})
},
)
})