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

Force legal doc sign reset Aug 1st #761

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion cypress.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ module.exports = defineConfig({
testSpanishRoarAppsAdministration: 'Cypress Test Spanish Roar Apps Administration',
testSpanishRoarAppsAdministrationId: '',
// Generate a list of test users CypressTestStudent0, CypressTestStudent1, ..., CypressTestStudent50
testUserList: Array.from({ length: 51 }, (_, i) => `CypressTestStudent${i}`),
testUserList: (() => {
const list = Array.from({ length: 51 }, (_, i) => `CypressTestStudent${i}`);
list.push('test_legal_doc');
return list;
})(),
roarDemoDistrictName: 'Roar Demo District',
roarDemoDistrictId: 'dfyDUItJNf3wEoG6Mf8H',
roarDemoAdministrationName: 'ROAR demo administration',
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/participant/default-tests/checkLegalDoc.cy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export const timeout = Cypress.env('timeout');

// userId in gse-roar-admin: NZouDdq6ZwYNyFdCbnuclw2fLJ82
// userId in gse-roar-admin-dev: XAq5qOuXnNPHClK0xZXXhfGsWX22
// userId in gse-roar-admin-dev: O75V6IcVeiTwW8TRjXb76uydlwV2

describe('Test to maintain that assent form shows in when signing in with an un-assented user', () => {
it('passes', () => {
// this is a user that has an assignment of roarVocab -- how can we create a user that can
// ALWAYS play the game
let test_login = 'DO_NOT_ACCEPT_DOC';
let test_login = 'testlegaldoc@test.com';
let test_pw = 'passwordLEGAL';
// how can we write some logic to reset the already played
cy.login(test_login, test_pw);
Expand Down
17 changes: 14 additions & 3 deletions src/pages/HomeParticipant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async function checkConsent() {

if (!legal?.consent) {
// Always show consent form for this test student when running Cypress tests
if (userData.value?.id === 'XAq5qOuXnNPHClK0xZXXhfGsWX22') {
if (userData.value?.id === 'O75V6IcVeiTwW8TRjXb76uydlwV2') {
consentType.value = 'consent';
confirmText.value = 'This is a test student. Please do not accept this form.';
showConsent.value = true;
Expand All @@ -223,14 +223,25 @@ async function checkConsent() {
if (_get(toRaw(consentStatus), consentDoc.version)) {
const legalDocs = _get(toRaw(consentStatus), consentDoc.version);
let found = false;
let signedBeforeAugFirst = false;
_forEach(legalDocs, (document) => {
const signedDate = new Date(document.dateSigned);
const augustFirstThisYear = new Date(currentDate.getFullYear(), 7, 1); // August 1st of the current year

if (document.amount === docAmount && document.expectedTime === docExpectedTime) {
found = true;
if (signedDate < augustFirstThisYear && currentDate >= augustFirstThisYear) {
console.log('Signed before August 1st');
signedBeforeAugFirst = true;
}
}
if (isNaN(new Date(document.dateSigned)) && currentDate >= augustFirstThisYear) {
signedBeforeAugFirst = true;
}
});

if (!found) {
if (docAmount !== '' || docExpectedTime !== '') {
if (!found || signedBeforeAugFirst) {
if (docAmount !== '' || docExpectedTime !== '' || signedBeforeAugFirst) {
confirmText.value = consentDoc.text;
showConsent.value = true;
return;
Expand Down