Skip to content

Commit

Permalink
fixing flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Mar 7, 2024
1 parent f2fd5e4 commit 276c9a7
Show file tree
Hide file tree
Showing 10 changed files with 47,236 additions and 61,413 deletions.
31,310 changes: 13,775 additions & 17,535 deletions dist/autofill-debug.js

Large diffs are not rendered by default.

23,005 changes: 9,837 additions & 13,168 deletions dist/autofill.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration-test/helpers/pages/emailAutofillPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function emailAutofillPage (page) {
}

async assertExtensionPixelsCaptured (expectedPixels) {
let [backgroundPage] = await page.context().backgroundPages()
let [backgroundPage] = page.context().backgroundPages()
const backgroundPagePixels = await backgroundPage.evaluateHandle(() => {
// eslint-disable-next-line no-undef
return globalThis.pixels
Expand Down
6 changes: 3 additions & 3 deletions integration-test/helpers/pages/loginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ export function loginPage (page, opts = {}) {
async selectFirstCredential (username) {
if (clickLabel) {
const label = page.locator('label[for="email"]')
await label.click()
await label.click({force: true})
} else {
const email = page.locator('#email')
await email.click()
await email.click({force: true})
}

if (!overlay) {
const button = await page.waitForSelector(`button:has-text("${username}")`)
await button.click()
await button.click({force: true})
}
}

Expand Down
5 changes: 5 additions & 0 deletions integration-test/helpers/test-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export function testContext (test) {
dataDir,
launchOptions
)

// don't allow tests to run until the background page is ready
if (context.backgroundPages().length === 0) {
await new Promise((resolve) => context.on('backgroundpage', resolve))
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion integration-test/tests/incontext-signup.extension.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test.describe('chrome extension', () => {
await emailPage.assertExtensionPixelsCaptured(['incontext_show', 'incontext_dismiss_persisted'])
})

test('should allow tooltip to be closed', async ({page}) => {
test('should allow tooltip to be closed @flaky', async ({page}) => {
forwardConsoleMessages(page)
await setupMockedDomain(page, 'https://example.com')

Expand Down
2 changes: 1 addition & 1 deletion integration-test/tests/login-form.macos.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ test.describe('Auto-fill a login form on macOS', () => {
})
test.describe('When availableInputTypes API is available', () => {
test.describe('and I have saved credentials', () => {
test('I should be able to use my saved credentials by clicking', async ({page}) => {
test('I should be able to use my saved credentials by clicking @flaky', async ({page}) => {
await forwardConsoleMessages(page)
const {personalAddress, password} = await mocks(page)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"tsc": "tsc",
"tsc:watch": "tsc --watch",
"verify:local": "npm run lint:fix && npm run tsc && npm run test:unit && npm run test:integration",
"serve": "http-server -c-1 --port 3210 integration-test"
"serve": "http-server -c-1 --port 3210 ./"
},
"license": "Apache-2.0",
"devDependencies": {
Expand Down
Loading

0 comments on commit 276c9a7

Please sign in to comment.