Skip to content

Commit

Permalink
Merge branch 'ref/318/query-composables-merge' into ref/318/query-com…
Browse files Browse the repository at this point in the history
…posables-tasks
  • Loading branch information
maximilianoertel committed Oct 14, 2024
2 parents 8894846 + 089e95f commit 9c1d8ca
Show file tree
Hide file tree
Showing 17 changed files with 314 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .env.example.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ PARENT_EMAIL='your-parent-email'
PARENT_PASSWORD='your-parent-password'

# Firebase App Check Tokens
VITE_APPCHECK_DEBUG_TOKEN='your-firebase-app-check-debug-token'
VITE_APPCHECK_DEBUG_TOKEN='your-firebase-app-check-debug-token'
4 changes: 4 additions & 0 deletions .github/workflows/cypress-partner-admin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
PARTICIPANT_PASSWORD: ${{ secrets.PARTICIPANT_PASSWORD }}
PARTICIPANT_EMAIL: ${{ secrets.PARTICIPANT_EMAIL }}
PARTICIPANT_EMAIL_PASSWORD: ${{ secrets.PARTICIPANT_EMAIL_PASSWORD }}
PARENT_FIRST_NAME: ${{ secrets.PARENT_FIRST_NAME }}
PARENT_LAST_NAME: ${{ secrets.PARENT_LAST_NAME }}
PARENT_EMAIL: ${{ secrets.PARENT_EMAIL }}
PARENT_PASSWORD: ${{ secrets.PARENT_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_APPCHECK_DEBUG_TOKEN: ${{ secrets.VITE_APPCHECK_DEBUG_TOKEN }}
steps:
Expand Down
4 changes: 4 additions & 0 deletions cypress.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ module.exports = defineConfig({
testOptionalRoarAppsAdministrationId: 'Fuy4nQaMu6YmfNg1eBYH',
testSpanishRoarAppsAdministration: 'Cypress Test Spanish Roar Apps Administration',
testSpanishRoarAppsAdministrationId: '',
parentFirstName: process.env.PARENT_FIRST_NAME,
parentLastName: process.env.PARENT_LAST_NAME,
parentEmail: process.env.PARENT_EMAIL,
parentPassword: process.env.PARENT_PASSWORD,
// Generate a list of test users CypressTestStudent0, CypressTestStudent1, ..., CypressTestStudent50 and push the test_legal_doc user
testUserList: (() => {
const list = Array.from({ length: 51 }, (_, i) => `CypressTestStudent${i}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('The partner admin can select and export progress reports for a given a

cy.get('button').contains('Export Selected').click();
cy.readFile(
`${Cypress.env('cypressDownloads')}/roar-scores-partner-test-administration-cypress-test-district-selected.csv`,
`${Cypress.env('cypressDownloads')}/roar-scores-selected-partner-test-administration-cypress-test-district.csv`,
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const baseUrl = Cypress.env('baseUrl');
import { APP_ROUTES } from '../../../../src/constants/routes';

const orgs = [
{
tabName: 'Districts',
orgName: Cypress.env('testPartnerDistrictName'),
orgVerified: 'Districts - Cypress Test District',
},
];

function visitSignUpPage(activationCode) {
const registerUrl = `${baseUrl}/register/?code=${activationCode}`;
cy.visit(registerUrl);
}

function inputLoginValues() {
cy.get('input[name="firstName"]').type(Cypress.env('parentFirstName'));
cy.get('input[name="lastName"]').type(Cypress.env('parentLastName'));
cy.get('input[name="ParentEmail"]').type(Cypress.env('parentEmail'));
cy.get('input[type="password"]').first().type(Cypress.env('parentPassword'));
cy.get('input[type="password"]').eq(1).type(Cypress.env('parentPassword'));
}

function completeParentSignUp(org) {
cy.get('div.p-checkbox-box').click();
cy.get('button').contains('Continue').click();
cy.get('button').contains('Next').click();
cy.get('h2').should('contain.text', org.orgVerified);
}

describe('The partner admin user', () => {
beforeEach(() => {
cy.login(Cypress.env('partnerAdminUsername'), Cypress.env('partnerAdminPassword'));
cy.visit(APP_ROUTES.HOME);
cy.visit(APP_ROUTES.LIST_ORGS);
});

orgs.forEach((org) => {
context(`when navigating to the ${org.tabName} tab`, () => {
it(`should see the organization ${org.orgName} and should click on Invite Users`, () => {
cy.checkOrgExists(org);

// Locate the row with the orgName and click the "Invite Users" button specifically for that org
cy.contains('td', org.orgName)
.parents('tr')
.find('button')
.contains('Invite Users') // Ensure the button contains the text "Invite Users"
.click();

cy.log(`Invite Users button clicked for ${org.orgName}.`);

// Invoke the activation code input field to get the value
cy.get('[data-cy="input-text-activation-code"]')
.invoke('attr', 'value')
.then((value) => {
expect(value).to.not.be.empty;

// Visit the sign-up page with the activation code
visitSignUpPage(value);
inputLoginValues();
completeParentSignUp(org);
});
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
// language: 'es',
// },
// {
// name: 'Words and Pictures Game',
// name: 'ROAR - Syntax',
// app: 'core-tasks',
// spec: playSyntax,
// language: 'en',
Expand Down
23 changes: 23 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,29 @@ Cypress.Commands.add('playOptionalGame', (game, administration, optional) => {
});
});

/**
* Custom command to check if a partner district exists in the organization list.
*
* This command performs the following actions:
* 1. Locates and clicks on the 'Districts' option in a list.
* 2. Verifies if the partner district name (retrieved from Cypress environment variables) exists in a specific `div` element.
* 3. Logs a message confirming that the district exists.
*
* @param {number} [timeout=10000] - Optional timeout for each command, defaulting to 10 seconds.
*/
Cypress.Commands.add('checkOrgExists', (org, timeout = 10000) => {
// Click on the 'Districts' item in the list
cy.get('ul > li', { timeout }).contains(org.tabName, { timeout }).click();

// Verify the partner district name is present in the div
cy.get('div', { timeout }).should('contain.text', Cypress.env('testPartnerDistrictName'), {
timeout,
});

// Log the district name exists
cy.log(`${Cypress.env('testPartnerDistrictName')} exists.`);
});

/**
* Create a mock store for the user type specified.
* @param {string} userType - The type of user to create a mock store for. One of 'superAdmin', 'partnerAdmin', or 'participant'. Defaults to 'participant'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const languageOptions = {
en: {
syntax: {
gameTab: 'Words and Pictures Game',
gameTab: 'ROAR - Syntax',
url: '/game/core-tasks/trog',
},
},
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "roar-dashboard",
"private": true,
"version": "3.0.0",
"version": "3.0.1",
"type": "module",
"scripts": {
"build": "export VITE_FIREBASE_DATA_SOURCE=live && vite build",
Expand Down Expand Up @@ -43,7 +43,7 @@
"@bdelab/roav-crowding": "1.1.16",
"@bdelab/roav-mep": "^1.1.21",
"@bdelab/roav-ran": "^1.0.30",
"@levante-framework/core-tasks": "^1.0.0-beta.18",
"@levante-framework/core-tasks": "1.0.0-beta.16",
"@sentry/browser": "^8.0.0",
"@sentry/integrations": "^7.114.0",
"@sentry/vite-plugin": "^2.16.1",
Expand Down
2 changes: 1 addition & 1 deletion roar-firebase-functions
9 changes: 8 additions & 1 deletion src/components/ListOrgs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,16 @@
</PvInputGroup>
<p class="font-bold text-lg">Code:</p>
<PvInputGroup class="mt-3">
<PvInputText style="width: 70%" :value="activationCode" autocomplete="off" readonly />
<PvInputText
style="width: 70%"
:value="activationCode"
autocomplete="off"
data-cy="input-text-activation-code"
readonly
/>
<PvButton
class="bg-primary border-none p-2 text-white hover:bg-red-900"
data-cy="button-copy-invitation"
@click="copyToClipboard(activationCode)"
>
<i class="pi pi-copy p-2"></i>
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/RegisterStudent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<section v-else>
<h2 class="text-primary font-bold">You are registering for:</h2>
<div class="flex">
<h2 class="text-primary h-3 m-0 p-0" style="width: 70%">{{ student.orgName }}</h2>
<h2 class="text-primary h-3 m-0 p-0" style="width: 70%" data-cy="org-name">{{ student.orgName }}</h2>
<PvButton
class="bg-primary border-none border-round p-2 text-white hover:surface-300 hover:text-black-alpha-90"
label="Is this not right?"
Expand Down
1 change: 1 addition & 0 deletions src/constants/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export const APP_ROUTES = {
SCORE_REPORT: '/scores/:administrationId/:orgType/:orgId',
STUDENT_REPORT: '/scores/:administrationId/:orgType/:orgId/user/:userId',
ACCOUNT_PROFILE: '/profile',
LIST_ORGS: '/list-orgs',
};
Loading

0 comments on commit 9c1d8ca

Please sign in to comment.