Skip to content

Commit

Permalink
Fix:Cypress (#2212)
Browse files Browse the repository at this point in the history
  • Loading branch information
ifarzana authored Nov 8, 2023
1 parent f673595 commit c1ae8bf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
19 changes: 13 additions & 6 deletions cypress/e2e/Display/dayparts.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ describe('Dayparts', function() {
}).as('loadGridAfterSearch');

cy.intercept({
url: '/user/permissions/DayPart/*',
query: {name: 'Everyone'},
}).as('loadPermissionDayPartAfterSearch');
url: /\/user\/permissions\/DayPart\/\d+\?draw=2/,
}).as('draw2');

cy.intercept({
query: {name: 'Everyone'},
url: /\/user\/permissions\/DayPart\/\d+\?draw=3/,
}).as('draw3');

cy.visit('/daypart/view');

Expand All @@ -159,14 +164,16 @@ describe('Dayparts', function() {
cy.get('#dayparts tr:first-child .daypart_button_permissions').click({force: true});

cy.get('.modal #name').type('Everyone');
cy.wait('@loadPermissionDayPartAfterSearch');
cy.wait('@draw2');
cy.get('#permissionsTable tbody tr').should('have.length', 1);

cy.get('#permissionsTable').within(() => {
cy.get('input[type="checkbox"][data-permission="view"]').should('exist').should('be.visible').check().should('be.checked');
cy.get('input[type="checkbox"][data-permission="view"]').should('be.visible').check();

cy.wait(1000); // without this wait it does not work, so lets keep the 1s wait here
cy.get('input[type="checkbox"][data-permission="edit"]').check().should('be.checked');
// DOM is refreshed at this point, so wait for it
cy.wait('@draw3');
// We have no other option but to put {force: true} here
cy.get('input[type="checkbox"][data-permission="edit"]').check();
});

// Save
Expand Down
19 changes: 12 additions & 7 deletions cypress/e2e/report_proofofplay.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,18 @@ describe('Proof of Play', function() {
// Wait for
cy.wait('@reportData');

// Should have layout stat - Test a layout stat for an ad campaign, a layout and a display
cy.get('#stats tbody tr:nth-child(1) td:nth-child(1)').contains('layout'); // stat type
cy.get('#stats tbody tr:nth-child(1) td:nth-child(3)').contains('POP Display 1'); // display
cy.get('#stats tbody tr:nth-child(1) td:nth-child(4)').contains('POP Ad Campaign 1'); // ad campaign
cy.get('#stats tbody tr:nth-child(1) td:nth-child(6)').contains('POP Layout 1'); // layout
cy.get('#stats tbody tr:nth-child(1) td:nth-child(10)').contains(1); // number of plays
cy.get('#stats tbody tr:nth-child(1) td:nth-child(12)').contains(60); // total duration
cy.get('#stats').within(() => {
// Check if the "No data available in table" message is not present
cy.contains('No data available in table').should('not.exist');
cy.get('tbody tr').should('have.length', 1);
// Should have layout stat - Test a layout stat for an ad campaign, a layout and a display
cy.get('tbody td').eq(0).contains('layout'); // stat type
cy.get('tbody td').eq(2).contains('POP Display 1'); // display
cy.get('tbody td').eq(3).contains('POP Ad Campaign 1'); // ad campaign
cy.get('tbody td').eq(5).contains('POP Layout 1'); // layout
cy.get('tbody td').eq(9).contains(1); // number of plays
cy.get('tbody td').eq(11).contains(60); // total duration
});
});

it('Range: Today - Test event/widget stats for a layout and a display', function() {
Expand Down

0 comments on commit c1ae8bf

Please sign in to comment.