From 24f6f6992b8dcaa8e9b8bb5b45a4c4ca400a2490 Mon Sep 17 00:00:00 2001 From: "Ghislain B." Date: Fri, 20 Dec 2024 22:37:57 -0500 Subject: [PATCH] chore: fix Example 19 flaky E2E test (#1304) --- packages/demo/src/examples/slickgrid/example19.ts | 4 ++-- test/cypress/e2e/example19.cy.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/demo/src/examples/slickgrid/example19.ts b/packages/demo/src/examples/slickgrid/example19.ts index a34d7c444..18a677e79 100644 --- a/packages/demo/src/examples/slickgrid/example19.ts +++ b/packages/demo/src/examples/slickgrid/example19.ts @@ -220,8 +220,8 @@ export class Example19 { const itemDetail = item; // let's add some extra properties to our item for a better async simulation - itemDetail.assignee = randomNames[this.randomNumber(0, 10)]; - itemDetail.reporter = randomNames[this.randomNumber(0, 10)]; + itemDetail.assignee = randomNames[this.randomNumber(0, 9)]; + itemDetail.reporter = randomNames[this.randomNumber(0, 9)]; // resolve the data after delay specified resolve(itemDetail); diff --git a/test/cypress/e2e/example19.cy.ts b/test/cypress/e2e/example19.cy.ts index a5193b7a4..5194ee6e8 100644 --- a/test/cypress/e2e/example19.cy.ts +++ b/test/cypress/e2e/example19.cy.ts @@ -47,21 +47,21 @@ describe('Example 19 - Row Detail View', () => { const alertStub = cy.stub(); cy.on('window:alert', alertStub); - cy.get('#grid19') - .find('.slick-cell + .dynamic-cell-detail .innerDetailView_2 .container_2') - .as('detailContainer'); + cy.get('#grid19').find('.slick-cell + .dynamic-cell-detail .innerDetailView_2 .container_2').as('detailContainer'); cy.get('@detailContainer') .find('input') .invoke('val') - .then(text => assignee = text as string); + .then((text) => (assignee = `${text || ''}`)); + + cy.wait(10); cy.get('@detailContainer') .find('[data-test=assignee-btn]') .click() .then(() => { - if (assignee === '') { - expect(alertStub.getCall(0)).to.be.calledWith(`No one is assigned to this task.`); + if (!assignee) { + expect(alertStub.getCall(0)).to.be.calledWith('No one is assigned to this task.'); } else { expect(alertStub.getCall(0)).to.be.calledWith(`Assignee on this task is: ${assignee.toUpperCase()}`); }