Skip to content

Commit decbf81

Browse files
committed
refactor: update tutorial tests and add new user profiles and invites
1 parent 74182d5 commit decbf81

8 files changed

Lines changed: 86 additions & 11 deletions

File tree

frontend_tests/cypress/e2e/tools/tutorial/projectOverviewTutorial.cy.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import projects from '../../../fixtures/projects/projects.json';
22

33
const currentProject = projects[1];
4-
const currentProject2 = projects[24];
4+
const currentProject2 = projects[25];
55

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

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

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

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

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

3636

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

57-
xit('displays the launcher tutorial on the overview window as regional advisor not on the right region', () => {
58-
cy.login('conseiller4');
59-
cy.visit(`/project/25`);
57+
it('displays the launcher tutorial on the overview window as regional advisor not on the right region but with an invite accepted', () => {
58+
cy.login('conseiller5');
59+
cy.visit(`/project/${currentProject2.pk}`);
6060
cy.get('[data-test-id="tutorial-project-launcher"]').should.exist;
6161
});
6262
});

frontend_tests/cypress/fixtures/profiles/profiles.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,20 @@
8888
],
8989
"sites" : [1]
9090
}
91+
},
92+
{
93+
"model": "home.userprofile",
94+
"pk": 13,
95+
"fields": {
96+
"user": 13,
97+
"organization": 2,
98+
"phone_no": "",
99+
"organization_position": null,
100+
"deleted": null,
101+
"departments": [
102+
42
103+
],
104+
"sites" : [1]
105+
}
91106
}
92107
]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[
2+
{
3+
"model": "invites.invite",
4+
"pk": "774e9444-ff9b-43e3-b26f-c91421c5ddc7",
5+
"fields": {
6+
"created_on": "2022-09-01T08:58:56.513Z",
7+
"accepted_on": "2022-09-01T08:58:56.513Z",
8+
"email": "conseiller-regional-invited@test.fr",
9+
"message": "viens donc adviser ce projet",
10+
"role": "OBSERVER",
11+
"inviter_id": 1,
12+
"project_id": 26,
13+
"site_id": 1
14+
}
15+
}
16+
]

frontend_tests/cypress/fixtures/projects/projectsMembers.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,14 @@
323323
"site": 1
324324
}
325325
}
326+
,
327+
{
328+
"model": "projects.projectswitchtender",
329+
"pk": 23,
330+
"fields": {
331+
"switchtender": 13,
332+
"project": 26,
333+
"site": 1
334+
}
335+
}
326336
]

frontend_tests/cypress/fixtures/projects/projectsSites.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,5 +278,15 @@
278278
"project_id": 25,
279279
"site_id": 1
280280
}
281+
},
282+
{
283+
"pk": 29,
284+
"model": "projects.projectsite",
285+
"fields": {
286+
"status": "TO_PROCESS",
287+
"is_origin": true,
288+
"project_id": 26,
289+
"site_id": 1
290+
}
281291
}
282292
]

frontend_tests/cypress/fixtures/users/users.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,5 +226,25 @@
226226
],
227227
"user_permissions": []
228228
}
229+
},
230+
{
231+
"model": "auth.user",
232+
"pk": 13,
233+
"fields": {
234+
"password": "pbkdf2_sha256$260000$S2IZAAPKqcAhYhomW80hJr$xuPTtuI0I9JDgJ+fHKmZseqGrJJ1B5Y0hnJDL/yH2cA=",
235+
"last_login": "2023-09-01T08:58:56.513Z",
236+
"is_superuser": false,
237+
"username": "conseiller-regional-invited@test.fr",
238+
"first_name": "regional2",
239+
"last_name": "withInvite",
240+
"email": "conseiller-regional-invited@test.fr",
241+
"is_staff": false,
242+
"is_active": true,
243+
"date_joined": "2021-07-09T09:29:47.252Z",
244+
"groups": [
245+
4
246+
],
247+
"user_permissions": []
248+
}
229249
}
230250
]

frontend_tests/cypress/support/commands.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Cypress.Commands.add('login', (role) => {
4242
case 'conseiller4': //conseiller
4343
username = users[11].fields.username;
4444
break;
45+
case 'regional2': //conseiller
46+
case 'conseiller5': //conseiller
47+
username = users[12].fields.username;
48+
break;
4549
case 'bob': //collectivité
4650
case 'collectivité1': //collectivité
4751
username = users[4].fields.username;

frontend_tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"test": "concurrently \"yarn frontend:start-server\" \"yarn start-server-and-test\"",
1111
"start-server-and-test": "start-server-and-test 'yarn django:start-server --verbosity 0' http://localhost:8001 'yarn update-and-test'",
1212
"update-and-test": "yarn django:update-permissions && yarn cy:run",
13-
"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",
13+
"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",
1414
"test_ui": "concurrently \"yarn frontend:start-server\" \"yarn start-server-and-test-ui\"",
15-
"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'",
15+
"start-server-and-test-ui": "start-server-and-test 'yarn django:start-server --verbosity 0' http://localhost:8001 'yarn update-and-test_ui'",
1616
"django:start-server-test_ui": "cross-env DJANGO_SETTINGS_MODULE=recoco.settings.frontend_tests ../manage.py runserver 8001",
1717
"django:update-permissions": "cross-env ../manage.py update_permissions --settings recoco.settings.frontend_tests_permissions",
1818
"update-and-test_ui": "yarn django:update-permissions && yarn cy:test_ui",

0 commit comments

Comments
 (0)