Skip to content

Commit f31ee5e

Browse files
authored
Merge pull request #882 from Louifine/feat/add-tests
[feat] enhance project tutorial tests and add observer role functiona…
2 parents b4b9cca + decbf81 commit f31ee5e

9 files changed

Lines changed: 399 additions & 219 deletions

File tree

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

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

33
const currentProject = projects[1];
4+
const currentProject2 = projects[25];
45

56
describe('I can follow the project tutorial', () => {
6-
it('displays the launcher tutorial on the overview window', () => {
7+
it('displays the launcher tutorial on the overview window as regional advisor', () => {
78
cy.login('conseiller1');
89
cy.visit(`/project/${currentProject.pk}`);
910
cy.get('[data-test-id="tutorial-project-launcher"]').should.exist;
@@ -19,7 +20,7 @@ describe('I can follow the project tutorial', () => {
1920
});
2021

2122
it('fills up the tutorial and tutorial disappear', () => {
22-
cy.login('jeannot');
23+
cy.login('conseiller2');
2324
cy.visit(`/project/2`);
2425

2526
cy.get('[data-test-id="button-join-as-advisor"]').click();
@@ -31,4 +32,31 @@ describe('I can follow the project tutorial', () => {
3132
cy.get('.introjs-skipbutton').click();
3233
cy.get('[data-test-id="project-overview-tutorial"]').should('not.exist');
3334
});
35+
36+
37+
it('displays the launcher tutorial on the overview window as advisor', () => {
38+
cy.login('conseiller3');
39+
cy.visit(`/project/${currentProject.pk}`);
40+
cy.becomeAdvisor(currentProject.pk);
41+
cy.get('[data-test-id="tutorial-project-launcher"]').should.exist;
42+
});
43+
44+
it('displays the launcher tutorial on the overview window as observer', () => {
45+
cy.login('staff');
46+
cy.visit(`/project/${currentProject.pk}`);
47+
cy.becomeObserver(currentProject.pk);
48+
cy.get('[data-test-id="tutorial-project-launcher"]').should.exist;
49+
});
50+
51+
it('displays the launcher tutorial on the overview window as regional advisor not on the right region ', () => {
52+
cy.login('conseiller4');
53+
cy.visit(`/project/${currentProject2.pk}`);
54+
cy.get('[data-test-id="tutorial-project-launcher"]').should('not.exist');
55+
});
56+
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}`);
60+
cy.get('[data-test-id="tutorial-project-launcher"]').should.exist;
61+
});
3462
});

frontend_tests/cypress/fixtures/profiles/profiles.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,35 @@
7373
],
7474
"sites" : [1]
7575
}
76+
},
77+
{
78+
"model": "home.userprofile",
79+
"pk": 12,
80+
"fields": {
81+
"user": 12,
82+
"organization": 2,
83+
"phone_no": "",
84+
"organization_position": null,
85+
"deleted": null,
86+
"departments": [
87+
42
88+
],
89+
"sites" : [1]
90+
}
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+
}
76106
}
77107
]
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/projects.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,5 +688,33 @@
688688
"impediments": "",
689689
"deleted": null
690690
}
691+
},
692+
{
693+
"model": "projects.project",
694+
"pk": 26,
695+
"fields": {
696+
"submitted_by": 5,
697+
"ro_key": "af8facec96f14d0fbcf854cc26c37caa",
698+
"last_name": "John",
699+
"first_name": "Doe",
700+
"publish_to_cartofriches": false,
701+
"exclude_stats": true,
702+
"muted": false,
703+
"org_name": "Frichti",
704+
"created_on": "2022-03-29T14:31:39Z",
705+
"updated_on": "2022-09-19T13:08:07.795Z",
706+
"tags": "",
707+
"name": "test region",
708+
"phone": "01 01 01 01 01",
709+
"description": "projet sur une commune d'un autre département que le 42, à savoir celui des conseillers",
710+
"advisors_note": "Quels financements existent pour ouvrir une friterie traditionnelle mais dans un food truck, le tout sur une ancienne usine de draperie ?\r\nedit de PR@beta",
711+
"advisors_note_on": "2022-08-29T14:51:12Z",
712+
"advisors_note_by": 1,
713+
"location": "861 chemin rural 53",
714+
"commune": 3,
715+
"impediments": "",
716+
"deleted": null,
717+
"sites": [1]
718+
}
691719
}
692720
]

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
]

0 commit comments

Comments
 (0)