refactor tests to use data-testid
This commit is contained in:
parent
5c317ba477
commit
993e75b14f
6 changed files with 20 additions and 19 deletions
|
@ -71,43 +71,43 @@ describe("Realm roles test", function () {
|
|||
masthead.checkNotificationMessage("Role created");
|
||||
|
||||
// Add associated realm role
|
||||
cy.get("#roles-actions-dropdown").last().click();
|
||||
cy.get("[data-testid=action-dropdown]").last().click();
|
||||
|
||||
cy.get("#add-roles").click();
|
||||
cy.get("[data-testid=add-roles]").click();
|
||||
|
||||
cy.wait(100);
|
||||
|
||||
cy.get('[type="checkbox"]').eq(1).check();
|
||||
|
||||
cy.get("#add-associated-roles-button").contains("Add").click();
|
||||
cy.get("[data-testid=add-associated-roles-button]").contains("Add").click();
|
||||
|
||||
cy.url().should("include", "/AssociatedRoles");
|
||||
|
||||
cy.get("#composite-role-badge").should("contain.text", "Composite");
|
||||
cy.get("[data-testid=composite-role-badge]").should("contain.text", "Composite");
|
||||
|
||||
cy.wait(100);
|
||||
cy.wait(2500);
|
||||
|
||||
// Add associated client role
|
||||
|
||||
cy.get("[data-cy=add-role-button]").click();
|
||||
cy.get("[data-testid=add-role-button]").click();
|
||||
|
||||
cy.wait(100);
|
||||
|
||||
cy.get("[data-cy=filter-type-dropdown]").click();
|
||||
cy.get("[data-testid=filter-type-dropdown]").click();
|
||||
|
||||
cy.get("[data-cy=filter-type-dropdown-item]").click();
|
||||
cy.get("[data-testid=filter-type-dropdown-item]").click();
|
||||
|
||||
cy.wait(2500);
|
||||
|
||||
cy.get('[type="checkbox"]').eq(40).check({force: true});
|
||||
|
||||
cy.get("#add-associated-roles-button").contains("Add").click();
|
||||
cy.get("[data-testid=add-associated-roles-button]").contains("Add").click();
|
||||
|
||||
cy.wait(2500);
|
||||
|
||||
cy.contains("Users in role")
|
||||
.click()
|
||||
.get('[data-test-id="users-page"]')
|
||||
.get('[data-testid="users-page"]')
|
||||
.should('exist')
|
||||
});
|
||||
});
|
||||
|
|
|
@ -41,7 +41,6 @@ export const ViewHeader = ({
|
|||
actionsDropdownId,
|
||||
titleKey,
|
||||
badge,
|
||||
badgeId,
|
||||
badgeIsRead,
|
||||
subKey,
|
||||
subKeyLinkProps,
|
||||
|
@ -77,7 +76,10 @@ export const ViewHeader = ({
|
|||
</LevelItem>
|
||||
{badge && (
|
||||
<LevelItem>
|
||||
<Badge id={badgeId} isRead={badgeIsRead}>
|
||||
<Badge
|
||||
data-testid="composite-role-badge"
|
||||
isRead={badgeIsRead}
|
||||
>
|
||||
{badge}
|
||||
</Badge>
|
||||
</LevelItem>
|
||||
|
|
|
@ -177,7 +177,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
|
|||
actions={[
|
||||
<Button
|
||||
key="add"
|
||||
id="add-associated-roles-button"
|
||||
data-testid="add-associated-roles-button"
|
||||
variant="primary"
|
||||
isDisabled={!selectedRows?.length}
|
||||
onClick={() => {
|
||||
|
@ -206,7 +206,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
|
|||
searchTypeComponent={
|
||||
<Dropdown
|
||||
onSelect={() => onFilterDropdownSelect(filterType)}
|
||||
data-cy="filter-type-dropdown"
|
||||
data-testid="filter-type-dropdown"
|
||||
toggle={
|
||||
<DropdownToggle
|
||||
id="toggle-id-9"
|
||||
|
@ -220,7 +220,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
|
|||
isOpen={isFilterDropdownOpen}
|
||||
dropdownItems={[
|
||||
<DropdownItem
|
||||
data-cy="filter-type-dropdown-item"
|
||||
data-testid="filter-type-dropdown-item"
|
||||
key="filter-type"
|
||||
>
|
||||
{filterType == "roles"
|
||||
|
|
|
@ -203,7 +203,7 @@ export const AssociatedRolesTab = ({
|
|||
className="kc-add-role-button"
|
||||
key="add-role-button"
|
||||
onClick={() => toggleModal()}
|
||||
data-cy="add-role-button"
|
||||
data-testid="add-role-button"
|
||||
>
|
||||
{t("addRole")}
|
||||
</Button>
|
||||
|
|
|
@ -255,7 +255,6 @@ export const RealmRoleTabs = () => {
|
|||
<ViewHeader
|
||||
titleKey={role?.name || t("createRole")}
|
||||
badge={additionalRoles.length > 0 ? t("composite") : ""}
|
||||
badgeId="composite-role-badge"
|
||||
badgeIsRead={true}
|
||||
subKey={id ? "" : "roles:roleCreateExplain"}
|
||||
actionsDropdownId="roles-actions-dropdown"
|
||||
|
@ -288,7 +287,7 @@ export const RealmRoleTabs = () => {
|
|||
</DropdownItem>,
|
||||
<DropdownItem
|
||||
key="toggle-modal"
|
||||
id="add-roles"
|
||||
data-testid="add-roles"
|
||||
component="button"
|
||||
onClick={() => toggleModal()}
|
||||
>
|
||||
|
|
|
@ -32,7 +32,7 @@ export const UsersInRoleTab = () => {
|
|||
|
||||
return (
|
||||
<>
|
||||
<PageSection data-test-id="users-page" variant="light">
|
||||
<PageSection data-testid="users-page" variant="light">
|
||||
{users.length == 0 ? (
|
||||
<ListEmptyState
|
||||
hasIcon={true}
|
||||
|
|
Loading…
Reference in a new issue