fix(E2E): Fix flaky Dashboard list delete test (#31933)
This commit is contained in:
parent
63843c5682
commit
79f21b09d2
|
|
@ -40,11 +40,25 @@ function openMenu() {
|
||||||
cy.get('[aria-label="more-vert"]').first().click();
|
cy.get('[aria-label="more-vert"]').first().click();
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmDelete() {
|
function confirmDelete(bulk = false) {
|
||||||
|
interceptDelete();
|
||||||
|
interceptBulkDelete();
|
||||||
|
|
||||||
// Wait for modal dialog to be present and visible
|
// Wait for modal dialog to be present and visible
|
||||||
cy.get('[role="dialog"][aria-modal="true"]').should('be.visible');
|
cy.get('[role="dialog"][aria-modal="true"]').should('be.visible');
|
||||||
cy.getBySel('delete-modal-input').should('be.visible').clear().type('DELETE');
|
cy.getBySel('delete-modal-input')
|
||||||
|
.should('be.visible')
|
||||||
|
.then($input => {
|
||||||
|
cy.wrap($input).clear();
|
||||||
|
cy.wrap($input).type('DELETE');
|
||||||
|
});
|
||||||
cy.getBySel('modal-confirm-button').should('be.visible').click();
|
cy.getBySel('modal-confirm-button').should('be.visible').click();
|
||||||
|
|
||||||
|
if (bulk) {
|
||||||
|
cy.wait('@bulkDelete');
|
||||||
|
} else {
|
||||||
|
cy.wait('@delete');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('Dashboards list', () => {
|
describe('Dashboards list', () => {
|
||||||
|
|
@ -159,7 +173,6 @@ describe('Dashboards list', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should bulk delete correctly', () => {
|
it('should bulk delete correctly', () => {
|
||||||
interceptBulkDelete();
|
|
||||||
toggleBulkSelect();
|
toggleBulkSelect();
|
||||||
|
|
||||||
// bulk deletes in card-view
|
// bulk deletes in card-view
|
||||||
|
|
@ -169,8 +182,7 @@ describe('Dashboards list', () => {
|
||||||
cy.getBySel('styled-card').eq(0).contains('1 - Sample dashboard').click();
|
cy.getBySel('styled-card').eq(0).contains('1 - Sample dashboard').click();
|
||||||
cy.getBySel('styled-card').eq(1).contains('2 - Sample dashboard').click();
|
cy.getBySel('styled-card').eq(1).contains('2 - Sample dashboard').click();
|
||||||
cy.getBySel('bulk-select-action').eq(0).contains('Delete').click();
|
cy.getBySel('bulk-select-action').eq(0).contains('Delete').click();
|
||||||
confirmDelete();
|
confirmDelete(true);
|
||||||
cy.wait('@bulkDelete');
|
|
||||||
cy.getBySel('styled-card')
|
cy.getBySel('styled-card')
|
||||||
.eq(0)
|
.eq(0)
|
||||||
.should('not.contain', '1 - Sample dashboard');
|
.should('not.contain', '1 - Sample dashboard');
|
||||||
|
|
@ -185,8 +197,7 @@ describe('Dashboards list', () => {
|
||||||
cy.get('[data-test="table-row"] input[type="checkbox"]').eq(0).click();
|
cy.get('[data-test="table-row"] input[type="checkbox"]').eq(0).click();
|
||||||
cy.get('[data-test="table-row"] input[type="checkbox"]').eq(1).click();
|
cy.get('[data-test="table-row"] input[type="checkbox"]').eq(1).click();
|
||||||
cy.getBySel('bulk-select-action').eq(0).contains('Delete').click();
|
cy.getBySel('bulk-select-action').eq(0).contains('Delete').click();
|
||||||
confirmDelete();
|
confirmDelete(true);
|
||||||
cy.wait('@bulkDelete');
|
|
||||||
cy.getBySel('table-row')
|
cy.getBySel('table-row')
|
||||||
.eq(0)
|
.eq(0)
|
||||||
.should('not.contain', '3 - Sample dashboard');
|
.should('not.contain', '3 - Sample dashboard');
|
||||||
|
|
@ -195,31 +206,36 @@ describe('Dashboards list', () => {
|
||||||
.should('not.contain', '4 - Sample dashboard');
|
.should('not.contain', '4 - Sample dashboard');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should delete correctly', () => {
|
it('should delete correctly in list mode', () => {
|
||||||
interceptDelete();
|
// deletes in list-view
|
||||||
|
setGridMode('list');
|
||||||
|
|
||||||
|
cy.getBySel('table-row')
|
||||||
|
.eq(0)
|
||||||
|
.contains('4 - Sample dashboard')
|
||||||
|
.should('exist');
|
||||||
|
cy.getBySel('dashboard-list-trash-icon').eq(0).click();
|
||||||
|
confirmDelete();
|
||||||
|
cy.getBySel('table-row')
|
||||||
|
.eq(0)
|
||||||
|
.should('not.contain', '4 - Sample dashboard');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete correctly in card mode', () => {
|
||||||
// deletes in card-view
|
// deletes in card-view
|
||||||
setGridMode('card');
|
setGridMode('card');
|
||||||
orderAlphabetical();
|
orderAlphabetical();
|
||||||
|
|
||||||
cy.getBySel('styled-card').eq(0).contains('1 - Sample dashboard');
|
cy.getBySel('styled-card')
|
||||||
|
.eq(0)
|
||||||
|
.contains('1 - Sample dashboard')
|
||||||
|
.should('exist');
|
||||||
openMenu();
|
openMenu();
|
||||||
cy.getBySel('dashboard-card-option-delete-button').click();
|
cy.getBySel('dashboard-card-option-delete-button').click();
|
||||||
confirmDelete();
|
confirmDelete();
|
||||||
cy.wait('@delete');
|
|
||||||
cy.getBySel('styled-card')
|
cy.getBySel('styled-card')
|
||||||
.eq(0)
|
.eq(0)
|
||||||
.should('not.contain', '1 - Sample dashboard');
|
.should('not.contain', '1 - Sample dashboard');
|
||||||
|
|
||||||
// deletes in list-view
|
|
||||||
setGridMode('list');
|
|
||||||
cy.getBySel('table-row').eq(0).contains('2 - Sample dashboard');
|
|
||||||
cy.getBySel('dashboard-list-trash-icon').eq(0).click();
|
|
||||||
confirmDelete();
|
|
||||||
cy.wait('@delete');
|
|
||||||
cy.getBySel('table-row')
|
|
||||||
.eq(0)
|
|
||||||
.should('not.contain', '2 - Sample dashboard');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit correctly', () => {
|
it('should edit correctly', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue