Skip to content

Commit

Permalink
fix the test to use the typeahead properly
Browse files Browse the repository at this point in the history
Signed-off-by: gitdallas <[email protected]>
  • Loading branch information
gitdallas committed Jan 30, 2025
1 parent c2fbabf commit 06fdbc2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 11 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ class PermissionTable extends Contextual<HTMLElement> {
.click();
}

addGroupName(name: string) {
const userNameCell = permissions.getGroupTable().find().find('[data-label="Username"]');
userNameCell.findByRole('button', { name: 'Typeahead menu toggle'}).should('exist').click();
return userNameCell.children().first().type(`${name}{downarrow}{enter}`);
}

selectAdminOption() {
const permToggle = permissions.getGroupTable().find().find('[data-label="Permission"]').children().first();
permToggle.findSelectOption('Admin Edit the project and manage user access').click();
}

findSaveNewButton() {
return this.find().findByTestId(['save-new-button']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { loadDSPFixture } from '~/__tests__/cypress/cypress/utils/dataLoader';
import { createCleanProject } from '~/__tests__/cypress/cypress/utils/projectChecker';
import { deleteOpenShiftProject } from '~/__tests__/cypress/cypress/utils/oc_commands/project';

describe('Verify that users can provide admin project permissions to non-admin users', () => {
describe('Verify that users can provide admin project permissions to non-admin users/groups', () => {
let testData: DataScienceProjectData;
let projectName: string;

Expand Down Expand Up @@ -91,14 +91,8 @@ describe('Verify that users can provide admin project permissions to non-admin u

cy.step('Assign admin group Project Permissions');
permissions.findAddGroupButton().click();
permissions.getGroupTable().findAddInput().type(LDAP_CONTRIBUTOR_GROUP.USERNAME);
permissions
.getGroupTable()
.selectPermission(
LDAP_CONTRIBUTOR_GROUP.USERNAME,
'Admin Edit the project and manage user access',
);

permissions.getGroupTable().addGroupName(LDAP_CONTRIBUTOR_GROUP.USERNAME);
permissions.getGroupTable().selectAdminOption();
cy.step(
`Save the group and validate that ${LDAP_CONTRIBUTOR_GROUP.USERNAME} has been saved with admin permissions`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const RoleBindingPermissionsNameInput: React.FC<RoleBindingPermissionsNameInputP
}
return (
<TypeaheadSelect
dataTestId={`role-binding-name-select ${value}`}
isScrollable
selectOptions={selectOptions}
selected={value}
Expand Down

0 comments on commit 06fdbc2

Please sign in to comment.