Skip to content

Commit

Permalink
Merge pull request #463 from yeatmanlab/enh/bumping-pa
Browse files Browse the repository at this point in the history
PA Story Option Update
  • Loading branch information
richford authored Mar 28, 2024
2 parents 0530a61 + 2e5b541 commit b9115c8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 31 deletions.
14 changes: 5 additions & 9 deletions cypress/e2e/participant/default-tests/playPA.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ import { playPA } from '../../../support/helper-functions/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!',
endText1: 'Take a break if needed',
endText2: 'I have been swimming so much',
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.",
};
const breakBlockText = 'Take a break if needed';

describe('Testing playthrough of ROAR-Phoneme as a participant', () => {
it(`ROAR-Phoneme Playthrough Test`, () => {
Expand All @@ -23,13 +19,13 @@ describe('Testing playthrough of ROAR-Phoneme as a participant', () => {
// cy.get(".p-tabview").contains(pa.name);
cy.visit('/game/pa');

playPA(startText, endBlockText, breakBlockText);
playPA(startText, breakBlockText, endBlockText);

cy.visit('/');
cy.wait(0.2 * timeout);
cy.selectAdministration(Cypress.env('testRoarAppsAdministration'));
cy.get('.tabview-nav-link-label', { timeout: 3 * timeout })
.contains('ROAR - Phoneme')
.should('have.attr', 'data-game-status', 'complete');
.should('exist');
});
});
40 changes: 28 additions & 12 deletions cypress/support/helper-functions/roar-pa/paHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const playTrial = (targetText) => {
cy.get('body', { timeout: timeout })
.invoke('text')
.then((text) => {
cy.log('target', text, 'targetext', targetText);
// Check for re-route to dashboard from game and assume game complete
if (text.includes('Sign Out')) {
cy.log('Rerouted to dashboard from game; game complete.');
Expand Down Expand Up @@ -90,8 +91,6 @@ function playSecondTutorial() {
cy.wait(timeout);
cy.get('.continue', { timeout: 2 * timeout }).click();
cy.wait(2 * timeout);
cy.get('.continue', { timeout: 2 * timeout }).click();
cy.wait(timeout);
cy.get('img[src*="nut.webp"]', { timeout: timeout }).click();
cy.wait(2 * timeout);
cy.get('img[src*="wash.webp"]', { timeout: timeout }).click();
Expand All @@ -103,37 +102,54 @@ function playThirdTutorial() {
cy.wait(timeout);
cy.get('.continue', { timeout: 2 * timeout }).click();
cy.wait(2 * timeout);
cy.get('.continue', { timeout: 2 * timeout }).click();
cy.get('.continue', { timeout: 2 * timeout }).click();
cy.wait(2 * timeout);
cy.get('img[src*="/ball.webp"]', { timeout: timeout }).click();
cy.wait(2 * timeout);
cy.get('img[src*="/rain.webp"]', { timeout: timeout }).click();
cy.wait(2 * timeout);
cy.get('.continue').click();
}

export function playPA(startText, endText, breakText) {
export function playPA(startText, breakText, endText) {
playIntro(startText);

playFirstTutorial();
playTrial(breakText.breakText1);
// fsmBreak
cy.log('break 1');
cy.get('.continue', { timeout: 2 * timeout }).click();
playTrial(endText.endText1);
playTrial(breakText);

cy.get('.continue', { timeout: 2 * timeout }).click();
playSecondTutorial();
playTrial(breakText.breakText2);
playTrial(breakText);
// lsmBreak
cy.log('break 2');
cy.get('.continue', { timeout: 2 * timeout }).click();
playTrial(endText.endText2);

cy.get('.continue', { timeout: 2 * timeout }).click();
playThirdTutorial();
playTrial(breakText.breakText3);
// delBreak
cy.log('break 3');
cy.get('.continue', { timeout: 2 * timeout }).click();
playTrial(endText.endText3);
// playIntro(startText);

// playFirstTutorial();
// playTrial(breakText.breakText1);
// // fsmBreak
// cy.log('break 1');
// cy.get('.continue', { timeout: 2 * timeout }).click();
// playTrial(endText.endText1);

// playSecondTutorial();
// playTrial(breakText.breakText2);
// // lsmBreak
// cy.log('break 2');
// cy.get('.continue', { timeout: 2 * timeout }).click();
// playTrial(endText.endText2);

// playThirdTutorial();
// playTrial(breakText.breakText3);
// // delBreak
// cy.log('break 3');
// cy.get('.continue', { timeout: 2 * timeout }).click();
// playTrial(endText.endText3);
}
21 changes: 12 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@bdelab/roar-firekit": "^4.8.10",
"@bdelab/roar-letter": "^1.10.0",
"@bdelab/roar-multichoice": "^1.11.0",
"@bdelab/roar-pa": "^1.6.5",
"@bdelab/roar-pa": "^1.7.0",
"@bdelab/roar-sre": "^1.13.3",
"@bdelab/roar-swr": "^1.9.0",
"@bdelab/roar-utils": "^1.2.0",
Expand Down

0 comments on commit b9115c8

Please sign in to comment.