@uuv/cypress 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.
@@ -4,22 +4,23 @@ 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 cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor");
21
21
  const _context_1 = require("../_context");
22
22
  require("../../../../cypress/commands");
23
+ const runner_commons_1 = require("@uuv/runner-commons");
23
24
  const core_engine_1 = require("../core-engine");
24
25
  (0, cypress_cucumber_preprocessor_1.When)(`je visite l'Url {string}`, function (siteUrl) {
25
26
  if (siteUrl.match("^http:\\/\\/|https:\\/\\/")) {
@@ -38,6 +39,20 @@ const core_engine_1 = require("../core-engine");
38
39
  context.focusedElement.type(textToType);
39
40
  });
40
41
  });
42
+ (0, cypress_cucumber_preprocessor_1.When)(`j'appuie {int} fois sur {string}`, function (nbTimes, key) {
43
+ for (let i = 1; i <= nbTimes; i++) {
44
+ cy.uuvCheckContextFocusedElement().then((context) => {
45
+ context.focusedElement.focus();
46
+ pressKey(context.focusedElement, key);
47
+ });
48
+ }
49
+ });
50
+ (0, cypress_cucumber_preprocessor_1.When)(`j'appuie sur {string}`, function (key) {
51
+ cy.uuvCheckContextFocusedElement().then((context) => {
52
+ context.focusedElement.focus();
53
+ pressKey(context.focusedElement, key);
54
+ });
55
+ });
41
56
  ////////////////////////////////////////////
42
57
  // Context ACTIONS
43
58
  ////////////////////////////////////////////
@@ -49,7 +64,7 @@ const core_engine_1 = require("../core-engine");
49
64
  });
50
65
  (0, cypress_cucumber_preprocessor_1.When)(`je positionne le timeout à {int} secondes`, function (newTimeout) {
51
66
  return cy.uuvPatchContext({
52
- timeout: newTimeout,
67
+ timeout: newTimeout
53
68
  });
54
69
  });
55
70
  (0, cypress_cucumber_preprocessor_1.When)(`je vais à l'intérieur de l'élément ayant pour rôle {string} et pour nom {string}`, function (role, name) {
@@ -94,21 +109,21 @@ const core_engine_1 = require("../core-engine");
94
109
  (0, cypress_cucumber_preprocessor_1.When)(`je simule une requête {} sur l'url {string} nommée {string} avec le contenu suivant {}`, function (verb, uri, name, body) {
95
110
  return cy
96
111
  .intercept(verb, uri, {
97
- body: body,
112
+ body: body
98
113
  })
99
114
  .as(name);
100
115
  });
101
116
  (0, cypress_cucumber_preprocessor_1.When)(`je simule une requête {} sur l'url {string} nommée {string} avec le code http {int}`, function (verb, uri, name, statusCode) {
102
117
  return cy
103
118
  .intercept(verb, uri, {
104
- statusCode: statusCode,
119
+ statusCode: statusCode
105
120
  })
106
121
  .as(name);
107
122
  });
108
123
  (0, cypress_cucumber_preprocessor_1.When)(`je simule une requête {} sur l'url {string} nommée {string} avec le fichier suivant {}`, function (verb, uri, name, fixture) {
109
124
  return cy
110
125
  .intercept(verb, uri, {
111
- fixture: fixture,
126
+ fixture: fixture
112
127
  })
113
128
  .as(name);
114
129
  });
@@ -119,7 +134,7 @@ const core_engine_1 = require("../core-engine");
119
134
  cy.intercept(method, url, (req) => {
120
135
  req.headers = {
121
136
  ...req.headers,
122
- ...headersToSet.rowsHash(),
137
+ ...headersToSet.rowsHash()
123
138
  };
124
139
  req.continue();
125
140
  });
@@ -128,7 +143,7 @@ const core_engine_1 = require("../core-engine");
128
143
  cy.intercept(url, (req) => {
129
144
  req.headers = {
130
145
  ...req.headers,
131
- ...headersToSet.rowsHash(),
146
+ ...headersToSet.rowsHash()
132
147
  };
133
148
  req.continue();
134
149
  });
@@ -230,3 +245,66 @@ const core_engine_1 = require("../core-engine");
230
245
  cy.injectAxe();
231
246
  cy.checkA11y();
232
247
  });
