Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed flakey test with comparing titles #1508

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,11 @@ export class SpecialErrorPage {
}

/**
*
* @param {string} pageTitle
*/
async showsPageTitle(pageTitle) {
const { page } = this;

const title = await page.locator('title').textContent();
expect(title).toBe(pageTitle);
await page.waitForFunction((title) => document.title === title, pageTitle, { timeout: 2000 });
}

async showsExpiredPageInPolish() {
Expand Down Expand Up @@ -259,8 +256,7 @@ export class SpecialErrorPage {
async showsPhishingPage() {
const { page } = this;

const title = await page.locator('title').textContent();
expect(title).toBe('Warning: Security Risk');
await this.showsPageTitle('Warning: Security Risk');

await expect(page.getByText('Warning: This site may be a security risk', { exact: true })).toBeVisible();
await expect(
Expand All @@ -281,8 +277,7 @@ export class SpecialErrorPage {
async showsMalwarePage() {
const { page } = this;

const title = await page.locator('title').textContent();
expect(title).toBe('Warning: Security Risk');
await this.showsPageTitle('Warning: Security Risk');

await expect(page.getByText('Warning: This site may be a security risk', { exact: true })).toBeVisible();
await expect(
Expand Down
Loading