Skip to content

Commit

Permalink
refactor: update tutorial tests and add new user profiles and invites
Browse files Browse the repository at this point in the history
  • Loading branch information
Louifine committed Jan 7, 2025
1 parent 74182d5 commit decbf81
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import projects from '../../../fixtures/projects/projects.json';

const currentProject = projects[1];
const currentProject2 = projects[24];
const currentProject2 = projects[25];

describe('I can follow the project tutorial', () => {
xit('displays the launcher tutorial on the overview window as regional advisor', () => {
it('displays the launcher tutorial on the overview window as regional advisor', () => {
cy.login('conseiller1');
cy.visit(`/project/${currentProject.pk}`);
cy.get('[data-test-id="tutorial-project-launcher"]').should.exist;
});

xit('snooze the tutorial and tutorial disappear', () => {
it('snooze the tutorial and tutorial disappear', () => {
cy.login('conseiller1');
cy.visit(`/project/${currentProject.pk}`);

Expand All @@ -19,7 +19,7 @@ describe('I can follow the project tutorial', () => {
cy.get('[data-test-id="tutorial-project-launcher"]').should('not.exist');
});

xit('fills up the tutorial and tutorial disappear', () => {
it('fills up the tutorial and tutorial disappear', () => {
cy.login('conseiller2');
cy.visit(`/project/2`);

Expand All @@ -34,7 +34,7 @@ describe('I can follow the project tutorial', () => {
});


xit('displays the launcher tutorial on the overview window as advisor', () => {
it('displays the launcher tutorial on the overview window as advisor', () => {
cy.login('conseiller3');
cy.visit(`/project/${currentProject.pk}`);
cy.becomeAdvisor(currentProject.pk);
Expand All @@ -51,12 +51,12 @@ describe('I can follow the project tutorial', () => {
it('displays the launcher tutorial on the overview window as regional advisor not on the right region ', () => {
cy.login('conseiller4');
cy.visit(`/project/${currentProject2.pk}`);
cy.get('[data-test-id="tutorial-project-launcher"]').should.exist;
cy.get('[data-test-id="tutorial-project-launcher"]').should('not.exist');
});

xit('displays the launcher tutorial on the overview window as regional advisor not on the right region', () => {
cy.login('conseiller4');
cy.visit(`/project/25`);
it('displays the launcher tutorial on the overview window as regional advisor not on the right region but with an invite accepted', () => {
cy.login('conseiller5');
cy.visit(`/project/${currentProject2.pk}`);
cy.get('[data-test-id="tutorial-project-launcher"]').should.exist;
});
});
15 changes: 15 additions & 0 deletions frontend_tests/cypress/fixtures/profiles/profiles.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,20 @@
],
"sites" : [1]
}
},
{
"model": "home.userprofile",
"pk": 13,
"fields": {
"user": 13,
"organization": 2,
"phone_no": "",
"organization_position": null,
"deleted": null,
"departments": [
42
],
"sites" : [1]
}
}
]
16 changes: 16 additions & 0 deletions frontend_tests/cypress/fixtures/projects/invites.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"model": "invites.invite",
"pk": "774e9444-ff9b-43e3-b26f-c91421c5ddc7",
"fields": {
"created_on": "2022-09-01T08:58:56.513Z",
"accepted_on": "2022-09-01T08:58:56.513Z",
"email": "[email protected]",
"message": "viens donc adviser ce projet",
"role": "OBSERVER",
"inviter_id": 1,
"project_id": 26,
"site_id": 1
}
}
]
10 changes: 10 additions & 0 deletions frontend_tests/cypress/fixtures/projects/projectsMembers.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,14 @@
"site": 1
}
}
,
{
"model": "projects.projectswitchtender",
"pk": 23,
"fields": {
"switchtender": 13,
"project": 26,
"site": 1
}
}
]
10 changes: 10 additions & 0 deletions frontend_tests/cypress/fixtures/projects/projectsSites.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,15 @@
"project_id": 25,
"site_id": 1
}
},
{
"pk": 29,
"model": "projects.projectsite",
"fields": {
"status": "TO_PROCESS",
"is_origin": true,
"project_id": 26,
"site_id": 1
}
}
]
20 changes: 20 additions & 0 deletions frontend_tests/cypress/fixtures/users/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,25 @@
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 13,
"fields": {
"password": "pbkdf2_sha256$260000$S2IZAAPKqcAhYhomW80hJr$xuPTtuI0I9JDgJ+fHKmZseqGrJJ1B5Y0hnJDL/yH2cA=",
"last_login": "2023-09-01T08:58:56.513Z",
"is_superuser": false,
"username": "[email protected]",
"first_name": "regional2",
"last_name": "withInvite",
"email": "[email protected]",
"is_staff": false,
"is_active": true,
"date_joined": "2021-07-09T09:29:47.252Z",
"groups": [
4
],
"user_permissions": []
}
}
]
4 changes: 4 additions & 0 deletions frontend_tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Cypress.Commands.add('login', (role) => {
case 'conseiller4': //conseiller
username = users[11].fields.username;
break;
case 'regional2': //conseiller
case 'conseiller5': //conseiller
username = users[12].fields.username;
break;
case 'bob': //collectivité
case 'collectivité1': //collectivité
username = users[4].fields.username;
Expand Down
4 changes: 2 additions & 2 deletions frontend_tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"test": "concurrently \"yarn frontend:start-server\" \"yarn start-server-and-test\"",
"start-server-and-test": "start-server-and-test 'yarn django:start-server --verbosity 0' http://localhost:8001 'yarn update-and-test'",
"update-and-test": "yarn django:update-permissions && yarn cy:run",
"django:start-server": "cross-env DJANGO_SETTINGS_MODULE=recoco.settings.frontend_tests ../manage.py testserver --addrport 8001 ./cypress/fixtures/settings/tag.json ./cypress/fixtures/settings/siteWithOnboardingAndSurvey.json ./cypress/fixtures/users/users.json ./cypress/fixtures/geomatics/region.json ./cypress/fixtures/geomatics/department.json ./cypress/fixtures/geomatics/commune.json ./cypress/fixtures/projects/projects.json ./cypress/fixtures/projects/projectsSites.json ./cypress/fixtures/projects/projectsMembers.json ./cypress/fixtures/projects/reminders.json ./cypress/fixtures/addressbook/organizations.json ./cypress/fixtures/profiles/profiles.json ./cypress/fixtures/resources/resources.json ./cypress/fixtures/addressbook/contacts.json ./cypress/fixtures/documents/documents.json ./cypress/fixtures/settings/challengeDefinition.json ./cypress/fixtures/projects/tasks.json --noinput",
"django:start-server": "cross-env DJANGO_SETTINGS_MODULE=recoco.settings.frontend_tests ../manage.py testserver --addrport 8001 ./cypress/fixtures/settings/tag.json ./cypress/fixtures/settings/siteWithOnboardingAndSurvey.json ./cypress/fixtures/users/users.json ./cypress/fixtures/geomatics/region.json ./cypress/fixtures/geomatics/department.json ./cypress/fixtures/geomatics/commune.json ./cypress/fixtures/projects/projects.json ./cypress/fixtures/projects/projectsSites.json ./cypress/fixtures/projects/projectsMembers.json ./cypress/fixtures/projects/reminders.json ./cypress/fixtures/addressbook/organizations.json ./cypress/fixtures/profiles/profiles.json ./cypress/fixtures/resources/resources.json ./cypress/fixtures/addressbook/contacts.json ./cypress/fixtures/documents/documents.json ./cypress/fixtures/settings/challengeDefinition.json ./cypress/fixtures/projects/tasks.json ./cypress/fixtures/projects/invites.json --noinput",
"test_ui": "concurrently \"yarn frontend:start-server\" \"yarn start-server-and-test-ui\"",
"start-server-and-test-ui": "PYTEST_CURRENT_TEST=True start-server-and-test 'yarn django:start-server --verbosity 0' http://localhost:8001 'yarn update-and-test_ui'",
"start-server-and-test-ui": "start-server-and-test 'yarn django:start-server --verbosity 0' http://localhost:8001 'yarn update-and-test_ui'",
"django:start-server-test_ui": "cross-env DJANGO_SETTINGS_MODULE=recoco.settings.frontend_tests ../manage.py runserver 8001",
"django:update-permissions": "cross-env ../manage.py update_permissions --settings recoco.settings.frontend_tests_permissions",
"update-and-test_ui": "yarn django:update-permissions && yarn cy:test_ui",
Expand Down

0 comments on commit decbf81

Please sign in to comment.