248
+ (0, cypress_cucumber_preprocessor_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité de niveau critique`, async function () {
249
+ cy.injectAxe();
250
+ cy.checkA11y(undefined, {
251
+ includedImpacts: ["critical"]
252
+ });
253
+ });
254
+ (0, cypress_cucumber_preprocessor_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité avec l(es) impact(s) {}`, async function (impacts) {
255
+ cy.injectAxe();
256
+ cy.checkA11y(undefined, {
257
+ includedImpacts: [impacts]
258
+ });
259
+ });
260
+ (0, cypress_cucumber_preprocessor_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité avec le(s) standard(s) {}`, async function (tags) {
261
+ cy.injectAxe();
262
+ cy.checkA11y(undefined, {
263
+ runOnly: {
264
+ type: "tag",
265
+ values: [tags]
266
+ }
267
+ });
268
+ });
269
+ (0, cypress_cucumber_preprocessor_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) {
270
+ cy.injectAxe();
271
+ cy.fixture(context).then(context => {
272
+ cy.fixture(option).then(option => {
273
+ cy.checkA11y(context, option);
274
+ });
275
+ });
276
+ });
277
+ (0, cypress_cucumber_preprocessor_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité avec le fichier json suivant d'option {}`, async function (option) {
278
+ cy.injectAxe();
279
+ cy.fixture(option).then(data => {
280
+ cy.checkA11y(undefined, data);
281
+ });
282
+ });
283
+ function pressKey(context, key) {
284
+ switch (key) {
285
+ case runner_commons_1.KEY_PRESS.TAB:
286
+ context.realPress("Tab");
287
+ break;
288
+ case runner_commons_1.KEY_PRESS.REVERSE_TAB:
289
+ context.realPress(["ShiftLeft", "Tab"]);
290
+ break;
291
+ case runner_commons_1.KEY_PRESS.UP:
292
+ context.realPress("ArrowUp");
293
+ break;
294
+ case runner_commons_1.KEY_PRESS.DOWN:
295
+ context.realPress("ArrowDown");
296
+ break;
297
+ case runner_commons_1.KEY_PRESS.LEFT:
298
+ context.realPress("ArrowLeft");
299
+ break;
300
+ case runner_commons_1.KEY_PRESS.RIGHT:
301
+ context.realPress("ArrowRight");
302
+ break;
303
+ default:
304
+ console.error("the command" + key + " is unrecognized.");
305
+ break;
306
+ }
307
+ cy.uuvPatchContext({
308
+ focusedElement: cy.focused()
309
+ });
310
+ }
@@ -18,6 +18,7 @@ import "@testing-library/cypress/add-commands";
18
18
  import "cypress-axe";
19
19
  import { ByRoleOptions } from "@testing-library/cypress";
20
20
  import { Context } from "../cucumber/step_definitions/cypress/_context";
21
+ import "cypress-real-events";
21
22
  declare global {
22
23
  namespace Cypress {
23
24
  interface Chainable {
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  require("@testing-library/cypress/add-commands");
19
19
  require("cypress-axe");
20
20
  const __common_1 = require("../cucumber/step_definitions/cypress/_.common");
21
+ require("cypress-real-events");
21
22
  Cypress.Commands.add("uuvGetContext", __common_1.uuvGetContext);
22
23
  Cypress.Commands.add("uuvCheckContextFocusedElement", __common_1.uuvCheckContextFocusedElement);
23
24
  Cypress.Commands.add("uuvPatchContext", __common_1.uuvPatchContext);
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@uuv/cypress",
3
- "version": "1.6.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 cypress.",
7
7
  "license": "MIT",
8
- "homepage": "https://e2e-test-quest.github.io/uuv/",
8
+ "homepage": "https://orange-opensource.github.io/uuv/",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/e2e-test-quest/uuv"
11
+ "url": "https://github.com/Orange-OpenSource/uuv"
12
12
  },
13
13
  "bin": {
14
14
  "uuv": "bin/uuv"
@@ -46,11 +46,11 @@
46
46
  "@badeball/cypress-cucumber-preprocessor": "16.0.3",
47
47
  "@cypress/webpack-preprocessor": "5.17.1",
48
48
  "@testing-library/cypress": "9.0.0",
49
- "@uuv/runner-commons": "1.5.1",
49
+ "@uuv/runner-commons": "1.6.1",
50
50
  "axe-core": "4.7.2",
51
51
  "chalk": "4.1.2",
52
52
  "cucumber-json-report-formatter": "0.1.4",
53
- "cypress": "12.17.2",
53
+ "cypress": "12.17.3",
54
54
  "cypress-axe": "1.4.0",
55
55
  "figlet": "1.6.0",
56
56
  "is-admin": "2.1.1",