Skip to content

Commit

Permalink
fix cypress - use "type to confirm"
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDarsa committed Jul 4, 2024
1 parent 5be55aa commit 4a2f4f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion cypress/support/actions/organizations/ProjectsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ export default class ProjectsActions {
});
}
doDeleteProject(projectName: string) {
projects.getDeleteBtn().eq(1).click();
projects.getDeleteBtn().first().click();

cy.get('.highlight')
.invoke('text')
.then(highlightText => {
projects.getDeleteConfirmInput().focus().type(highlightText);
});

projects.getDeleteConfirm().click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export default class ProjectsRepository {
return cy.getBySel('table-row');
}
getDeleteBtn() {
return cy.get("[aria-label='delete']");
return cy.getBySel('deleteProject');
}
getDeleteConfirmInput() {
return cy.getBySel('deleteProjectConfirm');
}
getDeleteConfirm() {
return cy.getBySel('deleteConfirm');
Expand Down
2 changes: 2 additions & 0 deletions src/components/Organizations/Projects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const OrgProjects = ({ projects = [], organizationId, organizationName, refresh,
<Tooltip overlayClassName="orgTooltip" title="Delete" placement="bottom">
<DeleteOutlined
className="delete"
data-cy="deleteProject"
onClick={() => {
setModalState({ open: true, current: project.name });
}}
Expand All @@ -122,6 +123,7 @@ const OrgProjects = ({ projects = [], organizationId, organizationName, refresh,

<RemoveModalConfirmInput
type="text"
data-cy="deleteProjectConfirm"
onChange={e => {
setModalState({ ...modalState, confirmValue: e.target.value });
}}
Expand Down

0 comments on commit 4a2f4f8

Please sign in to comment.