Skip to content

Commit 7e34a0c

Browse files
committed
chore: fix Example 19 flaky E2E test
1 parent 1ad137e commit 7e34a0c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/demo/src/examples/slickgrid/example19.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ export class Example19 {
220220
const itemDetail = item;
221221

222222
// let's add some extra properties to our item for a better async simulation
223-
itemDetail.assignee = randomNames[this.randomNumber(0, 10)];
224-
itemDetail.reporter = randomNames[this.randomNumber(0, 10)];
223+
itemDetail.assignee = randomNames[this.randomNumber(0, 9)];
224+
itemDetail.reporter = randomNames[this.randomNumber(0, 9)];
225225

226226
// resolve the data after delay specified
227227
resolve(itemDetail);

test/cypress/e2e/example19.cy.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ describe('Example 19 - Row Detail View', () => {
4747
const alertStub = cy.stub();
4848
cy.on('window:alert', alertStub);
4949

50-
cy.get('#grid19')
51-
.find('.slick-cell + .dynamic-cell-detail .innerDetailView_2 .container_2')
52-
.as('detailContainer');
50+
cy.get('#grid19').find('.slick-cell + .dynamic-cell-detail .innerDetailView_2 .container_2').as('detailContainer');
5351

5452
cy.get('@detailContainer')
5553
.find('input')
5654
.invoke('val')
57-
.then(text => assignee = text as string);
55+
.then((text) => (assignee = `${text || ''}`));
56+
57+
cy.wait(10);
5858

5959
cy.get('@detailContainer')
6060
.find('[data-test=assignee-btn]')
6161
.click()
6262
.then(() => {
63-
if (assignee === '') {
64-
expect(alertStub.getCall(0)).to.be.calledWith(`No one is assigned to this task.`);
63+
if (!assignee) {
64+
expect(alertStub.getCall(0)).to.be.calledWith('No one is assigned to this task.');
6565
} else {
6666
expect(alertStub.getCall(0)).to.be.calledWith(`Assignee on this task is: ${assignee.toUpperCase()}`);
6767
}

0 commit comments

Comments
 (0)