Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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 @@ -5,7 +5,7 @@ import { IAction, actionRecord } from '../../interfaces';
export class ClickRadioButtonAction implements IAction {
async execute(page: Page, action: string, params: string | actionRecord): Promise<void> {
if (typeof params === 'string') {
await page.getByRole('radio', { name: params }).check();
await page.getByRole('radio', { name: params, exact: true }).first().check();
return;
}
const { question, option, index } = params as actionRecord;
Expand Down
6 changes: 4 additions & 2 deletions src/test/ui/utils/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ async function validatePageIfNavigated(action: string): Promise<void> {
if (pageNavigated) {
if (startAxeAudit && enable_axe_audit === 'true') {
try {
await new AxeUtils(executor.page).audit({
exclude: axe_exclusions,
await test.step('Running Accessibility Scan', async () => {
await new AxeUtils(executor.page).audit({
exclude: axe_exclusions,
});
});
} catch (error) {
const errorMessage = String((error as Error).message || error).toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class ErrorMessageValidation implements IValidation {

// Check for error summary header
const headerLocator = page.locator(`h2.govuk-error-summary__title:has-text("${header}")`);
await headerLocator.waitFor({ state: 'visible', timeout: 5000 });
const headerCount = await headerLocator.count();

if (headerCount === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,29 @@ export class PageNavigationValidation implements IValidation {

const popup = await Promise.race([popupPromise, new Promise(resolve => setTimeout(() => resolve(null), 1000))]);

if (popup && (popup as Page).url() !== 'about:blank') {
newPage = popup as Page;
isNewWindow = true;
await newPage.waitForLoadState();
let newPopupPage: Page | null = null;

if (popup) {
try {
const testPage = popup as Page;

if (!testPage.isClosed() && testPage.url() !== 'about:blank') {
newPopupPage = testPage;
}
} catch {
console.log('Popup closed while checking url or the page is closed');
newPopupPage = null;
}
}

if (newPopupPage) {
try {
await newPopupPage.waitForLoadState();
newPage = newPopupPage;
isNewWindow = true;
} catch {
console.log('new window closed');
}
}
}

Expand Down
Loading