@uuv/cypress 2.57.0 → 2.58.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [2.58.0](https://github.com/e2e-test-quest/uuv/compare/runner-cypress-v2.57.0...runner-cypress-v2.58.0) (2025-07-01)
2
+
3
+
4
+ ### Features
5
+
6
+ * add grid and table sentences, [#1029](https://github.com/e2e-test-quest/uuv/issues/1029) ([97f7330](https://github.com/e2e-test-quest/uuv/commit/97f7330a50926a872275c4f5ad026920174a9592))
7
+
1
8
  # [2.57.0](https://github.com/e2e-test-quest/uuv/compare/runner-cypress-v2.56.0...runner-cypress-v2.57.0) (2025-06-08)
2
9
 
3
10
 
@@ -14,11 +14,14 @@ import { ByRoleOptions } from "@testing-library/cypress";
14
14
  import { Context } from "./_context";
15
15
  import Chainable = Cypress.Chainable;
16
16
  import { A11yReferenceEnum } from "@uuv/a11y";
17
+ import { DataTable } from "@badeball/cypress-cucumber-preprocessor";
17
18
  export declare const shouldGenerateA11yReport: () => boolean;
18
19
  export declare const getA11yResultFilePath: () => string;
19
20
  export declare const uuvGetContext: () => Chainable<Context>;
20
21
  export declare function uuvCheckContextWithinFocusedElement(dontThrowError?: boolean): Cypress.Chainable<Context>;
21
22
  export declare function uuvPatchContext(partOfContext: any): Cypress.Chainable<Context>;
23
+ export declare function removeHeaderSeparatorLine(pExpectedElementsOfList: DataTable): string[][];
24
+ export declare function expectTableToHaveContent(expectedElementsOfList: string[][], cellAccessibleRole: string): void;
22
25
  export declare function uuvFindAllByRole(role: string, roleOptions: ByRoleOptions): Cypress.Chainable<JQuery<HTMLElement>>;
23
26
  export declare function uuvFindByRole(role: string, roleOptions: ByRoleOptions): Cypress.Chainable<JQuery<HTMLElement>>;
24
27
  export declare function uuvFindByLabelText(labelTextToSearch: string, roleOptions: ByRoleOptions): Cypress.Chainable<JQuery<HTMLElement>>;
@@ -15,6 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.uuvGetContext = exports.getA11yResultFilePath = exports.shouldGenerateA11yReport = void 0;
16
16
  exports.uuvCheckContextWithinFocusedElement = uuvCheckContextWithinFocusedElement;
17
17
  exports.uuvPatchContext = uuvPatchContext;
18
+ exports.removeHeaderSeparatorLine = removeHeaderSeparatorLine;
19
+ exports.expectTableToHaveContent = expectTableToHaveContent;
18
20
  exports.uuvFindAllByRole = uuvFindAllByRole;
19
21
  exports.uuvFindByRole = uuvFindByRole;
20
22
  exports.uuvFindByLabelText = uuvFindByLabelText;
@@ -63,6 +65,27 @@ function addContextOptions(context, roleOptions) {
63
65
  };
64
66
  return Object.assign(roleOptions, retour);
65
67
  }
68
+ function removeHeaderSeparatorLine(pExpectedElementsOfList) {
69
+ const expectedElementsOfList = pExpectedElementsOfList.raw();
70
+ if (expectedElementsOfList.length > 1) {
71
+ expectedElementsOfList.splice(1, 1);
72
+ }
73
+ return expectedElementsOfList;
74
+ }
75
+ function expectTableToHaveContent(expectedElementsOfList, cellAccessibleRole) {
76
+ const actualTableContent = [];
77
+ // eslint-disable-next-line cypress/unsafe-to-chain-command
78
+ cy.findAllByRole("row").each(($row, index) => {
79
+ const cellRole = index === 0 ? "columnheader" : cellAccessibleRole;
80
+ cy.findAllByRole(cellRole, { container: $row }).then(($cells) => {
81
+ const ligne = Array.from($cells, cell => cell.textContent?.trim() ?? "");
82
+ actualTableContent.push(ligne);
83
+ });
84
+ }).then(() => {
85
+ assert.equal(actualTableContent.length, expectedElementsOfList.length);
86
+ assert.deepEqual(actualTableContent, expectedElementsOfList, `Expected the table content ${JSON.stringify(actualTableContent)} to equals ${JSON.stringify(expectedElementsOfList)}`);
87
+ });
88
+ }
66
89
  function abstractFindBy(callBackFunction, inputToSearch, inputOptions) {
67
90
  return cy.uuvGetContext().then(context => {
68
91
  // console.log(contextAlias, context);
@@ -385,6 +385,30 @@ const __common_1 = require("./../_.common");
385
385
  });
386
386
  });
