Skip to content

Commit

Permalink
Enable accessible kebab
Browse files Browse the repository at this point in the history
Address e2e and component tests after moving to the latest PatternFly dropdown

Display tooltip for disabled menu toggle page action dropdown
  • Loading branch information
marshmalien committed Jul 17, 2024
1 parent f6cb4da commit f687729
Show file tree
Hide file tree
Showing 52 changed files with 493 additions and 416 deletions.
4 changes: 3 additions & 1 deletion cypress/e2e/awx/access/users.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ describe('Users Delete Actions', () => {

it('deletes a user from the users list row item', () => {
cy.navigateTo('awx', 'users');
cy.clickTableRowKebabAction(user.username, 'delete-user');
cy.clickTableRowAction('username', user.username, 'delete-user', {
inKebab: true,
});
cy.get('#confirm').click();
cy.clickButton(/^Delete user/);
cy.contains(/^Success$/);
Expand Down
10 changes: 8 additions & 2 deletions cypress/e2e/awx/administration/credentialTypes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ describe('Credential Types', () => {
});
cy.navigateTo('awx', 'credential-types');
cy.filterTableByMultiSelect('name', [editedCredentialTypeName]);
cy.clickTableRowKebabAction(`${editedCredentialTypeName}`, 'delete-credential-type', false);
cy.clickTableRowAction('name', editedCredentialTypeName, 'delete-credential-type', {
disableFilter: true,
inKebab: true,
});
cy.get('#confirm').click();
cy.intercept('DELETE', awxAPI`/credential_types/${credType1.id.toString()}/`).as(
'deleteCredType'
Expand Down Expand Up @@ -285,7 +288,10 @@ describe('Credential Types', () => {
it('can delete a credential type from the list row action', () => {
cy.navigateTo('awx', 'credential-types');
cy.filterTableByMultiSelect('name', [credType1.name]);
cy.clickTableRowKebabAction(credType1.name, 'delete-credential-type', false);
cy.clickTableRowAction('name', credType1.name, 'delete-credential-type', {
disableFilter: true,
inKebab: true,
});
cy.get('#confirm').click();
cy.clickButton(/^Delete credential type/);
cy.contains(/^Success$/);
Expand Down
14 changes: 10 additions & 4 deletions cypress/e2e/awx/administration/instanceGroups.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe(`Instance Groups`, () => {
cy.navigateTo('awx', 'instance-groups');
cy.verifyPageTitle('Instance Groups');
cy.clickButton(/^Create group$/);
cy.clickLink(`Create instance group`);
cy.clickButton(`Create instance group`);
cy.get('[data-cy="name"]').type(name);
cy.get('[data-cy="policy-instance-minimum"]').clear();
cy.get('[data-cy="policy-instance-minimum"]').type('1');
Expand Down Expand Up @@ -100,7 +100,10 @@ describe(`Instance Groups`, () => {
cy.navigateTo('awx', 'instance-groups');
cy.verifyPageTitle('Instance Groups');
cy.filterTableBySingleSelect('name', instanceGroup.name);
cy.clickTableRowKebabAction(instanceGroup.name, `edit-instance-group`, false);
cy.clickTableRowAction('name', instanceGroup.name, `edit-instance-group`, {
inKebab: false,
disableFilter: true,
});
cy.get('[data-cy="name"]').clear();
cy.get('[data-cy="name"]').type(`${instanceGroup.name}- edited`);
cy.get('[data-cy="policy-instance-minimum"]').clear();
Expand Down Expand Up @@ -237,7 +240,7 @@ describe(`Instance Groups`, () => {
cy.navigateTo('awx', 'instance-groups');
cy.verifyPageTitle('Instance Groups');
cy.clickButton(/^Create group$/);
cy.clickLink(`Create container group`);
cy.clickButton(/^Create container group$/);
cy.get('[data-cy="name"]').type(name);
cy.get('[data-cy="max-concurrent-jobs"]').clear();
cy.get('[data-cy="max-concurrent-jobs"]').type('3');
Expand Down Expand Up @@ -1008,7 +1011,10 @@ describe(`Instance Groups`, () => {
cy.clickTab(/^Jobs$/, true);
cy.filterTableBySingleSelect('name', job_template.name);
cy.intercept('DELETE', awxAPI`/jobs/*/`).as('deleted');
cy.clickTableRowKebabAction(job_template.name, 'delete-job', false);
cy.clickTableRowAction('name', job_template.name, 'delete-job', {
inKebab: true,
disableFilter: true,
});
cy.clickModalConfirmCheckbox();
cy.clickModalButton('Delete job');
cy.assertModalSuccess();
Expand Down
15 changes: 5 additions & 10 deletions cypress/e2e/awx/administration/wfApprovalsList.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('Workflow Approvals Tests', () => {
cy.getByDataCy('actions-column-cell').within(() => {
cy.clickKebabAction('actions-dropdown', 'delete-workflow-approval');
});

cy.actionsWFApprovalConfirmModal('delete');
cy.wait('@deleteWFA')
.its('response')
Expand Down Expand Up @@ -456,12 +457,9 @@ describe('Workflow Approvals Tests', () => {
cy.get('tbody').find('tr').should('have.length', 3);
cy.getByDataCy('select-all').click();
cy.getBy('[data-ouia-component-id="page-toolbar"]').within(() => {
cy.getByDataCy('actions-dropdown')
.click()
.then(() => {
cy.getByDataCy('delete').click();
});
cy.getByDataCy('actions-dropdown').click();
});
cy.getByDataCy('delete').click();
cy.getModal().within(() => {
cy.get('[data-ouia-component-id="confirm"]').click();
cy.get('[data-ouia-component-id="submit"]').click();
Expand Down Expand Up @@ -558,12 +556,9 @@ describe('Workflow Approvals Tests', () => {
cy.getByDataCy('checkbox-column-cell').click();
});
cy.get('[data-ouia-component-id="page-toolbar"]').within(() => {
cy.getByDataCy('actions-dropdown')
.click()
.then(() => {
cy.get('[data-cy="delete"]').click();
});
cy.getByDataCy('actions-dropdown').click();
});
cy.get('[data-cy="delete"]').click();
cy.getModal().within(() => {
cy.get('[data-cy="alert-toaster"]').should(
'contain',
Expand Down
5 changes: 4 additions & 1 deletion cypress/e2e/awx/resources/credentials.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ describe('Credentials', () => {
it('can delete machine credential from the list row action', () => {
cy.navigateTo('awx', 'credentials');
cy.filterTableByMultiSelect('name', [credential.name]);
cy.clickTableRowKebabAction(credential.name, 'delete-credential', false);
cy.clickTableRowAction('name', credential.name, 'delete-credential', {
disableFilter: true,
inKebab: true,
});
cy.get('#confirm').click();
cy.intercept('DELETE', awxAPI`/credentials/${credential.id.toString()}/`).as('deleted');
cy.clickButton(/^Delete credential/);
Expand Down
30 changes: 16 additions & 14 deletions cypress/e2e/awx/resources/executionEnvironments.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ describe('Execution Environments', () => {
cy.clickTab(/^Back to Execution Environments$/, true);
cy.verifyPageTitle('Execution Environments');
cy.filterTableBySingleSelect('name', execEnvName);
cy.clickTableRowKebabAction(execEnvName, 'delete-execution-environment', false);
cy.clickTableRowAction('name', execEnvName, 'delete-execution-environment', {
inKebab: true,
disableFilter: true,
});
cy.clickModalConfirmCheckbox();
cy.intercept('DELETE', awxAPI`/execution_environments/*/`).as('deleteEE');
cy.clickModalButton('Delete execution environments');
Expand Down Expand Up @@ -130,7 +133,10 @@ describe('Execution Environments', () => {
cy.verifyPageTitle(awxOrganization.name);
cy.clickTab(/^Execution Environments$/, true);
cy.filterTableBySingleSelect('name', execEnvName);
cy.clickTableRowKebabAction(execEnvName, 'delete-execution-environment', false);
cy.clickTableRowAction('name', execEnvName, 'delete-execution-environment', {
inKebab: true,
disableFilter: true,
});
cy.clickModalConfirmCheckbox();
cy.intercept('DELETE', awxAPI`/execution_environments/*/`).as('deleteEE');
cy.clickModalButton('Delete execution environments');
Expand Down Expand Up @@ -166,17 +172,10 @@ describe('Execution Environments', () => {
cy.hasDetail('Name', execEnvName);
cy.hasDetail('Image', image);
cy.hasDetail('Organization', awxOrganization.name);
cy.getByDataCy('actions-dropdown')
.click()
.then(() => {
cy.get('[data-cy="delete-execution-environment"]').should(
'have.attr',
'aria-disabled',
'true'
);
cy.logout();
cy.login();
});
cy.getByDataCy('actions-dropdown').click();
cy.get('#delete-execution-environment').should('have.attr', 'aria-disabled', 'true');
cy.logout();
cy.login();
});
});

Expand Down Expand Up @@ -363,7 +362,10 @@ describe('Execution Environments', () => {
cy.getByDataCy('image').should('contain', image);
cy.clickTab(/^Templates$/, true);
cy.filterTableBySingleSelect('name', jtName);
cy.clickTableRowKebabAction(jtName, 'delete-template', false);
cy.clickTableRowAction('name', jtName, 'delete-template', {
inKebab: true,
disableFilter: true,
});
cy.clickModalConfirmCheckbox();
cy.intercept('DELETE', awxAPI`/job_templates/*/`).as('deleteJT');
cy.clickModalButton('Delete template');
Expand Down
12 changes: 9 additions & 3 deletions cypress/e2e/awx/resources/inventories.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Inventories Tests', () => {
const inventoryName = 'E2E Inventory ' + randomString(4);
cy.navigateTo('awx', 'inventories');
cy.clickButton(/^Create inventory$/);
cy.clickLink(/^Create inventory$/);
cy.get('#create-inventory').click();
//Assert that user is on the form view to create an inventory
cy.get('[data-cy="name"]').type(inventoryName);
cy.singleSelectByDataCy('organization', organization.name);
Expand Down Expand Up @@ -122,15 +122,21 @@ describe('Inventories Tests', () => {
//Refactor this test to match the updated test case and improve the assertions
cy.navigateTo('awx', 'inventories'); //Add assertion to verify the user is on the inventories list view
cy.filterTableBySingleSelect('name', inventory.name);
cy.clickTableRowKebabAction(inventory.name, 'copy-inventory', false);
cy.clickTableRowAction('name', inventory.name, 'copy-inventory', {
disableFilter: true,
inKebab: true,
});
cy.hasAlert(`${inventory.name.toString()} copied`);
//Assert the presence of the original and the copy by performing a search on the list of inventories
});

it('can delete an inventory from the inventory list row item', () => {
cy.navigateTo('awx', 'inventories');
cy.filterTableBySingleSelect('name', inventory.name);
cy.clickTableRowKebabAction(inventory.name, 'delete-inventory', false);
cy.clickTableRowAction('name', inventory.name, 'delete-inventory', {
disableFilter: true,
inKebab: true,
});
//Add assertion to show the presence of the expected inventory
cy.get('#confirm').click();
cy.clickButton(/^Delete inventory/);
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/awx/resources/inventoriesConstructed.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ describe('Constructed Inventories CRUD Tests', () => {
const verbosityValue = generateRandom(0, 2);

cy.navigateTo('awx', 'inventories');
cy.getByDataCy('create-inventory').click();
cy.get('.pf-v5-c-dropdown__menu').within(() => {
cy.get('[data-cy="create-constructed-inventory"]').click();
});
cy.clickButton(/^Create inventory$/);
cy.clickButton(/^Create constructed inventory$/);
cy.getByDataCy('name').type(constInvName);
cy.getByDataCy('description').type(`Description of "${constInvName}" typed by Cypress`);
cy.intercept({
Expand Down
7 changes: 5 additions & 2 deletions cypress/e2e/awx/resources/inventoryGroup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ describe('Inventory Groups', () => {
cy.getByDataCy('name-column-cell').should('contain', host.name);
cy.clickTab(/^Groups$/, true);
cy.filterTableByMultiSelect('name', [group.name]);
cy.clickTableRowKebabAction(group.name, 'edit-group', false);
cy.clickTableRowAction('name', group.name, 'edit-group', {
inKebab: false,
disableFilter: true,
});
cy.verifyPageTitle('Edit group');
cy.get('[data-cy="name-form-group"]').type('-changed');
cy.get('[data-cy="Submit"]').click();
Expand All @@ -118,7 +121,7 @@ describe('Inventory Groups', () => {
cy.clickTableRowLink('name', inventory.name, { disableFilter: true });
cy.verifyPageTitle(inventory.name);
cy.clickTab(/^Groups$/, true);
cy.clickKebabAction('actions-dropdown', 'run-command');
cy.clickButton(/^Run Command$/);
cy.selectDropdownOptionByResourceName('module-name', 'shell');
cy.getByDataCy('module-args-form-group').type('argument');
cy.selectDropdownOptionByResourceName('verbosity', '1 (Verbose)');
Expand Down
15 changes: 5 additions & 10 deletions cypress/e2e/awx/resources/jobTemplates.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ describe.skip('Job Templates Tests', function () {
});
cy.get('[data-ouia-component-type="PF5/ModalContent"]').within(() => {
cy.filterTableBySingleSelect('name', executionEnvironmentName);
cy.get('[data-ouia-component-id="simple-table"] tbody').within(() => {
cy.get('[data-cy="checkbox-column-cell"] input').click();
});
cy.selectTableRowByCheckbox('name', executionEnvironmentName, { disableFilter: true });
cy.clickButton(/^Confirm/);
});
cy.clickButton(/^Next/);
Expand Down Expand Up @@ -546,9 +544,9 @@ describe.skip('Job Templates Tests', function () {
cy.intercept('POST', awxAPI`/job_templates/${jobTemplate.id.toString()}/copy/`).as(
'copyTemplate'
);
cy.getByDataCy('actions-column-cell').within(() => {
cy.getByDataCy('actions-dropdown').click();
cy.getByDataCy('copy-template').click();
cy.clickTableRowAction('name', jobTemplate.name, 'copy-template', {
inKebab: true,
disableFilter: true,
});
cy.wait('@copyTemplate')
.its('response.body.name')
Expand Down Expand Up @@ -630,10 +628,7 @@ describe.skip('Job Templates Tests', function () {
it('can delete a job template from the list line item', function () {
cy.navigateTo('awx', 'templates');
cy.filterTableBySingleSelect('name', jobTemplate.name);
cy.getByDataCy('actions-column-cell').within(() => {
cy.getByDataCy('actions-dropdown').click();
cy.getByDataCy('delete-template').click();
});
cy.clickTableRowKebabAction(jobTemplate.name, 'delete-template');
cy.clickModalConfirmCheckbox();
cy.intercept('DELETE', awxAPI`/job_templates/${jobTemplate.id.toString()}/`).as('deleteJT');
cy.clickModalButton('Delete template');
Expand Down
5 changes: 4 additions & 1 deletion cypress/e2e/awx/resources/projects/project-details.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ describe('Projects', () => {

it('can delete a schedule from the schedules list row', () => {
cy.filterTableBySingleSelect('name', schedule.name);
cy.clickTableRowKebabAction(schedule.name, 'delete-schedule', false);
cy.clickTableRowAction('name', schedule.name, 'delete-schedule', {
disableFilter: true,
inKebab: true,
});
cy.getModal().then(() => {
cy.get('#confirm').click();
cy.intercept('DELETE', awxAPI`/schedules/${schedule.id.toString()}/`).as('deleted');
Expand Down
6 changes: 4 additions & 2 deletions cypress/e2e/awx/resources/sharedTemplateSurvey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ export class ReusableTemplateSurveyTestSuite {
cy.contains(question.question_name);
cy.contains(question.default);
cy.contains('text');
cy.getByDataCy('actions-dropdown').click();
cy.contains('Delete question').click();
});
cy.clickTableRowAction('name', question.question_name, 'delete-question', {
inKebab: true,
disableFilter: true,
});
cy.clickModalConfirmCheckbox();
cy.intercept(
Expand Down
10 changes: 4 additions & 6 deletions cypress/e2e/awx/views/jobs.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,18 @@ describe('Jobs', () => {
it('can render the toolbar and row actions', () => {
cy.navigateTo('awx', 'jobs');
cy.get('.pf-v5-c-toolbar__group button.toggle-kebab').click();
cy.get('.pf-v5-c-dropdown__menu').within(() => {
cy.contains(/^Delete jobs$/).should('exist');
cy.contains(/^Cancel jobs$/).should('exist');
});
cy.contains(/^Delete jobs$/).should('exist');
cy.contains(/^Cancel jobs$/).should('exist');
cy.filterTableByMultiSelect('id', [job.id ? job.id.toString() : '']);
const jobName = job.name ? job.name : '';
cy.contains('td', jobName)
.parent()
.within(() => {
// Relaunch job
cy.get('#relaunch-job').should('exist');
cy.get('.pf-v5-c-dropdown__toggle').click();
cy.contains('.pf-v5-c-dropdown__menu-item', /^Delete job$/).should('exist');
cy.getByDataCy('actions-dropdown').click();
});
cy.contains('#delete-job', /^Delete job$/).should('exist');
cy.clearAllFilters();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('EDA Decision Environment List', () => {
cy.setTableView('table');
cy.filterTableByTextFilter('name', edaDE.name, { disableFilterSelection: true });
cy.setTableView('card');
cy.clickListCardKebabAction(edaDE.id, edaDE.name, 'delete-decision-environment');
cy.clickListCardKebabAction(edaDE.id, 'delete-decision-environment');
cy.get('#confirm').click();
cy.clickButton(/^Delete decision environment/);
cy.contains(/^Success$/);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ describe('EDA rulebook activations- Create, Edit, Delete', () => {

it('can delete a single Rulebook Activation from the line item on the list view', () => {
cy.navigateTo('eda', 'rulebook-activations');
cy.edaRuleBookActivationCheckbox(edaRBA1.name).within(() => {
cy.clickPageAction('delete-rulebook-activation');
cy.clickTableRowAction('name', edaRBA1.name, 'delete-rulebook-activation', {
disableFilter: true,
inKebab: true,
});
cy.get('div[role="dialog"]').within(() => {
cy.get('.pf-v5-c-check__label').should(
Expand Down
7 changes: 2 additions & 5 deletions cypress/e2e/hub/execution-environments.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,9 @@ describe('Execution Environments', () => {
cy.get('tbody').find('tr').should('have.length', 1);
cy.get('tbody').within(() => {
cy.getByDataCy('container-repository-name-column-cell').should('contain', eeName);
cy.get('[data-cy="actions-dropdown"]')
.click()
.then(() => {
cy.get(`[data-cy="delete-execution-environment"]`).click();
});
cy.get('[data-cy="actions-dropdown"]').click();
});
cy.get(`[data-cy="delete-execution-environment"]`).click();
cy.get('[data-ouia-component-id="Permanently delete execution environments"]').within(
() => {
cy.get('[data-ouia-component-id="confirm"]').click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/hub/hub-roles.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('Hub roles', () => {
it('delete a role from the list row action', () => {
cy.createHubRole().then((createdRole: Role) => {
cy.navigateTo('hub', 'roles');
cy.clickTableRowKebabAction(createdRole.name, 'delete-role', true);
cy.clickTableRowAction('name', createdRole.name, 'delete-role', { inKebab: true });
cy.get('#confirm').click();
cy.clickButton(/^Delete role/);
cy.contains(/^Success$/);
Expand Down
Loading

0 comments on commit f687729

Please sign in to comment.