From 2f764bc05c78d70de46033e62c8d0f8200e93207 Mon Sep 17 00:00:00 2001 From: Lucas Song Date: Thu, 7 Mar 2024 13:28:04 -0800 Subject: [PATCH] update tes ts to exist from is.visible --- cypress/e2e/participant/playPA.cy.js | 2 +- .../default-tests/viewIndividualReport.cy.js | 49 +++++++++++++++++++ cypress/support/commands.js | 4 +- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 cypress/e2e/partner-admin/default-tests/viewIndividualReport.cy.js diff --git a/cypress/e2e/participant/playPA.cy.js b/cypress/e2e/participant/playPA.cy.js index d755ece82..edd9e5d3c 100644 --- a/cypress/e2e/participant/playPA.cy.js +++ b/cypress/e2e/participant/playPA.cy.js @@ -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') diff --git a/cypress/e2e/partner-admin/default-tests/viewIndividualReport.cy.js b/cypress/e2e/partner-admin/default-tests/viewIndividualReport.cy.js new file mode 100644 index 000000000..bd9aeeb70 --- /dev/null +++ b/cypress/e2e/partner-admin/default-tests/viewIndividualReport.cy.js @@ -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'); + }); +}); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 7fbb64314..54ddd1340 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -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(); });