387
387
  });
388
+ /**
389
+ * Checks that there is a list with the specified [name](https://russmaxdesign.github.io/html-elements-names/) containing list items.<br/> <u>Example</u>\n```gherkin\nThen I should see a list named "test-list" and containing\n| First element |\n| Second element |\n| Third element |\n```
390
+ * */
391
+ (0, cypress_cucumber_preprocessor_1.Then)(`I should see a grid named {string} and containing`, function (expectedListName, pExpectedElementsOfList) {
392
+ const expectedElementsOfList = (0, __common_1.removeHeaderSeparatorLine)(pExpectedElementsOfList);
393
+ cy.uuvFindByRole("grid", { name: expectedListName })
394
+ .uuvFoundedElement()
395
+ .should("exist")
396
+ .within(() => {
397
+ (0, __common_1.expectTableToHaveContent)(expectedElementsOfList, "gridcell");
398
+ });
399
+ });
400
+ /**
401
+ * Checks that there is a table with the specified [name](https://russmaxdesign.github.io/html-elements-names/) containing list items.<br/> <u>Example</u>\n```gherkin\nThen I should see a list named "test-list" and containing\n| First element |\n| Second element |\n| Third element |\n```
402
+ * */
403
+ (0, cypress_cucumber_preprocessor_1.Then)(`I should see a table named {string} and containing`, function (expectedListName, pExpectedElementsOfList) {
404
+ const expectedElementsOfList = (0, __common_1.removeHeaderSeparatorLine)(pExpectedElementsOfList);
405
+ cy.uuvFindByRole("table", { name: expectedListName })
406
+ .uuvFoundedElement()
407
+ .should("exist")
408
+ .within(() => {
409
+ (0, __common_1.expectTableToHaveContent)(expectedElementsOfList, "cell");
410
+ });
411
+ });
388
412
  /**
389
413
  * Checks Html attributes of the selected element
390
414
  * */
@@ -385,6 +385,30 @@ const __common_1 = require("./../_.common");
385
385
  });
386
386
  });
387
387
  });
388
+ /**
389
+ * Vérifie qu'il existe une liste avec le nom et les éléments de liste spécifiés.<br/> <u>Exemple</u>\n```gherkin\nAlors je dois voir une liste nommée "test-list" et contenant\n| Premier élément |\n| Deuxième élément |\n| Troisième élément |\n```
390
+ * */
391
+ (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir une grille nommée {string} et contenant`, function (expectedListName, pExpectedElementsOfList) {
392
+ const expectedElementsOfList = (0, __common_1.removeHeaderSeparatorLine)(pExpectedElementsOfList);
393
+ cy.uuvFindByRole("grid", { name: expectedListName })
394
+ .uuvFoundedElement()
395
+ .should("exist")
396
+ .within(() => {
397
+ (0, __common_1.expectTableToHaveContent)(expectedElementsOfList, "gridcell");
398
+ });
399
+ });
400
+ /**
401
+ * Vérifie qu'il existe une liste avec le nom et les éléments de liste spécifiés.<br/> <u>Exemple</u>\n```gherkin\nAlors je dois voir une liste nommée "test-list" et contenant\n| Premier élément |\n| Deuxième élément |\n| Troisième élément |\n```
402
+ * */
403
+ (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir un tableau nommé {string} et contenant`, function (expectedListName, pExpectedElementsOfList) {
404
+ const expectedElementsOfList = (0, __common_1.removeHeaderSeparatorLine)(pExpectedElementsOfList);
405
+ cy.uuvFindByRole("table", { name: expectedListName })
406
+ .uuvFoundedElement()
407
+ .should("exist")
408
+ .within(() => {
409
+ (0, __common_1.expectTableToHaveContent)(expectedElementsOfList, "cell");
410
+ });
411
+ });
388
412
  /**
389
413
  * Vérifie des attributs Html de l'élément sélectionné
390
414
  * */
