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

Fix Cypress Test Concurrency #570

Merged
merged 34 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2dd1e93
initial commit
ksmontville Apr 19, 2024
735d47a
rebase onto main
ksmontville Apr 19, 2024
775aa73
Add test retries function; more logging
ksmontville Apr 19, 2024
2fa26cc
rebase onto main
ksmontville Apr 30, 2024
112ed9f
add playFluency-CALF to test suite.
ksmontville Apr 30, 2024
27ab921
Reduce number of testing containers for pre-release tests
ksmontville Apr 30, 2024
cd64c97
update timeouts
ksmontville May 1, 2024
3c31c38
update list of games
ksmontville May 1, 2024
02aff3b
remove retry function
ksmontville May 1, 2024
83e8586
increase initial load timeout to 10 minutes to test load times
ksmontville May 9, 2024
9b81cf3
split deployment and cypress testing workflow into separate workflows
ksmontville May 13, 2024
0794dce
add env back into workflow files
ksmontville May 13, 2024
60b56e2
add isCurrentVersion Cypress task
ksmontville May 13, 2024
de84929
use github api to fetch package json for main branch, use reponse to …
ksmontville May 14, 2024
d5f5ebb
add isCurrentVersion check to each game spec
ksmontville May 14, 2024
a51fb9e
refactor isCurrentVersion function
ksmontville May 14, 2024
bdb75c8
prepend window object to atob function
ksmontville May 14, 2024
348e059
rename gitHub action for deploy preview, adjust workflow dependencies…
ksmontville May 14, 2024
d326647
change workflow_run dependency
ksmontville May 14, 2024
39ec96b
remove workflow dependencies from cypress tests
ksmontville May 14, 2024
8f5ed18
change concurrency groups in github workflows
ksmontville May 14, 2024
ae024cb
remove slice from utils.js, reduce game timeouts to one minute
ksmontville May 14, 2024
b1400c0
increase test timeout
ksmontville May 14, 2024
813c3e5
reduce number of test containers for participant tests
ksmontville May 14, 2024
66d0c2e
comment out vite favicon
lucasxsong May 14, 2024
794edc2
update import and add min-width attribute to videoplayer
lucasxsong May 14, 2024
608d52e
add cy.then() statement in SRE test to wait for test completion.
ksmontville May 15, 2024
b1d92b4
wrap isCurrentVersion and call .then() to wait for result
ksmontville May 15, 2024
b641322
wrap isCurrentVersion and call .then() to wait for result for all gam…
ksmontville May 15, 2024
c249b32
wrap isCurrentVersion and call .then() to wait for result for optiona…
ksmontville May 15, 2024
3553dea
increase SRE timeout
ksmontville May 15, 2024
a2b30bb
increase timeouts for letter, swr, vocab tests
ksmontville May 15, 2024
04def63
rebase onto main, rollback swr to test new cypress functionality
ksmontville May 15, 2024
e625fb9
update roar apps to their latest versions
ksmontville May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cypress-network-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cypress Network Tests
name: Cypress Pre-Release Tests
on:
workflow_run:
workflows: ['Deploy to Firebase Hosting (production)']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,22 @@
name: Firebase Deploy to Staging and Cypress e2e Tests
name: Run Cypress Participant Tests
on:
pull_request:
types: [opened, reopened, synchronize]

concurrency:
group: ci-preview-tests-${{ github.ref }}-1
group: ci-preview-tests-${{ github.ref }}-3
cancel-in-progress: true

jobs:
build-and-preview:
name: Deploy preview
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: 'vite build'
run: npm ci && npm run build
- name: Deploy to Firebase Hosting Channel
id: firebase-deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }}'
projectId: gse-roar-admin
target: staging
- run: echo ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}
outputs:
deployUrl: ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}

cypress-run:
name: Run Cypress Tests
needs: [build-and-preview]
name: Run Cypress Participant Tests
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
browser: [chromium, edge]
containers: [1, 2, 3, 4]
containers: [1, 2]
env:
NODE_OPTIONS: '--max_old_space_size=8192'
NODE_ENV: 'test'
Expand Down Expand Up @@ -69,5 +45,5 @@ jobs:
wait-on-timeout: 120
record: true
parallel: true
spec: 'cypress/e2e/participant/default-tests/**/*,cypress/e2e/partner-admin/default-tests/**/*'
spec: 'cypress/e2e/participant/default-tests/**/*'
ci-build-id: ${{ github.run_id }}-${{ matrix.browser }}
49 changes: 49 additions & 0 deletions .github/workflows/cypress-partner-admin-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run Cypress Partner Admin Tests
on:
pull_request:
types: [opened, reopened, synchronize]

concurrency:
group: ci-preview-tests-${{ github.ref }}-2
cancel-in-progress: true

