@uuv/playwright 1.6.1 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/cucumber/step_definitions/playwright/_.common.d.ts +13 -13
- package/dist/cucumber/step_definitions/playwright/_.common.js +13 -117
- package/dist/cucumber/step_definitions/playwright/base-check-engine.d.ts +13 -13
- package/dist/cucumber/step_definitions/playwright/base-check-engine.js +96 -15
- package/dist/cucumber/step_definitions/playwright/core-engine.d.ts +2 -1
- package/dist/cucumber/step_definitions/playwright/core-engine.js +4 -0
- package/dist/cucumber/step_definitions/playwright/generated/_en-generated-cucumber-steps-definition.js +95 -14
- package/dist/cucumber/step_definitions/playwright/generated/_fr-generated-cucumber-steps-definition.js +95 -14
- package/package.json +4 -4
- package/src/cucumber/step_definitions/playwright/generated/_en-generated-cucumber-steps-definition.ts +279 -180
- package/src/cucumber/step_definitions/playwright/generated/_fr-generated-cucumber-steps-definition.ts +279 -180
|
@@ -4,19 +4,19 @@ NE PAS MODIFIER, FICHIER GENERE
|
|
|
4
4
|
*******************************/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/**
|
|
7
|
-
* Software Name : UUV
|
|
8
|
-
*
|
|
9
|
-
* SPDX-FileCopyrightText: Copyright (c) 2022-2023 Orange
|
|
10
|
-
* SPDX-License-Identifier: MIT
|
|
11
|
-
*
|
|
12
|
-
* This software is distributed under the MIT License,
|
|
13
|
-
* the text of which is available at https://spdx.org/licenses/MIT.html
|
|
14
|
-
* or see the "LICENSE" file for more details.
|
|
15
|
-
*
|
|
16
|
-
* Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
|
|
17
|
-
* Software description: Make test writing fast, understandable by any human
|
|
18
|
-
* understanding English or French.
|
|
19
|
-
*/
|
|
7
|
+
* Software Name : UUV
|
|
8
|
+
*
|
|
9
|
+
* SPDX-FileCopyrightText: Copyright (c) 2022-2023 Orange
|
|
10
|
+
* SPDX-License-Identifier: MIT
|
|
11
|
+
*
|
|
12
|
+
* This software is distributed under the MIT License,
|
|
13
|
+
* the text of which is available at https://spdx.org/licenses/MIT.html
|
|
14
|
+
* or see the "LICENSE" file for more details.
|
|
15
|
+
*
|
|
16
|
+
* Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
|
|
17
|
+
* Software description: Make test writing fast, understandable by any human
|
|
18
|
+
* understanding English or French.
|
|
19
|
+
*/
|
|
20
20
|
const runner_commons_1 = require("@uuv/runner-commons");
|
|
21
21
|
const axe_playwright_1 = require("axe-playwright");
|
|
22
22
|
const test_1 = require("@playwright/test");
|
|
@@ -51,10 +51,24 @@ const cucumber_1 = require("@cucumber/cucumber");
|
|
|
51
51
|
(0, cucumber_1.When)(`je saisie le(s) mot(s) {string}`, async function (textToType) {
|
|
52
52
|
await (0, core_engine_1.getPageOrElement)(this).then(async (element) => {
|
|
53
53
|
await element.focus({ timeout: 10000 });
|
|
54
|
-
await element.
|
|
54
|
+
await element.type(textToType);
|
|
55
55
|
// console.debug(await showAttributesInLocator(element));
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
+
(0, cucumber_1.When)(`j'appuie {int} fois sur {string}`, async function (nbTimes, key) {
|
|
59
|
+
for (let i = 1; i <= nbTimes; i++) {
|
|
60
|
+
await (0, core_engine_1.getPageOrElement)(this).then(async (element) => {
|
|
61
|
+
await element.focus({ timeout: 10000 });
|
|
62
|
+
await pressKey(this, element, key);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
(0, cucumber_1.When)(`j'appuie sur {string}`, async function (key) {
|
|
67
|
+
await (0, core_engine_1.getPageOrElement)(this).then(async (element) => {
|
|
68
|
+
await element.focus({ timeout: 10000 });
|
|
69
|
+
await pressKey(this, element, key);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
58
72
|
(0, cucumber_1.When)(`je positionne le timeout à {int} secondes`, async function (newTimeout) {
|
|
59
73
|
await this.testInfo.setTimeout(newTimeout);
|
|
60
74
|
});
|
|
@@ -123,6 +137,46 @@ const cucumber_1 = require("@cucumber/cucumber");
|
|
|
123
137
|
await (0, axe_playwright_1.injectAxe)(this.page);
|
|
124
138
|
await (0, axe_playwright_1.checkA11y)(this.page);
|
|
125
139
|
});
|
|
140
|
+
(0, cucumber_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité avec le fichier json suivant d'option {}`, async function (option) {
|
|
141
|
+
await (0, axe_playwright_1.injectAxe)(this.page);
|
|
142
|
+
const optionFile = await runner_commons_1.fs.readFileSync(`playwright/fixtures/${option}`);
|
|
143
|
+
const optionJson = JSON.parse(optionFile.toString());
|
|
144
|
+
await (0, axe_playwright_1.checkA11y)(this.page, undefined, {
|
|
145
|
+
axeOptions: optionJson
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
(0, cucumber_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité sur le fichier json suivant de contexte {} et avec le fichier json suivant d'option {}`, async function (context, option) {
|
|
149
|
+
await (0, axe_playwright_1.injectAxe)(this.page);
|
|
150
|
+
const contextFile = await runner_commons_1.fs.readFileSync(`playwright/fixtures/${context}`);
|
|
151
|
+
const optionFile = await runner_commons_1.fs.readFileSync(`playwright/fixtures/${option}`);
|
|
152
|
+
const optionJson = JSON.parse(optionFile.toString());
|
|
153
|
+
await (0, axe_playwright_1.checkA11y)(this.page, JSON.parse(contextFile.toString()), {
|
|
154
|
+
axeOptions: optionJson
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
(0, cucumber_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité de niveau critique`, async function () {
|
|
158
|
+
await (0, axe_playwright_1.injectAxe)(this.page);
|
|
159
|
+
await (0, axe_playwright_1.checkA11y)(this.page, undefined, {
|
|
160
|
+
includedImpacts: ["critical"]
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
(0, cucumber_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité avec l(es) impact(s) {}`, async function (impacts) {
|
|
164
|
+
await (0, axe_playwright_1.injectAxe)(this.page);
|
|
165
|
+
await (0, axe_playwright_1.checkA11y)(this.page, undefined, {
|
|
166
|
+
includedImpacts: [impacts]
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
(0, cucumber_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité avec le(s) standard(s) {}`, async function (tags) {
|
|
170
|
+
await (0, axe_playwright_1.injectAxe)(this.page);
|
|
171
|
+
await (0, axe_playwright_1.checkA11y)(this.page, undefined, {
|
|
172
|
+
axeOptions: {
|
|
173
|
+
runOnly: {
|
|
174
|
+
type: "tag",
|
|
175
|
+
values: [tags]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
126
180
|
(0, cucumber_1.Then)(`je ne dois pas voir un élément avec le rôle {string} et le nom {string}`, async function (role, name) {
|
|
127
181
|
await (0, core_engine_1.notFoundWithRoleAndName)(this, role, name);
|
|
128
182
|
});
|
|
@@ -191,3 +245,30 @@ const cucumber_1 = require("@cucumber/cucumber");
|
|
|
191
245
|
await (0, test_1.expect)(foundedElement).toEqual(expectedElementsOfList.raw());
|
|
192
246
|
});
|
|
193
247
|
});
|
|
248
|
+
async function pressKey(world, element, key) {
|
|
249
|
+
switch (key) {
|
|
250
|
+
case runner_commons_1.KEY_PRESS.TAB:
|
|
251
|
+
await element.press("Tab");
|
|
252
|
+
break;
|
|
253
|
+
case runner_commons_1.KEY_PRESS.REVERSE_TAB:
|
|
254
|
+
await element.press("ShiftLeft+Tab");
|
|
255
|
+
break;
|
|
256
|
+
case runner_commons_1.KEY_PRESS.UP:
|
|
257
|
+
await element.press("ArrowUp");
|
|
258
|
+
break;
|
|
259
|
+
case runner_commons_1.KEY_PRESS.DOWN:
|
|
260
|
+
await element.press("ArrowDown");
|
|
261
|
+
break;
|
|
262
|
+
case runner_commons_1.KEY_PRESS.LEFT:
|
|
263
|
+
await element.press("ArrowLeft");
|
|
264
|
+
break;
|
|
265
|
+
case runner_commons_1.KEY_PRESS.RIGHT:
|
|
266
|
+
await element.press("ArrowRight");
|
|
267
|
+
break;
|
|
268
|
+
default:
|
|
269
|
+
console.error("the command" + key + " is unrecognized.");
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
await (0, core_engine_1.deleteCookieByName)(world, core_engine_1.COOKIE_NAME.SELECTED_ELEMENT);
|
|
273
|
+
await (0, core_engine_1.addCookieWhenValueIsList)(world, core_engine_1.COOKIE_NAME.SELECTED_ELEMENT, { name: core_engine_1.FILTER_TYPE.SELECTOR_PARENT, value: "*:focus" });
|
|
274
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/playwright",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "Louis Fredice NJAKO MOLOM (https://github.com/luifr10) & Stanley SERVICAL (https://github.com/stanlee974)",
|
|
6
6
|
"description": "A solution to run E2E tests written in cucumber(BDD) with playwright.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/Orange-OpenSource/uuv"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://
|
|
12
|
+
"homepage": "https://orange-opensource.github.io/uuv/",
|
|
13
13
|
"bin": {
|
|
14
14
|
"uuv": "bin/uuv"
|
|
15
15
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@cucumber/cucumber": "9.3.0",
|
|
48
48
|
"@playwright/test": "1.33.0",
|
|
49
|
-
"@uuv/runner-commons": "1.
|
|
49
|
+
"@uuv/runner-commons": "1.6.1",
|
|
50
50
|
"axe-core": "4.7.2",
|
|
51
51
|
"axe-playwright": "1.2.3",
|
|
52
52
|
"chalk": "4.1.2",
|