mirror of
https://github.com/goauthentik/authentik
synced 2026-05-11 01:22:25 +02:00
* web: Fix numeric values in search select inputs. * web: Fix ARIA attributes on menu items. * web: Fix issues surrounding nested modal actions, selectors, labels. * web: Prepare group forms for testing, ARIA, etc. * web: Clarify when spinner buttons are busy. * web: Fix dark theme toggle input visibility. * web: Fix issue where tests complete before optional search inputs load. * web: Add user creation tests, group creation. Flesh out fixtures.
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { PageFixture } from "#e2e/fixtures/PageFixture";
|
|
import type { LocatorContext } from "#e2e/selectors/types";
|
|
|
|
import { Page } from "@playwright/test";
|
|
|
|
export type GetByRoleParameters = Parameters<Page["getByRole"]>;
|
|
export type ARIARole = GetByRoleParameters[0];
|
|
export type ARIAOptions = GetByRoleParameters[1];
|
|
|
|
export type ClickByName = (name: string) => Promise<void>;
|
|
export type ClickByRole = (
|
|
role: ARIARole,
|
|
options?: ARIAOptions,
|
|
context?: LocatorContext,
|
|
) => Promise<void>;
|
|
|
|
export class PointerFixture extends PageFixture {
|
|
public static fixtureName = "Pointer";
|
|
|
|
/**
|
|
* A high-level click function that simplifies clicking on buttons and links.
|
|
*/
|
|
public click = (
|
|
name: string | RegExp,
|
|
optionsOrRole?: ARIAOptions | ARIARole,
|
|
context: LocatorContext = this.page,
|
|
): Promise<void> => {
|
|
if (typeof optionsOrRole === "string") {
|
|
return context.getByRole(optionsOrRole, { name }).first().click();
|
|
}
|
|
|
|
const options = {
|
|
exact: typeof name === "string",
|
|
...optionsOrRole,
|
|
name,
|
|
};
|
|
|
|
return (
|
|
context
|
|
// ---
|
|
.getByRole("button", options)
|
|
.or(context.getByRole("link", options))
|
|
.click()
|
|
);
|
|
};
|
|
}
|