-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathresults.js
164 lines (147 loc) · 4.75 KB
/
results.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import { submit } from "./form"
const wait = () => {
cy.wait("@results")
}
const getBenefitSummary = (id) => cy.get(`@${id}-summary`)
const back = () => cy.get('[data-testid="back-button"]').click()
const IdentifyBenefit = (id, name) => {
cy.get(
`[itemtype="http://schema.org/GovernmentService"][data-testid="${id}"]`,
{ timeout: 10000 }
).as(`${id}-summary`)
getBenefitSummary(id)
.find('[itemprop="name"]')
.invoke("text")
.should("match", name)
}
const hasPrimeActivite = () => {
const name = /Prime d’activité/
const id = "ppa"
const description = /revenus/
IdentifyBenefit(id, name)
getBenefitSummary(id)
.find('[data-testid="droit-estime-value"]')
.invoke("text")
.should("match", /(\d+)[\S\n\r\s]+€/)
getBenefitSummary(id)
.find('[data-testid="droit-estime-legend"]')
.invoke("text")
.should("match", /\/ mois/)
getBenefitSummary(id).find('[data-testid="droit-estime-legend"]').click()
cy.get('[data-testid="droit-detail"]').as(id)
cy.get(`@${id}`)
.get('[itemprop="description"]')
.invoke("text")
.should("match", description)
cy.get(`@${id}`).get('[itemprop="termsOfService"]').should("be.visible")
}
const captureFiscalResources = () => {
const name = /Livret d’épargne populaire/
const id = "livret_epargne_populaire_taux"
cy.get('[data-testid="back-button"]').click()
IdentifyBenefit(id, name)
getBenefitSummary(id).click()
cy.get(".notification.warning").invoke("text").should("contain", "ressources")
cy.get(".button.outline.red").click()
cy.get('input[type="number"]').first().type("50000")
submit()
cy.get(`${id}-summary`).should("not.exist")
}
const hasHousingBenefit = () => {
const name = /Aides au logement/
const id = "aide_logement"
const description = /Apl/
IdentifyBenefit(id, name)
getBenefitSummary(id)
.find('[data-testid="droit-estime-value"]')
.invoke("text")
.should("match", /(\d+)[\S\n\r\s]+€/)
getBenefitSummary(id)
.find('[data-testid="droit-estime-legend"]')
.invoke("text")
.should("match", /\/ mois/)
getBenefitSummary(id).find('[data-testid="droit-estime-legend"]').click()
cy.get('[data-testid="droit-detail"]').as(id)
cy.get(`@${id}`)
.get('[itemprop="description"]')
.invoke("text")
.should("match", description)
cy.get(`@${id}`).get('[itemprop="termsOfService"]').should("be.visible")
// Vérifie si la page patrimoine est bien affichée
cy.get('[data-testid="patrimoine-link"]').click()
cy.get('[data-testid="immobilier-title"]').should("exist")
submit()
}
const hasCSS = () => {
const name = /Complémentaire santé solidaire/
const id = "css_participation_forfaitaire"
IdentifyBenefit(id, name)
}
const hasAAH = () => {
const name = /Allocation aux adultes handicapés/
const id = "aah"
const description = "AAH"
IdentifyBenefit(id, name)
getBenefitSummary(id)
.find('[data-testid="droit-estime-value"]')
.invoke("text")
.should("match", /(\d+)[\S\n\r\s]+€/)
getBenefitSummary(id)
.find('[data-testid="droit-estime-legend"]')
.invoke("text")
.should("match", /\/ mois/)
getBenefitSummary(id).find('[data-testid="droit-estime-legend"]').click()
cy.get('[data-testid="droit-detail"]').as(id)
cy.get(`@${id}`)
.get('[itemprop="description"]')
.invoke("text")
.should("contain", description)
cy.get(`@${id}`).get('[itemprop="termsOfService"]').should("be.visible")
}
const hasBourseCriteresSociaux = () => {
const name = /Bourse sur critères sociaux/
const id = "bourse_criteres_sociaux"
const description = /BCS/
IdentifyBenefit(id, name)
getBenefitSummary(id)
.find('[data-testid="droit-estime-value"]')
.invoke("text")
.should("match", /(\d+)[\S\n\r\s]+€/)
getBenefitSummary(id)
.find('[data-testid="droit-estime-legend"]')
.invoke("text")
.should("match", /\/ mois/)
getBenefitSummary(id).find('[data-testid="droit-estime-legend"]').click()
cy.get('[data-testid="droit-detail"]').as(id)
cy.get(`@${id}`)
.get('[itemprop="description"]')
.invoke("text")
.should("match", description)
cy.get(`@${id}`).get('[itemprop="termsOfService"]').should("be.visible")
}
const hasIleDeFranceAideAuMerite = () => {
const name = /Aide au mérite/
const id = "ile-de-france-aide-au-merite"
IdentifyBenefit(id, name)
getBenefitSummary(id)
.find('[data-testid="droit-estime-value"]')
.invoke("text")
.should("match", /(\d+)[\S\n\r\s]+€/)
}
const hasAideVeloParis = () => {
const name = /Aide à l'achat d'un vélo : Ville de Paris/
const id = "aidesvelo_aides_paris"
IdentifyBenefit(id, name)
}
export default {
wait,
back,
hasPrimeActivite,
hasHousingBenefit,
hasCSS,
hasAAH,
hasBourseCriteresSociaux,
captureFiscalResources,
hasIleDeFranceAideAuMerite,
hasAideVeloParis,
}