jobs:
cypress-run:
name: Run Cypress Partner Admin Tests
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
browser: [chromium, edge]
containers: [1, 2]
env:
NODE_OPTIONS: '--max_old_space_size=8192'
NODE_ENV: 'test'
CYPRESS_BASE_URL: 'http://localhost:5173'
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: Tests for PR ${{ github.event.number }} "${{ github.event.pull_request.title }}" from commit "${{ github.event.pull_request.head.sha }}"
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
PARTNER_ADMIN_USERNAME: ${{ secrets.PARTNER_ADMIN_USERNAME }}
PARTNER_ADMIN_PASSWORD: ${{ secrets.PARTNER_ADMIN_PASSWORD }}
PARTNER_ADMIN_ID: ${{ secrets.PARTNER_ADMIN_ID }}
PARTICIPANT_USERNAME: ${{ secrets.PARTICIPANT_USERNAME}}
PARTICIPANT_PASSWORD: ${{ secrets.PARTICIPANT_PASSWORD }}
PARTICIPANT_EMAIL: ${{ secrets.PARTICIPANT_EMAIL }}
PARTICIPANT_EMAIL_PASSWORD: ${{ secrets.PARTICIPANT_EMAIL_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: ${{ matrix.browser }}
build: npm ci && npm run build
start: npm run dev
wait-on: ${{ env.CYPRESS_BASE_URL }}
wait-on-timeout: 120
record: true
parallel: true
spec: 'cypress/e2e/partner-admin/default-tests/**/*'
ci-build-id: ${{ github.run_id }}-${{ matrix.browser }}
32 changes: 32 additions & 0 deletions .github/workflows/firebase-hosting-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Deploy
on:
pull_request:
types: [opened, reopened, synchronize]

concurrency:
group: ci-preview-tests-${{ github.ref }}-1
cancel-in-progress: true

jobs:
build-and-preview:
name: Deploy Preview
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: 'vite build'
run: npm ci && npm run build
- name: Deploy to Firebase Hosting Channel
id: firebase-deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }}'
projectId: gse-roar-admin
target: staging
- run: echo ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}
outputs:
deployUrl: ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}
44 changes: 40 additions & 4 deletions .github/workflows/firebase-hosting-production.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,52 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting (production)
name: Deploy to Firebase Hosting (production) with Pre-Release Tests
'on':
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
jobs:
build_and_deploy:
name: Deploy
# pre-release-tests:
# name: Run Cypress Pre-Release Tests
# needs: [build-and-preview]
# runs-on: ubuntu-latest
# timeout-minutes: 180
# strategy:
# fail-fast: false
# matrix:
# browser: [chromium, edge]
# containers: [1, 2]
# env:
# NODE_ENV: 'test'
# CYPRESS_BASE_URL: 'http://localhost:5173'
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# COMMIT_INFO_MESSAGE: Pre release tests for ROAR Dashboard release ${{ github.event.release.tag_name }} "${{ github.event.release.name }}"
# COMMIT_INFO_SHA: ${{ github.event.release.release_id }}
# PARTICIPANT_USERNAME: ${{ secrets.PARTICIPANT_USERNAME}}
# PARTICIPANT_PASSWORD: ${{ secrets.PARTICIPANT_PASSWORD }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Cypress run
# uses: cypress-io/github-action@v6
# with:
# browser: ${{ matrix.browser }}
# build: npm ci && npm run build
# start: npm run dev
# wait-on: ${{ env.CYPRESS_BASE_URL }}
# wait-on-timeout: 120
# record: true
# parallel: true
# spec: 'cypress/e2e/pre-release-tests/**/*'
# ci-build-id: ${{ github.run_id }}-${{ matrix.browser }}

