Skip to content

Commit

Permalink
Merge pull request #3050 from NationalSecurityAgency/t#1604/paging_cy…
Browse files Browse the repository at this point in the history
…press

#1604 - fixed paging on user archive table and added cypress test
  • Loading branch information
sudo-may authored Dec 18, 2024
2 parents bbf28c7 + 2ce4e54 commit 60ae95c
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions e2e-tests/cypress/e2e/users_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,81 @@ describe('Users Tests', () => {
cy.get('[data-cy="archivedUserTag"]').should('be.visible');
});


it('different page sizes archive users table', () => {

cy.intercept('/admin/projects/proj1/users?query=*').as('getUsers');
cy.intercept('GET', '/admin/projects/proj1/users/archive?*').as('getArchivedUsers');
cy.intercept('POST', '/admin/projects/proj1/users/archive').as('archivedUsers');

for (let i = 0; i < 12; i += 1) {
const charToAdd = String.fromCharCode(97 + i);
cy.request('POST', `/api/projects/proj1/skills/skill1`, {
userId: `user${charToAdd}@skills.org`,
timestamp: m.clone().add(i, 'day').format('x')
});
}

cy.visit('/administrator/projects/proj1/');
cy.clickNav('Users');
cy.get('[data-cy="skillsBTableTotalRows"]').should('have.text', '12')
cy.get('[data-pc-name="rowperpagedropdown"]').click().get('[data-pc-section="item"]').contains('15').click();

cy.get(`${tableSelector} [data-pc-name="headercheckbox"] [data-pc-section="input"]`).click();
cy.get('[data-cy="archiveUsersTableBtn"]').should('be.enabled');
cy.get('[data-cy="archiveUsersTableBtn"]').click()

cy.wait('@archivedUsers');
cy.get('[data-cy="archiveUsersTableBtn"]').should('be.disabled');

// navigate to back archived users
cy.get('[data-cy="userArchiveBtn"]').should('be.enabled');
cy.get('[data-cy="userArchiveBtn"]').click()
cy.wait('@getArchivedUsers')

const archivedUsersTableSelector = '[data-cy="userArchiveTable"]';

cy.get(`${archivedUsersTableSelector}`).contains('User').click();
cy.validateTable(archivedUsersTableSelector, [
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
], 5, true, 12);

cy.get('[data-pc-name="rowperpagedropdown"]').click().get('[data-pc-section="item"]').contains('10').click();
cy.validateTable(archivedUsersTableSelector, [
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
], 10, true, 12);

cy.get('[data-pc-name="rowperpagedropdown"]').click().get('[data-pc-section="item"]').contains('20').click();
cy.validateTable(archivedUsersTableSelector, [
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
[{ colIndex: 0, value: '[email protected]' }],
], 20, true, 12);
});


it('different page sizes', () => {
for (let i = 0; i < 12; i += 1) {
const charToAdd = String.fromCharCode(97 + i);
Expand Down

0 comments on commit 60ae95c

Please sign in to comment.