Merged PR 2558: updated link on awaiting submission view allin welsh
updated link on awaiting submission view allin welsh Related work items: #24389
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { handleSearchResults } from "../../helpers/index";
|
||||
|
||||
test("Check for DNS applications", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.getByRole("button", { name: "Accept cookies" }).click();
|
||||
await page.getByRole("link", { name: "View all DNS applications" }).click();
|
||||
|
||||
async function handleSearchResults(page) {
|
||||
const results = page.locator("dd a.govuk-link--no-underline");
|
||||
|
||||
await Promise.race([
|
||||
results.first().waitFor({ state: "visible", timeout: 15000 }),
|
||||
]);
|
||||
|
||||
if ((await results.count()) > 0) {
|
||||
await results.first().click({ timeout: 15000 });
|
||||
await expect(page.locator("#main-content")).toContainText("Reference:", {
|
||||
timeout: 15000,
|
||||
});
|
||||
return "clicked";
|
||||
} else if ((await noResultsMessage.count()) > 0) {
|
||||
console.log("ℹ️ No results found. Test passes.");
|
||||
return "no-results";
|
||||
} else {
|
||||
throw new Error(
|
||||
"⚠️ Unexpected search page state: neither results nor zero-results message found."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle search results safely
|
||||
const outcome = await handleSearchResults(page);
|
||||
console.log(`Search outcome for DNS":`, outcome);
|
||||
});
|
||||
Reference in New Issue
Block a user