@@ -22,19 +22,19 @@ const core_engine_1 = require("../../../core-engine");
22
22
  /**
23
23
  * Sélectionne l'élément ayant le rôle table et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) sont spécifiés <br />⚠ pensez à déselectionner l'élement avec <b>[je reinitialise le contexte](#je-reinitialise-le-contexte)</b> si vous n'agissez plus dessus
24
24
  * */
25
- (0, cypress_cucumber_preprocessor_1.When)(`je vais à l'intérieur de la tableau nommée {string}`, function (name) {
25
+ (0, cypress_cucumber_preprocessor_1.When)(`je vais à l'intérieur du tableau nommé {string}`, function (name) {
26
26
  (0, core_engine_1.withinRoleAndName)("table", name);
27
27
  });
28
28
  /**
29
29
  * Vérifie l'existence d'un élément Html ayant le rôle table et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) spécifiés
30
30
  * */
31
- (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir une tableau nommée {string}`, function (name) {
31
+ (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir un tableau nommé {string}`, function (name) {
32
32
  (0, core_engine_1.findWithRoleAndName)("table", name);
33
33
  });
34
34
  /**
35
35
  * Vérifie l'inexistence d'un élément Html ayant le rôle table et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) spécifiés
36
36
  * */
37
- (0, cypress_cucumber_preprocessor_1.Then)(`je ne dois pas voir une tableau nommée {string}`, function (name) {
37
+ (0, cypress_cucumber_preprocessor_1.Then)(`je ne dois pas voir un tableau nommé {string}`, function (name) {
38
38
  (0, core_engine_1.notFoundWithRoleAndName)("table", name);
39
39
  });
40
40
  // End of General Section
@@ -42,13 +42,13 @@ const core_engine_1 = require("../../../core-engine");
42
42
  /**
43
43
  * Saisie de la phrase passée en paramètre dans le champ spécifié (utile par exemple pour remplir un champ de formulaire).
44
44
  * */
45
- (0, cypress_cucumber_preprocessor_1.When)(`je saisie le(s) mot(s) {string} dans le tableau nommée {string}`, function (textToType, name) {
45
+ (0, cypress_cucumber_preprocessor_1.When)(`je saisie le(s) mot(s) {string} dans le tableau nommé {string}`, function (textToType, name) {
46
46
  cy.uuvFindByRole("table", { name: name }).uuvFoundedElement().type(textToType);
47
47
  });
48
48
  /**
49
49
  * Saisie de la phrase passée en paramètre dans le champ spécifié (utile par exemple pour remplir un champ de formulaire).
50
50
  * */
51
- (0, cypress_cucumber_preprocessor_1.When)(`j'entre la valeur {string} dans le tableau nommée {string}`, function (textToType, name) {
51
+ (0, cypress_cucumber_preprocessor_1.When)(`j'entre la valeur {string} dans le tableau nommé {string}`, function (textToType, name) {
52
52
  cy.uuvFindByRole("table", { name: name }).uuvFoundedElement().type(textToType);
53
53
  });
54
54
  // End of Type Section
@@ -56,19 +56,19 @@ const core_engine_1 = require("../../../core-engine");
56
56
  /**
57
57
  * Vérifie l'existence d'un élément Html ayant le rôle table, le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) et le contenu spécifiés
58
58
  * */
59
- (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir une tableau nommée {string} et contenant {string}`, function (name, expectedTextContent) {
59
+ (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir un tableau nommé {string} et contenant {string}`, function (name, expectedTextContent) {
60
60
  (0, core_engine_1.findWithRoleAndNameAndContent)("table", name, expectedTextContent);
61
61
  });
62
62
  /**
63
63
  * Vérifie l'existence d'un élément Html ayant le rôle table, le [nom accessible](https://russmaxdesign.github.io/html-elements-names/), le contenu spécifiés et avec l'attribut disabled à false
64
64
  * */
65
- (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir une tableau nommée {string} et contenant {string} inactif`, function (name, expectedTextContent) {
65
+ (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir un tableau nommé {string} et contenant {string} inactif`, function (name, expectedTextContent) {
66
66
  (0, core_engine_1.findWithRoleAndNameAndContentDisable)("table", name, expectedTextContent);
67
67
  });
68
68
  /**
69
69
  * Vérifie l'existence d'un élément Html ayant le rôle table, le [nom accessible](https://russmaxdesign.github.io/html-elements-names/), le contenu spécifiés et avec l'attribut disabled à true
70
70
  * */
71
- (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir une tableau nommée {string} et contenant {string} actif`, function (name, expectedTextContent) {
71
+ (0, cypress_cucumber_preprocessor_1.Then)(`je dois voir un tableau nommé {string} et contenant {string} actif`, function (name, expectedTextContent) {
72
72
  (0, core_engine_1.findWithRoleAndNameAndContentEnable)("table", name, expectedTextContent);
73
73
  });
74
74
  // End of Content Section
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuv/cypress",
3
- "version": "2.57.0",
3
+ "version": "2.58.0",
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 facilitate the writing and execution of E2E tests understandable by any human being using cucumber(BDD) and cypress",
@@ -48,7 +48,7 @@
48
48
  "@cypress/webpack-preprocessor": "6.0.4",
49
49
  "@testing-library/cypress": "10.0.3",
50
50
  "@uuv/a11y": "1.0.0-beta.71",
51
- "@uuv/runner-commons": "2.51.0",
51
+ "@uuv/runner-commons": "2.52.0",
52
52
  "axe-core": "4.10.3",
53
53
  "chai-subset": "^1.6.0",
54
54
  "cypress": "14.4.0",
@@ -32,7 +32,7 @@ import {
32
32
  withinRoleAndName
33
33
  } from "../core-engine";
34
34
  import { A11yReferenceEnum } from "@uuv/a11y";
35
- import { pressKey } from "./../_.common";
35
+ import { expectTableToHaveContent, pressKey, removeHeaderSeparatorLine } from "./../_.common";
36
36
 
37
37
  /**
38
38
  * Navigate to the Uri passed as a argument (full url consisting of the BASE_URL + Uri) or navigate to Url if begin with http:// or https://
@@ -488,6 +488,38 @@ Then(
488
488
  }
489
489
  );
490
490
 
491
+ /**
492
+ * Checks that there is a list with the specified [name](https://russmaxdesign.github.io/html-elements-names/) containing list items.<br/> <u>Example</u>\n```gherkin\nThen I should see a list named "test-list" and containing\n| First element |\n| Second element |\n| Third element |\n```
493
+ * */
494
+ Then(
495
+ `I should see a grid named {string} and containing`,
496
+ function(expectedListName: string, pExpectedElementsOfList: DataTable) {
497
+ const expectedElementsOfList = removeHeaderSeparatorLine(pExpectedElementsOfList);
498
+ cy.uuvFindByRole("grid", { name: expectedListName })
499
+ .uuvFoundedElement()
500
+ .should("exist")
501
+ .within(() => {
502
+ expectTableToHaveContent(expectedElementsOfList, "gridcell");
503
+ });
504
+ }
505
+ );
506
+
507
+ /**
508
+ * Checks that there is a table with the specified [name](https://russmaxdesign.github.io/html-elements-names/) containing list items.<br/> <u>Example</u>\n```gherkin\nThen I should see a list named "test-list" and containing\n| First element |\n| Second element |\n| Third element |\n```
509
+ * */
510
+ Then(
511
+ `I should see a table named {string} and containing`,
512
+ function(expectedListName: string, pExpectedElementsOfList: DataTable) {
513
+ const expectedElementsOfList = removeHeaderSeparatorLine(pExpectedElementsOfList);
514
+ cy.uuvFindByRole("table", { name: expectedListName })
515
+ .uuvFoundedElement()
516
+ .should("exist")
517
+ .within(() => {
518
+ expectTableToHaveContent(expectedElementsOfList, "cell");
519
+ });
520
+ }
521
+ );
522
+
491
523
  /**
492
524
  * Checks Html attributes of the selected element
493
525
  * */
@@ -32,7 +32,7 @@ import {
32
32
  withinRoleAndName
33
33
  } from "../core-engine";
34
34
  import { A11yReferenceEnum } from "@uuv/a11y";
35
- import { pressKey } from "./../_.common";
35
+ import { expectTableToHaveContent, pressKey, removeHeaderSeparatorLine } from "./../_.common";
36
36
 
37
37
  /**
38
38
  * Navigue vers l'Uri passé en paramètre (url complète étant constituée de la BASE_URL + Uri) ou navigue vers l'Url si ça commence par http:// ou https://
@@ -488,6 +488,38 @@ Then(
488
488
  }
489
489
  );
490
490
 
491
+ /**
492
+ * Vérifie qu'il existe une liste avec le nom et les éléments de liste spécifiés.<br/> <u>Exemple</u>\n```gherkin\nAlors je dois voir une liste nommée "test-list" et contenant\n| Premier élément |\n| Deuxième élément |\n| Troisième élément |\n```
493
+ * */
494
+ Then(
495
+ `je dois voir une grille nommée {string} et contenant`,
496
+ function(expectedListName: string, pExpectedElementsOfList: DataTable) {
497
+ const expectedElementsOfList = removeHeaderSeparatorLine(pExpectedElementsOfList);
498
+ cy.uuvFindByRole("grid", { name: expectedListName })
499
+ .uuvFoundedElement()
500
+ .should("exist")
501
+ .within(() => {
502
+ expectTableToHaveContent(expectedElementsOfList, "gridcell");
503
+ });
504
+ }
505
+ );
506
+
507
+ /**
508
+ * Vérifie qu'il existe une liste avec le nom et les éléments de liste spécifiés.<br/> <u>Exemple</u>\n```gherkin\nAlors je dois voir une liste nommée "test-list" et contenant\n| Premier élément |\n| Deuxième élément |\n| Troisième élément |\n```
509
+ * */
510
+ Then(
511
+ `je dois voir un tableau nommé {string} et contenant`,
512
+ function(expectedListName: string, pExpectedElementsOfList: DataTable) {
513
+ const expectedElementsOfList = removeHeaderSeparatorLine(pExpectedElementsOfList);
514
+ cy.uuvFindByRole("table", { name: expectedListName })
515
+ .uuvFoundedElement()
516
+ .should("exist")
517
+ .within(() => {
518
+ expectTableToHaveContent(expectedElementsOfList, "cell");
519
+ });
520
+ }
521
+ );
522
+
491
523
  /**
492
524
  * Vérifie des attributs Html de l'élément sélectionné
493
525
  * */
@@ -36,14 +36,14 @@ import { pressKey } from "../../../_.common";
36
36
  /**
37
37
  * Sélectionne l'élément ayant le rôle table et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) sont spécifiés <br />⚠ pensez à déselectionner l'élement avec <b>[je reinitialise le contexte](#je-reinitialise-le-contexte)</b> si vous n'agissez plus dessus
38
38
  * */
39
- When(`je vais à l'intérieur de la tableau nommée {string}`, function(name: string) {
39
+ When(`je vais à l'intérieur du tableau nommé {string}`, function(name: string) {
40
40
  withinRoleAndName("table", name);
41
41
  });
42
42
 
43
43
  /**
44
44
  * Vérifie l'existence d'un élément Html ayant le rôle table et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) spécifiés
45
45
  * */
46
- Then(`je dois voir une tableau nommée {string}`, function(name: string) {
46
+ Then(`je dois voir un tableau nommé {string}`, function(name: string) {
47
47
  findWithRoleAndName("table", name);
48
48
  });
49
49
 
@@ -51,7 +51,7 @@ Then(`je dois voir une tableau nommée {string}`, function(name: string) {
51
51
  * Vérifie l'inexistence d'un élément Html ayant le rôle table et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) spécifiés
52
52
  * */
53
53
  Then(
54
- `je ne dois pas voir une tableau nommée {string}`,
54
+ `je ne dois pas voir un tableau nommé {string}`,
55
55
  function(name: string) {
56
56
  notFoundWithRoleAndName("table", name);
57
57
  }
@@ -64,14 +64,14 @@ Then(
64
64
  /**
65
65
  * Saisie de la phrase passée en paramètre dans le champ spécifié (utile par exemple pour remplir un champ de formulaire).
66
66
  * */
67
- When(`je saisie le(s) mot(s) {string} dans le tableau nommée {string}`, function(textToType: string, name: string) {
67
+ When(`je saisie le(s) mot(s) {string} dans le tableau nommé {string}`, function(textToType: string, name: string) {
68
68
  cy.uuvFindByRole("table", { name: name }).uuvFoundedElement().type(textToType);
69
69
  });
70
70
 
71
71
  /**
72
72
  * Saisie de la phrase passée en paramètre dans le champ spécifié (utile par exemple pour remplir un champ de formulaire).
73
73
  * */
74
- When(`j'entre la valeur {string} dans le tableau nommée {string}`, function(textToType: string, name: string) {
74
+ When(`j'entre la valeur {string} dans le tableau nommé {string}`, function(textToType: string, name: string) {
75
75
  cy.uuvFindByRole("table", { name: name }).uuvFoundedElement().type(textToType);
76
76
  });
77
77
 
@@ -82,7 +82,7 @@ When(`j'entre la valeur {string} dans le tableau nommée {string}`, function(tex
82
82
  * Vérifie l'existence d'un élément Html ayant le rôle table, le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) et le contenu spécifiés
83
83
  * */
84
84
  Then(
85
- `je dois voir une tableau nommée {string} et contenant {string}`,
85
+ `je dois voir un tableau nommé {string} et contenant {string}`,
86
86
  function(name: string, expectedTextContent: string) {
87
87
  findWithRoleAndNameAndContent("table", name, expectedTextContent);
88
88
  }
@@ -92,7 +92,7 @@ Then(
92
92
  * Vérifie l'existence d'un élément Html ayant le rôle table, le [nom accessible](https://russmaxdesign.github.io/html-elements-names/), le contenu spécifiés et avec l'attribut disabled à false
93
93
  * */
94
94
  Then(
95
- `je dois voir une tableau nommée {string} et contenant {string} inactif`,
95
+ `je dois voir un tableau nommé {string} et contenant {string} inactif`,
96
96
  function(name: string, expectedTextContent: string) {
97
97
  findWithRoleAndNameAndContentDisable("table", name, expectedTextContent);
98
98
  }
@@ -102,7 +102,7 @@ Then(
102
102
  * Vérifie l'existence d'un élément Html ayant le rôle table, le [nom accessible](https://russmaxdesign.github.io/html-elements-names/), le contenu spécifiés et avec l'attribut disabled à true
103
103
  * */
104
104
  Then(
105
- `je dois voir une tableau nommée {string} et contenant {string} actif`,
105
+ `je dois voir un tableau nommé {string} et contenant {string} actif`,
106
106
  function(name: string, expectedTextContent: string) {
107
107
  findWithRoleAndNameAndContentEnable("table", name, expectedTextContent);
108
108
  }