mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 13:01:56 +00:00
test(ui): update locators in tests to use role-based queries
- Refactored locators in BasePage, HomePage, SignInPage, and SignUpPage to utilize role-based queries for improved accessibility and consistency across the UI tests.
This commit is contained in:
@@ -18,7 +18,7 @@ export abstract class BasePage {
|
||||
// Common locators that most pages share
|
||||
this.title = page.locator("h1, h2, [role='heading']").first();
|
||||
this.loadingIndicator = page.getByRole("status", { name: "Loading" });
|
||||
this.themeToggle = page.getByLabel("Toggle theme");
|
||||
this.themeToggle = page.getByRole("button", { name: "Toggle theme" });
|
||||
}
|
||||
|
||||
// Common navigation methods
|
||||
|
||||
@@ -25,7 +25,7 @@ export class HomePage extends BasePage {
|
||||
|
||||
// Main content elements
|
||||
this.mainContent = page.locator("main");
|
||||
this.breadcrumbs = page.getByLabel("Breadcrumbs");
|
||||
this.breadcrumbs = page.getByRole("navigation", { name: "Breadcrumbs" });
|
||||
this.overviewHeading = page.getByRole("heading", { name: "Overview", exact: true });
|
||||
|
||||
// Navigation elements
|
||||
|
||||
@@ -45,8 +45,8 @@ export class SignInPage extends BasePage {
|
||||
this.homePage = new HomePage(page);
|
||||
|
||||
// Form elements
|
||||
this.emailInput = page.getByLabel("Email");
|
||||
this.passwordInput = page.getByLabel("Password");
|
||||
this.emailInput = page.getByRole("textbox", { name: "Email" });
|
||||
this.passwordInput = page.getByRole("textbox", { name: "Password" });
|
||||
this.loginButton = page.getByRole("button", { name: "Log in" });
|
||||
this.form = page.locator("form");
|
||||
|
||||
@@ -67,7 +67,7 @@ export class SignInPage extends BasePage {
|
||||
|
||||
// SAML specific elements
|
||||
this.samlModeTitle = page.getByRole("heading", { name: "Sign in with SAML SSO" });
|
||||
this.samlEmailInput = page.getByLabel("Email");
|
||||
this.samlEmailInput = page.getByRole("textbox", { name: "Email" });
|
||||
}
|
||||
|
||||
// Navigation methods
|
||||
|
||||
@@ -32,7 +32,7 @@ export class SignUpPage extends BasePage {
|
||||
// Prefer stable name attributes to avoid label ambiguity in composed inputs
|
||||
this.nameInput = page.locator('input[name="name"]');
|
||||
this.companyInput = page.locator('input[name="company"]');
|
||||
this.emailInput = page.getByLabel("Email");
|
||||
this.emailInput = page.getByRole("textbox", { name: "Email" });
|
||||
this.passwordInput = page.locator('input[name="password"]');
|
||||
this.confirmPasswordInput = page.locator('input[name="confirmPassword"]');
|
||||
this.invitationTokenInput = page.locator('input[name="invitationToken"]');
|
||||
|
||||
Reference in New Issue
Block a user