Skip to content

Commit

Permalink
update tes
Browse files Browse the repository at this point in the history
ts to exist from is.visible
  • Loading branch information
lucasxsong committed Mar 7, 2024
1 parent b09dbf9 commit 2f764bc
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/participant/playPA.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Testing playthrough of ROAR-Phoneme as a participant', () => {
.click();
cy.get('.p-dropdown-item', { timeout: 2 * timeout })
.contains(Cypress.env('testRoarAppsAdministration'))
.should('be.visible')
.should('exist')
.click();
cy.get('.tabview-nav-link-label', { timeout: 2 * timeout })
.contains('ROAR-Phoneme')
Expand Down
49 changes: 49 additions & 0 deletions cypress/e2e/partner-admin/default-tests/viewIndividualReport.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const testDistrictId = Cypress.env('testDistrictId');
const testPartnerAdministrationName = Cypress.env('testPartnerAdministrationName');
const testPartnerAdministrationId = Cypress.env('testPartnerAdministrationId');
const testPartnerAdminUsername = Cypress.env('partnerAdminUsername');
const testPartnerAdminPassword = Cypress.env('partnerAdminPassword');
const timeout = Cypress.env('timeout');
const baseUrl = Cypress.env('baseUrl');
const testUserList = Cypress.env('testUserList');
const testAssignments = ['vocab', 'Multichoice'];

function checkUrl() {
cy.login(testPartnerAdminUsername, testPartnerAdminPassword);
cy.navigateTo('/');
cy.url({ timeout: timeout }).should('eq', `${baseUrl}/`);
}

function clickScoreButton() {
cy.get('button', { timeout: timeout }).contains('Scores').first().click();
cy.url({ timeout: timeout }).should(
'eq',
`${baseUrl}/scores/${testPartnerAdministrationId}/district/${testDistrictId}`,
);
}

function checkAssignmentColumns() {
cy.get('[data-cy="roar-data-table"] thead th').then(($header) => {
const tableHeaders = $header.map((index, elem) => Cypress.$(elem).text()).get();

testAssignments.forEach((assignment) => {
expect(tableHeaders).to.include(assignment);
});
});
}

describe('The partner admin can view score reports for a given administration.', () => {
it('Selects an administration and views its score report.', () => {
checkUrl();
cy.getAdministrationCard(testPartnerAdministrationName);
clickScoreButton();
cy.checkUserList(testUserList);
checkAssignmentColumns(testAssignments);
cy.get('button').contains('Report').click();
cy.wait(4000);
cy.get('div').contains('Individual Score Report');
cy.get('button').contains('Expand All Sections').click();
cy.get('button').contains('Export to PDF');
cy.get('div').contains('The ROAR assessements return 3 kinds of scores');
});
});
4 changes: 2 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ Cypress.Commands.add('activateAdminSidebar', () => {

Cypress.Commands.add('selectAdministration', (testAdministration) => {
cy.get('[data-cy="dropdown-select-administration"]', { timeout: 2 * Cypress.env('timeout') })
.should('be.visible')
.should('exist')
.click();
cy.get('.p-dropdown-item', { timeout: 2 * Cypress.env('timeout') })
.contains(testAdministration)
.should('be.visible')
.should('exist')
.click();
});

Expand Down

0 comments on commit 2f764bc

Please sign in to comment.