Skip to content

Commit

Permalink
Merged to main
Browse files Browse the repository at this point in the history
  • Loading branch information
Emily-ejag committed Aug 19, 2024
2 parents 8fbcc8f + a39ff4c commit f62504d
Show file tree
Hide file tree
Showing 99 changed files with 3,122 additions and 12,030 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*]
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Auth Session Timeout (Optional)
# Control the session timeout limit and countdown duration before a user is signed out due to inactivity.
VITE_AUTH_SESSION_TIMEOUT_IDLE_THRESHOLD=900000 # 15 minutes in milliseconds
VITE_AUTH_SESSION_TIMEOUT_COUNTDOWN_DURATION=60000 # 1 minute in milliseconds
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Continuous Integration

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

permissions:
contents: read
pull-requests: write

jobs:
# ––––––––––––––––––––––––––––––––––––––––––––––– #
# Lint & Format
# ––––––––––––––––––––––––––––––––––––––––––––––– #
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Check format
run: npm run check-format

# ––––––––––––––––––––––––––––––––––––––––––––––– #
# Test
# ––––––––––––––––––––––––––––––––––––––––––––––– #
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install dependencies
run: npm ci

- name: Run unit tests
run: npm run test

- name: Report coverage
if: success()
uses: davelosert/vitest-coverage-report-action@v2

# ––––––––––––––––––––––––––––––––––––––––––––––– #
# Build the application
# ––––––––––––––––––––––––––––––––––––––––––––––– #
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
25 changes: 0 additions & 25 deletions .github/workflows/lint.yml

This file was deleted.

20 changes: 15 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,38 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Dependencies
node_modules

# Build Outputs
dist
dist-ssr
dev-dist
*.local

# Editor directories and files
.idea
/idea
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.firebase/
cypress/downloads

# Env
.env

# Test coverage
coverage