build-and-deploy:
name: Deploy to Firebase Production Hosting Channel
needs: [pre-release-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -37,7 +73,7 @@ jobs:
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
sourcemap: ./dist/assets/*.js.map
sourcemaps: ./dist/assets/*.js.map
version: ${{ github.ref }}

- name: Notify on failure
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
import { playFluency } from '../../../../support/helper-functions/roam-fluency/fluencyHelpers';
import { playFluencyARF } from '../../../../support/helper-functions/roam-fluency/fluencyHelpers';
import { isCurrentVersion } from '../../../../support/utils';

const timeout = Cypress.env('timeout');
const administration = Cypress.env('testSpanishRoarAppsAdministration');
const language = 'es';
const task = 'fluency-arf-es';
const endText = 'Has terminado.';

const app = '@bdelab/roam-fluency';

describe('Test playthrough of Fluency ARF ES as a participant', () => {
it('Fluency Playthrough Test', () => {
Cypress.on('uncaught:exception', () => {
return false;
cy.wrap(isCurrentVersion(app)).then((isCurrentVersion) => {
if (isCurrentVersion) {
cy.log(`Did not detect a new version of ${app}, skipping test.`);
} else {
cy.log(`Detected a new version of ${app}, running test.`);
playFluencyARF({
administration: administration,
language: language,
task: task,
endText: endText,
});
}
});

cy.login(Cypress.env('participantUsername'), Cypress.env('participantPassword'));
cy.visit('/');

cy.selectAdministration(administration);

cy.get('.p-tabview').contains('ROAM - Un Dígito');
cy.visit(`/game/fluency-arf-es`);

// Click jspsych button to begin
cy.get('.jspsych-btn', { timeout: 5 * timeout })
.should('be.visible')
.click();

playFluency(endText);

// Check if game is marked as complete on the dashboard
cy.visit('/');
cy.wait(0.2 * timeout);
cy.selectAdministration(administration);
cy.get('.tabview-nav-link-label').contains('ROAM - Un Dígito').should('exist');
});
});
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
import { playFluency } from '../../../../support/helper-functions/roam-fluency/fluencyHelpers';
import { playFluencyCALF } from '../../../../support/helper-functions/roam-fluency/fluencyHelpers';
import { isCurrentVersion } from '../../../../support/utils';

const timeout = Cypress.env('timeout');
const administration = Cypress.env('testSpanishRoarAppsAdministration');
const language = 'es';
const task = 'fluency-calf-es';
const endText = 'Has terminado.';
const continueText = 'continuar';

const app = '@bdelab/roam-fluency';

describe('Test playthrough of Fluency ARF ES as a participant', () => {
it('Fluency Playthrough Test', () => {
Cypress.on('uncaught:exception', () => {
return false;
cy.wrap(isCurrentVersion(app)).then((isCurrentVersion) => {
if (isCurrentVersion) {
cy.log(`Did not detect a new version of ${app}, skipping test.`);
} else {
cy.log(`Detected a new version of ${app}, running test.`);
playFluencyCALF({
administration: administration,
language: language,
task: task,
endText: endText,
continueText: continueText,
});
}
});

cy.login(Cypress.env('participantUsername'), Cypress.env('participantPassword'));
cy.visit('/');

cy.selectAdministration(administration);

cy.get('.p-tabview').contains('ROAM - Varios Dígitos');
cy.visit(`/game/fluency-calf-es`);

// Click jspsych button to begin
cy.get('.jspsych-btn', { timeout: 5 * timeout })
.should('be.visible')
.click();

playFluency(endText, continueText);

// Check if game is marked as complete on the dashboard
cy.visit('/');
cy.wait(0.2 * timeout);
cy.selectAdministration(administration);
cy.get('.tabview-nav-link-label').contains('ROAM - Varios Dígitos').should('exist');
});
});
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import { playLetter } from '../../../../support/helper-functions/roar-letter/letterHelpers';
import { isCurrentVersion } from '../../../../support/utils';

const administration = Cypress.env('testSpanishRoarAppsAdministration');
const language = 'es';
const gameCompleteText = '¡Has terminado! ¡Gracias por ayudarme a encontrar esas letras!';

const app = '@bdelab/roar-letter';

describe('ROAR - Letra Play Through', () => {
it('Plays Letra', () => {
playLetter(administration, language, gameCompleteText);
cy.wrap(isCurrentVersion(app)).then((isCurrentVersion) => {
if (isCurrentVersion) {
cy.log(`Did not detect a new version of ${app}, skipping test.`);
} else {
cy.log(`Detected a new version of ${app}, running test.`);
playLetter({
administration: administration,
language: language,
gameCompleteText: gameCompleteText,
});
}
});
});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { playSRE } from '../../../../support/helper-functions/roar-sre/sreHelpers';
import { isCurrentVersion } from '../../../../support/utils';

const administration = Cypress.env('testSpanishRoarAppsAdministration');
const language = 'es';

const app = '@bdelab/roar-sre';

describe('ROAR - Sentence Play Through', () => {
it('Plays SRE', () => {
playSRE(administration, language);
cy.wrap(isCurrentVersion(app)).then((isCurrentVersion) => {
if (isCurrentVersion) {
cy.log(`Did not detect a new version of ${app}, skipping test.`);
} else {
cy.log(`Detected a new version of ${app}, running test.`);
playSRE({
administration: administration,
language: language,
});
}
});
});
});
15 changes: 14 additions & 1 deletion cypress/e2e/participant/default-tests/es-tests/playWord-ES.cy.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { playSWR } from '../../../../support/helper-functions/roar-swr/swrHelpers.js';
import { isCurrentVersion } from '../../../../support/utils';

const administration = Cypress.env('testSpanishRoarAppsAdministration');
const language = 'es';

const app = '@bdelab/roar-swr';

describe('ROAR - Palabra Play Through', () => {
it('Plays Word', () => {
playSWR(administration, language);
cy.wrap(isCurrentVersion(app)).then((isCurrentVersion) => {
if (isCurrentVersion) {
cy.log(`Did not detect a new version of ${app}, skipping test.`);
} else {
cy.log(`Detected a new version of ${app}, running test.`);
playSWR({
administration: administration,
language: language,
});
}
});
});
});
Loading
Loading