Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Individual Score Reports #371

Merged
merged 15 commits into from
Mar 7, 2024
Merged
43 changes: 43 additions & 0 deletions cypress/e2e/participant/playPA.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { playPA } from '../../support/helperFunctions/roar-pa/paHelpers';

const timeout = Cypress.env('timeout');
const startText = 'In this game we are going to look for words that BEGIN with the same sound.';
const endBlockText = {
endText1: "Let's go help my friends now!",
endText2: 'We have one last friend to help!',
endText3: 'You have helped me and all my friends!',
};
const breakBlockText = {
breakText1: "Great job! So many bananas! Let's get a few more!",
breakText2: 'Look at all those carrots!',
breakText3: "You are doing great! I am almost ready to go out and swim! Let's get a few more crabs.",
};

describe('Testing playthrough of ROAR-Phoneme as a participant', () => {
it(`ROAR-Phoneme Playthrough Test`, () => {
cy.login(Cypress.env('participantUsername'), Cypress.env('participantPassword'));
cy.visit('/');

cy.get('.p-dropdown-trigger', { timeout: 2 * timeout }).click();
cy.get('.p-dropdown-item', { timeout: 2 * timeout })
.contains(Cypress.env('testRoarAppsAdministration'))
.click();

// cy.get(".p-tabview").contains(pa.name);
cy.visit('/game/pa');

playPA(startText, endBlockText, breakBlockText);

cy.visit('/');
cy.get('.p-dropdown-trigger', { timeout: 2 * timeout })
.should('be.visible')
.click();
cy.get('.p-dropdown-item', { timeout: 2 * timeout })
.contains(Cypress.env('testRoarAppsAdministration'))
.should('exist')
.click();
cy.get('.tabview-nav-link-label', { timeout: 2 * timeout })
.contains('ROAR-Phoneme')
.should('have.attr', 'data-game-status', 'complete');
});
});
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
Loading
Loading