# Other
.vite/*
.firebase/
cypress/downloads

# Sentry Config File
.env.sentry-build-plugin
.env.sentry-build-plugin
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/iron
5 changes: 3 additions & 2 deletions cypress/e2e/participant/default-tests/checkLegalDoc.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ describe('Test to maintain that assent form shows in when signing in with an un-
// how can we write some logic to reset the already played
cy.login(test_login, test_pw);
cy.visit('/');
cy.get('.p-dialog-title', { timeout: timeout }).contains('CONSENT').should('be.visible');
cy.get('.p-confirm-dialog-accept').contains('Continue').should('be.visible');
cy.wait(1000);
cy.get('.p-dialog-title', { timeout: timeout }).contains('CONSENT FORM').should('be.visible');
cy.get('.p-dialog-footer').contains('Continue').should('be.visible');
});
});
2 changes: 1 addition & 1 deletion cypress/e2e/participant/default-tests/playVideo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Playing Video', () => {
cy.login(Cypress.env('participantUsername'), Cypress.env('participantPassword'));
cy.visit('/', { timeout: 2 * timeout });
cy.selectAdministration(Cypress.env('testRoarAppsAdministration'));
cy.get('.tabview-nav-link-label', { timeout: 2 * timeout })
cy.get('.p-tablist-tab-list', { timeout: 2 * timeout })
.contains('ROAR - Word')
.click();
cy.get('.vjs-big-play-button', { timeout: 2 * timeout }).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('The partner admin can select and export progress reports for a given a
cy.get('button').contains('Progress').first().click();

// make a selection
cy.get('.p-checkbox-box').first().click();
cy.get('input.p-checkbox-input').first().click();

cy.get('button').contains('Export Selected').click();
cy.readFile(`${Cypress.env('cypressDownloads')}/roar-progress-selected.csv`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('The partner admin can select and export progress reports for a given a
cy.get('button').contains('Score').first().click();

// make a selection
cy.get('.p-checkbox-box').first().click();
cy.get('input.p-checkbox-input').first().click();

cy.get('button').contains('Export Selected').click();
cy.readFile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const orgs = [
const listOrgsUrl = '/list-orgs';

function checkOrgExists(org) {
cy.get('ul > li', { timeout: timeout }).contains(org.tabName, { timeout: timeout }).click();
cy.get('.p-tablist-tab-list', { timeout: timeout }).contains(org.tabName, { timeout: timeout }).click();
cy.log('Tab ' + org.tabName + ' found.');

cy.get('div', { timeout: timeout }).should('contain.text', org.orgName, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ function setFilterByGrade(grade) {
}

function setFilterByProgressCategory(header, category) {
cy.contains('div.p-column-header-content', header).find('button').click();
cy.contains(
'th.p-datatable-header-cell.p-datatable-sortable-column.p-datatable-resizable-column.p-datatable-reorderable-column',
header,
)
.find('button')
.click();
cy.get('[data-cy="progress-filter-dropdown"]', { timeout: timeout }).click();
cy.get('ul>li').find('.p-tag-value', { timeout: timeout }).contains(category).click();
cy.get('ul>li').find('span.p-tag-label', { timeout: timeout }).contains(category).click();
// Click off the dropdown to prevent it from hiding other elements
cy.get('button').contains('Apply').click();
cy.wait(0.05 * timeout);
Expand Down Expand Up @@ -148,7 +153,7 @@ describe('The partner admin can view progress reports for a given administration
cy.getAdministrationCard(roarTestAdministrationName, 'descending');
clickProgressButton(roarTestAdministrationId);
setFilterByProgressCategory('ROAR - Written Vocab', 'started');
cy.get('.p-datatable-emptymessage').contains('No results found');
cy.get('.p-datatable-emptymessage').contains('Reset Filters');
cy.get('.flex.flex-column.align-items-center.align-text-left.my-8').contains('No results found');
cy.get('.flex.flex-column.align-items-center.align-text-left.my-8').contains('Reset Filters');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,25 @@ function setFilterByGrade(grade) {
}

function setFilterByProgressCategory(header, category) {
cy.contains('div.p-column-header-content', header).find('button').click();
cy.contains(
'th.p-datatable-header-cell.p-datatable-sortable-column.p-datatable-resizable-column.p-datatable-reorderable-column',
header,
)
.find('button')
.click();
cy.get('[data-cy="score-filter-dropdown"]', { timeout: timeout }).click();
cy.get('ul>li').find('.p-tag-value', { timeout: timeout }).contains(category).click();
cy.get('ul>li').find('span.p-tag-label', { timeout: timeout }).contains(category).click();
cy.get('button').contains('Apply').click();
cy.wait(0.05 * timeout);
}

function setFilterByScoreCategory(header, category) {
cy.contains('div.p-column-header-content', header).find('button').click();
cy.contains(
'th.p-datatable-header-cell.p-datatable-sortable-column.p-datatable-resizable-column.p-datatable-reorderable-column',
header,
)
.find('button')
.click();
cy.get('[data-cy="score-filter-dropdown"]', { timeout: timeout }).click();
cy.get('ul > li', { timeout: timeout }).contains(category).click();
cy.get('button').contains('Apply').click();
Expand Down Expand Up @@ -134,7 +144,7 @@ describe('The partner admin can view score reports for a given administration an
cy.getAdministrationCard(roarTestAdministrationName, 'descending');
clickScoreButton(roarTestAdministrationId);
setFilterByScoreCategory('ROAR - Written Vocab', 'Optional');
cy.get('.p-datatable-emptymessage').contains('No results found');
cy.get('.p-datatable-emptymessage').contains('Reset Filters');
cy.get('.flex.flex-column.align-items-center.align-text-left.my-8').contains('No results found');
cy.get('.flex.flex-column.align-items-center.align-text-left.my-8').contains('Reset Filters');
});
});
11 changes: 0 additions & 11 deletions cypress/e2e/partner-admin/default-tests/viewIndividualReport.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ function clickScoreButton() {
);
}

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

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

function checkIndividualScoreReport() {
cy.get('[data-cy="route-button"]', { timeout: 3 * timeout })
.first()
Expand All @@ -50,7 +40,6 @@ describe('The partner admin can view individual score reports for a given admini
cy.getAdministrationCard(testPartnerAdministrationName);
clickScoreButton();
cy.checkUserList(testUserList);
checkAssignmentColumns(testAssignments);
checkIndividualScoreReport();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ function clickProgressButton() {
}

function checkProgressTags(headers) {
cy.get('[data-cy="roar-data-table"] thead th').then(($header) => {
const tableHeaders = $header.map((index, elem) => Cypress.$(elem).text()).get();
cy.get('.p-datatable-column-header-content').then(($header) => {
const tableHeaders = Array.from($header).map((elem) => elem.innerText.trim());
cy.log('Table Headers:', tableHeaders);

headers.forEach((header) => {
const headerIndex = tableHeaders.indexOf(header);
Expand All @@ -38,6 +39,8 @@ function checkProgressTags(headers) {
cy.wrap(headerCell).find('span.p-tag.p-component').should('exist');
});
});
} else {
cy.log(`Header "${header}" not found in table headers.`);
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ function clickScoreButton() {
}

function checkAssignmentColumns() {
cy.get('[data-cy="roar-data-table"] thead th').then(($header) => {
const tableHeaders = $header.map((index, elem) => Cypress.$(elem).text()).get();
cy.get('.p-datatable-column-header-content').then(($header) => {
const tableHeaders = Array.from($header).map((header) => header.innerText);
cy.log('Table Headers:', tableHeaders);

testAssignments.forEach((assignment) => {
expect(tableHeaders).to.include(assignment);
expect(tableHeaders).to.include(assignment, `Expected header to include ${assignment}`);
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Cypress.Commands.add('selectAdministration', function selectAdministration(testA
cy.agreeToConsent(text);

if (text.includes(testAdministration)) {
cy.get('.p-dropdown-item', { timeout: 2 * Cypress.env('timeout') })
cy.get('.p-select-list-container', { timeout: 2 * Cypress.env('timeout') })
.contains(testAdministration)
.click();
cy.log('Selected administration:', testAdministration);
Expand Down Expand Up @@ -185,7 +185,7 @@ Cypress.Commands.add(
Cypress.Commands.add('checkUserList', (userList) => {
cy.get('[data-cy="roar-data-table"] tbody tr', { timeout: Cypress.env('timeout') }).each((row) => {
cy.wrap(row)
.find('td.p-frozen-column')
.find('td.p-datatable-frozen-column')
.then((cell) => {
// The following cleans the non-breaking space character and any whitespace from the cell text
const cellText = cell
Expand Down
Loading

0 comments on commit f62504d

Please sign in to comment.