@uuv/cypress 2.2.1 → 2.4.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,23 @@
1
+ ## [2.4.0](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v2.3.0...runner-cypress-v2.4.0) (2024-01-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * **a11y:** add a contains sentence for a11y rgaa, [#424](https://github.com/Orange-OpenSource/uuv/issues/424) ([84d11c4](https://github.com/Orange-OpenSource/uuv/commit/84d11c46858970ce51eae28e8f74190c229c031e))
7
+ * **a11y:** add a contains sentence for a11y rgaa, [#424](https://github.com/Orange-OpenSource/uuv/issues/424) ([297cc33](https://github.com/Orange-OpenSource/uuv/commit/297cc3378798d1eb9c973a2038423ae6f874f70f))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * replace cy.uuvFindAllByRole by cy.findAllByRole to find listitem, [#340](https://github.com/Orange-OpenSource/uuv/issues/340) ([31c27cc](https://github.com/Orange-OpenSource/uuv/commit/31c27cc7cdcc81708700df147b7f0196e232e6af))
13
+
14
+ ## [2.3.0](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v2.2.1...runner-cypress-v2.3.0) (2024-01-08)
15
+
16
+
17
+ ### Features
18
+
19
+ * **a11y:** reduce @uuv/a11y bundle size, [#330](https://github.com/Orange-OpenSource/uuv/issues/330) ([139b85a](https://github.com/Orange-OpenSource/uuv/commit/139b85a56e2ce4b8f370df4f6d410a9a1807e3b6))
20
+
1
21
  ## [2.2.1](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v2.2.0...runner-cypress-v2.2.1) (2024-01-08)
2
22
 
3
23
 
package/CONTRIBUTING.md CHANGED
@@ -1,79 +1,6 @@
1
1
  # Contributors guide
2
2
 
3
- **Want to contribute?**
4
- We try to make it easy, and all contributions, even the smaller ones, are more than welcome.
5
- This includes bug reports, fixes, documentation, examples...
6
- But first, read this page (including the small print at the end).
3
+ First, read the general [CONTRIBUTING](../../CONTRIBUTING.md) file
7
4
 
8
- Contributions are available on https://github.com/Orange-OpenSource/uuv
9
-
10
- ## Legal
11
-
12
- All original contributions to _UUV_ are licensed under the
13
- [MIT License](https://spdx.org/licenses/MIT.html)
14
-
15
- All contributions are subject to the [Developer Certificate of Origin](https://developercertificate.org/) (DCO).
16
- The DCO is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project.
17
- The DCO text is also included verbatim in the [DCO.txt](DCO.txt) file in the root directory of the repository.
18
-
19
- Contributors **must** _sign-off_ that they adhere to these requirements by adding a `Signed-off-by` line to commit messages, as shown below:
20
-
21
- ```text
22
- This is the commit message
23
-
24
- Signed-off-by: Joe Dev <joe.dev@developer.example.org>
25
- ```
26
-
27
- Git has a handy [`-s` command line option](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) to append this automatically to your commit message:
28
-
29
- ```bash
30
- $ git commit -s -m 'This is the commit message'
31
- ```
32
-
33
- ## Reporting an issue
34
-
35
- This project uses Github issues to manage the issues.
36
-
37
- Before creating an issue:
38
-
39
- 1. upgrade your project to the latest released template version, and check whether your bug is still present,
40
- 2. have a look in the opened issues if your problem is already known/tracked, and possibly contribute to the thread with your own information.
41
-
42
- If none of the above was met, open an issue directly in Github, select the appropriate issue template and fill-in each section when applicable.
43
-
44
- ## Submitting a code change
45
-
46
- ### Git Setup
47
-
48
- Before contributing, make sure you have set up your Git authorship correctly:
49
-
50
- ```bash
51
- git config --global user.name "Your Full Name"
52
- git config --global user.email your.email@example.com
53
- ```
54
-
55
- ### Workflow
56
-
57
- All submissions, including submissions by project members, need to be reviewed before being merged.
58
-
59
- To contribute:
60
-
61
- 1. Create an issue describing the bug or enhancement you want to propose (select the right issue template).
62
- 2. Make sure the issue has been reviewed and agreed.
63
- 3. Create a Merge Request, from your **own** fork (see [forking workflow](https://docs.github.com/en/get-started/quickstart/fork-a-repo) documentation).
64
- Don't hesitate to mark your MR as `Draft` as long as you think it's not ready to be reviewed.
65
-
66
- ### Git Commit Conventions
67
-
68
- In addition to being signed-off according the [Developer Certificate of Origin](https://developercertificate.org/) (see above),
69
- Git commits in _UUV_ shall be:
70
-
71
- 1. **atomic** (1 commit `=` 1 and only 1 _thing_),
72
- 2. **semantic** (using [semantic-release commit message syntax](https://semantic-release.gitbook.io/semantic-release/#commit-message-format)).
73
- 3. **pattern**
74
- - **SCOPE**: one of (build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test, release)
75
- - **PACKAGE** _(optional)_: one of (assistant, assistant-electron, docs, intellij-plugin, runner-commons, runner-cypress, runner-playwright)
76
- - **Pattern**: SCOPE(PACKAGE): commit message, #issue_identifier
77
- - ```bash
78
- perf(runner-cypress): optimize bdd request, #51
79
- ```
5
+ ## How Contribue to @uuv/runner-cypress ?
6
+ TODO
@@ -14,4 +14,4 @@
14
14
  */
15
15
  import { A11yReferenceEnum } from "@uuv/a11y";
16
16
  export declare const injectUvvA11y: () => void;
17
- export declare const checkUvvA11y: (reference: A11yReferenceEnum, expectedResult?: any) => void;
17
+ export declare const checkUvvA11y: (reference: A11yReferenceEnum, expectedResult?: any, isContainsMode?: boolean) => void;
@@ -31,7 +31,7 @@ const injectUvvA11y = () => {
31
31
  }));
32
32
  };
33
33
  exports.injectUvvA11y = injectUvvA11y;
34
- const checkUvvA11y = (reference, expectedResult) => {
34
+ const checkUvvA11y = (reference, expectedResult, isContainsMode = false) => {
35
35
  cy.window({ log: false })
36
36
  .then((win) => {
37
37
  const url = win.location.href;
@@ -40,7 +40,7 @@ const checkUvvA11y = (reference, expectedResult) => {
40
40
  return rgaaChecker?.validate()
41
41
  .pipe((0, rxjs_1.tap)((result) => {
42
42
  logAllA11yRuleResult(result);
43
- assertWithExpectedResult(expectedResult, result);
43
+ assertWithExpectedResult(result, expectedResult, isContainsMode);
44
44
  }))
45
45
  .toPromise();
46
46
  });
@@ -62,13 +62,20 @@ function getA11yCheckerForReference(win, reference, url) {
62
62
  }
63
63
  return rgaaChecker;
64
64
  }
65
- function assertWithExpectedResult(expectedResult, result) {
65
+ function assertWithExpectedResult(result, expectedResult, isContainsMode = false) {
66
+ const validationFailedMessage = "A11y validation failed";
66
67
  if (expectedResult) {
67
- assert.deepEqual(result.summary(), expectedResult, "A11y validation failed");
68
+ if (!isContainsMode) {
69
+ assert.deepEqual(result.summary(), expectedResult, validationFailedMessage);
70
+ }
71
+ else {
72
+ cy.wrap(result.summary())
73
+ .should("containSubset", expectedResult);
74
+ }
68
75
  }
69
76
  else {
70
- assert.notEqual(result.status, a11y_1.A11yResultStatus.ERROR, "A11y validation failed");
71
- assert.notEqual(result.status, a11y_1.A11yResultStatus.UNKNOWN, "A11y validation failed");
77
+ assert.notEqual(result.status, a11y_1.A11yResultStatus.ERROR, validationFailedMessage);
78
+ assert.notEqual(result.status, a11y_1.A11yResultStatus.UNKNOWN, validationFailedMessage);
72
79
  }
73
80
  }
74
81
  function logAllA11yRuleResult(result) {
@@ -325,7 +325,7 @@ const a11y_1 = require("@uuv/a11y");
325
325
  .uuvFoundedElement()
326
326
  .should("exist")
327
327
  .within(() => {
328
- return cy.uuvFindAllByRole("listitem", {}).then((listitem) => {
328
+ return cy.findAllByRole("listitem", {}).then((listitem) => {
329
329
  const foundedElement = [];
330
330
  for (let i = 0; i < listitem.length; i++) {
331
331
  foundedElement.push([listitem[i].textContent]);
@@ -414,45 +414,20 @@ const a11y_1 = require("@uuv/a11y");
414
414
  });
415
415
  });
416
416
  /**
417
- * Check that the current page have no [accessibility issue](https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/) with one of reference : RGAA
417
+ * Check that the current page have no [accessibility issue](https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/) based on RGAA standards
418
418
  * */
419
419
  (0, cypress_cucumber_preprocessor_1.Then)(`I should not have any rgaa accessibility issue`, async function () {
420
420
  cy.injectUvvA11y();
421
421
  cy.checkUvvA11y(a11y_1.A11yReferenceEnum.RGAA);
422
- // const versionAlix = "5.2.1";
423
- // cy.url().then(async (url) => {
424
- // const rgaaChecker = new RgaaChecker(url);
425
- // return rgaaChecker.validate()
426
- // .pipe(
427
- // tap((result: A11yResult) => {
428
- // result.ruleResults.forEach(ruleResult => {
429
- // logValidatingA11yRule(result.reference, ruleResult);
430
- // logA11yRuleResult(result.reference, ruleResult);
431
- // });
432
- // assert.equal(result.status, A11yResultStatus.SUCCESS, "A11y validation failed");
433
- // })
434
- // )
435
- // .toPromise();
436
- // switch (reference) {
437
- // case "RGAA":
438
- // await new RgaaChecker(url, a11yCypressEngine).checkCriteria();
439
- // // new AlixError(versionAlix).checkCriteria();
440
- // // new AlixWarning(versionAlix).checkCriteria();
441
- // // new AlixAdvice(versionAlix).checkCriteria();
442
- // // new AlixObsolete(versionAlix).checkCriteria();
443
- // case "WCAG-WEB":
444
- // break;
445
- // case "WCAG-ANDROID":
446
- // break;
447
- // case "WCAG-IOS":
448
- // break;
449
- // }
450
- // });
451
422
  });
452
423
  (0, cypress_cucumber_preprocessor_1.Then)(`I should have the following result based on the rgaa reference`, async function (expectedResult) {
453
424
  cy.injectUvvA11y();
454
425
  cy.checkUvvA11y(a11y_1.A11yReferenceEnum.RGAA, JSON.parse(expectedResult));
455
426
  });
427
+ (0, cypress_cucumber_preprocessor_1.Then)(`I should have the following partial result based on the rgaa reference`, async function (expectedResult) {
428
+ cy.injectUvvA11y();
429
+ cy.checkUvvA11y(a11y_1.A11yReferenceEnum.RGAA, JSON.parse(expectedResult), true);
430
+ });
456
431
  function pressKey(context, key) {
457
432
  switch (key) {
458
433
  case runner_commons_1.KEY_PRESS.TAB:
@@ -325,7 +325,7 @@ const a11y_1 = require("@uuv/a11y");
325
325
  .uuvFoundedElement()
326
326
  .should("exist")
327
327
  .within(() => {
328
- return cy.uuvFindAllByRole("listitem", {}).then((listitem) => {
328
+ return cy.findAllByRole("listitem", {}).then((listitem) => {
329
329
  const foundedElement = [];
330
330
  for (let i = 0; i < listitem.length; i++) {
331
331
  foundedElement.push([listitem[i].textContent]);
@@ -414,45 +414,20 @@ const a11y_1 = require("@uuv/a11y");
414
414
  });
415
415
  });
416
416
  /**
417
- * Vérifie sur la page courante qu'il n'y a aucune [erreur de conformité d'accessibilité](https://la-va11ydette.orange.com) avec un des référentiels : WCAG-WEB, RGAA et une des versions 4.1
417
+ * Vérifie sur la page courante qu'il n'y a aucune [erreur de conformité d'accessibilité](https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests) avec un des référentiels : WCAG-WEB, RGAA et une des versions 4.1
418
418
  * */
419
419
  (0, cypress_cucumber_preprocessor_1.Then)(`je ne dois pas avoir de problèmes d'accessibilité rgaa`, async function () {
420
420
  cy.injectUvvA11y();
421
421
  cy.checkUvvA11y(a11y_1.A11yReferenceEnum.RGAA);
422
- // const versionAlix = "5.2.1";
423
- // cy.url().then(async (url) => {
424
- // const rgaaChecker = new RgaaChecker(url);
425
- // return rgaaChecker.validate()
426
- // .pipe(
427
- // tap((result: A11yResult) => {
428
- // result.ruleResults.forEach(ruleResult => {
429
- // logValidatingA11yRule(result.reference, ruleResult);
430
- // logA11yRuleResult(result.reference, ruleResult);
431
- // });
432
- // assert.equal(result.status, A11yResultStatus.SUCCESS, "A11y validation failed");
433
- // })
434
- // )
435
- // .toPromise();
436
- // switch (reference) {
437
- // case "RGAA":
438
- // await new RgaaChecker(url, a11yCypressEngine).checkCriteria();
439
- // // new AlixError(versionAlix).checkCriteria();
440
- // // new AlixWarning(versionAlix).checkCriteria();
441
- // // new AlixAdvice(versionAlix).checkCriteria();
442
- // // new AlixObsolete(versionAlix).checkCriteria();
443
- // case "WCAG-WEB":
444
- // break;
445
- // case "WCAG-ANDROID":
446
- // break;
447
- // case "WCAG-IOS":
448
- // break;
449
- // }
450
- // });
451
422
  });
452
423
  (0, cypress_cucumber_preprocessor_1.Then)(`je dois avoir les résultats suivants selon le référentiel rgaa`, async function (expectedResult) {
453
424
  cy.injectUvvA11y();
454
425
  cy.checkUvvA11y(a11y_1.A11yReferenceEnum.RGAA, JSON.parse(expectedResult));
455
426
  });
427
+ (0, cypress_cucumber_preprocessor_1.Then)(`je dois avoir les résultats partiels suivants selon le référentiel rgaa`, async function (expectedResult) {
428
+ cy.injectUvvA11y();
429
+ cy.checkUvvA11y(a11y_1.A11yReferenceEnum.RGAA, JSON.parse(expectedResult), true);
430
+ });
456
431
  function pressKey(context, key) {
457
432
  switch (key) {
458
433
  case runner_commons_1.KEY_PRESS.TAB:
@@ -31,7 +31,7 @@ declare global {
31
31
  uuvFindAllByRole(role: string, roleOptions: ByRoleOptions): Cypress.Chainable<JQuery<HTMLElement>>;
32
32
  uuvFoundedElement(): Cypress.Chainable<JQuery<HTMLElement>>;
33
33
  injectUvvA11y(): Cypress.Chainable<void>;
34
- checkUvvA11y(reference: A11yReferenceEnum, expectedResult?: any): Cypress.Chainable<A11yResult>;
34
+ checkUvvA11y(reference: A11yReferenceEnum, expectedResult?: any, isContainsMode?: boolean): Cypress.Chainable<A11yResult>;
35
35
  }
36
36
  }
37
37
  }
@@ -31,3 +31,5 @@ Cypress.Commands.add("uuvFindAllByRole", __common_1.uuvFindAllByRole);
31
31
  Cypress.Commands.add("uuvFoundedElement", { prevSubject: true }, __common_1.uuvFoundedElement);
32
32
  Cypress.Commands.add("injectUvvA11y", a11y_engine_1.injectUvvA11y);
33
33
  Cypress.Commands.add("checkUvvA11y", a11y_engine_1.checkUvvA11y);
34
+ const chaiSubset = require("chai-subset");
35
+ chai.use(chaiSubset);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuv/cypress",
3
- "version": "2.2.1",
3
+ "version": "2.4.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",
@@ -46,9 +46,10 @@
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/a11y": "1.0.0-beta.2",
50
- "@uuv/runner-commons": "2.2.0",
49
+ "@uuv/a11y": "1.0.0-beta.4",
50
+ "@uuv/runner-commons": "2.4.0",
51
51
  "axe-core": "4.8.2",
52
+ "chai-subset": "^1.6.0",
52
53
  "chalk": "4.1.2",
53
54
  "cucumber-json-report-formatter": "0.1.4",
54
55
  "cypress": "12.17.4",
@@ -407,7 +407,7 @@ Then(
407
407
  .uuvFoundedElement()
408
408
  .should("exist")
409
409
  .within(() => {
410
- return cy.uuvFindAllByRole("listitem", {}).then((listitem) => {
410
+ return cy.findAllByRole("listitem", {}).then((listitem) => {
411
411
  const foundedElement: any[] = [];
412
412
  for (let i = 0; i < listitem.length; i++) {
413
413
  foundedElement.push([listitem[i].textContent]);
@@ -526,42 +526,13 @@ Then(
526
526
 
527
527
 
528
528
  /**
529
- * Check that the current page have no [accessibility issue](https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/) with one of reference : RGAA
529
+ * Check that the current page have no [accessibility issue](https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/) based on RGAA standards
530
530
  * */
531
531
  Then(
532
532
  `I should not have any rgaa accessibility issue`,
533
533
  async function() {
534
534
  cy.injectUvvA11y();
535
535
  cy.checkUvvA11y(A11yReferenceEnum.RGAA);
536
- // const versionAlix = "5.2.1";
537
- // cy.url().then(async (url) => {
538
- // const rgaaChecker = new RgaaChecker(url);
539
- // return rgaaChecker.validate()
540
- // .pipe(
541
- // tap((result: A11yResult) => {
542
- // result.ruleResults.forEach(ruleResult => {
543
- // logValidatingA11yRule(result.reference, ruleResult);
544
- // logA11yRuleResult(result.reference, ruleResult);
545
- // });
546
- // assert.equal(result.status, A11yResultStatus.SUCCESS, "A11y validation failed");
547
- // })
548
- // )
549
- // .toPromise();
550
- // switch (reference) {
551
- // case "RGAA":
552
- // await new RgaaChecker(url, a11yCypressEngine).checkCriteria();
553
- // // new AlixError(versionAlix).checkCriteria();
554
- // // new AlixWarning(versionAlix).checkCriteria();
555
- // // new AlixAdvice(versionAlix).checkCriteria();
556
- // // new AlixObsolete(versionAlix).checkCriteria();
557
- // case "WCAG-WEB":
558
- // break;
559
- // case "WCAG-ANDROID":
560
- // break;
561
- // case "WCAG-IOS":
562
- // break;
563
- // }
564
- // });
565
536
  });
566
537
 
567
538
  Then(
@@ -571,6 +542,13 @@ Then(
571
542
  cy.checkUvvA11y(A11yReferenceEnum.RGAA, JSON.parse(expectedResult));
572
543
  });
573
544
 
545
+ Then(
546
+ `I should have the following partial result based on the rgaa reference`,
547
+ async function(expectedResult: string) {
548
+ cy.injectUvvA11y();
549
+ cy.checkUvvA11y(A11yReferenceEnum.RGAA, JSON.parse(expectedResult), true);
550
+ });
551
+
574
552
  function pressKey(context: Cypress.Chainable<JQuery<HTMLElement>>, key: string) {
575
553
  switch (key) {
576
554
  case KEY_PRESS.TAB:
@@ -407,7 +407,7 @@ Then(
407
407
  .uuvFoundedElement()
408
408
  .should("exist")
409
409
  .within(() => {
410
- return cy.uuvFindAllByRole("listitem", {}).then((listitem) => {
410
+ return cy.findAllByRole("listitem", {}).then((listitem) => {
411
411
  const foundedElement: any[] = [];
412
412
  for (let i = 0; i < listitem.length; i++) {
413
413
  foundedElement.push([listitem[i].textContent]);
@@ -526,42 +526,13 @@ Then(
526
526
 
527
527
 
528
528
  /**
529
- * Vérifie sur la page courante qu'il n'y a aucune [erreur de conformité d'accessibilité](https://la-va11ydette.orange.com) avec un des référentiels : WCAG-WEB, RGAA et une des versions 4.1
529
+ * Vérifie sur la page courante qu'il n'y a aucune [erreur de conformité d'accessibilité](https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests) avec un des référentiels : WCAG-WEB, RGAA et une des versions 4.1
530
530
  * */
531
531
  Then(
532
532
  `je ne dois pas avoir de problèmes d'accessibilité rgaa`,
533
533
  async function() {
534
534
  cy.injectUvvA11y();
535
535
  cy.checkUvvA11y(A11yReferenceEnum.RGAA);
536
- // const versionAlix = "5.2.1";
537
- // cy.url().then(async (url) => {
538
- // const rgaaChecker = new RgaaChecker(url);
539
- // return rgaaChecker.validate()
540
- // .pipe(
541
- // tap((result: A11yResult) => {
542
- // result.ruleResults.forEach(ruleResult => {
543
- // logValidatingA11yRule(result.reference, ruleResult);
544
- // logA11yRuleResult(result.reference, ruleResult);
545
- // });
546
- // assert.equal(result.status, A11yResultStatus.SUCCESS, "A11y validation failed");
547
- // })
548
- // )
549
- // .toPromise();
550
- // switch (reference) {
551
- // case "RGAA":
552
- // await new RgaaChecker(url, a11yCypressEngine).checkCriteria();
553
- // // new AlixError(versionAlix).checkCriteria();
554
- // // new AlixWarning(versionAlix).checkCriteria();
555
- // // new AlixAdvice(versionAlix).checkCriteria();
556
- // // new AlixObsolete(versionAlix).checkCriteria();
557
- // case "WCAG-WEB":
558
- // break;
559
- // case "WCAG-ANDROID":
560
- // break;
561
- // case "WCAG-IOS":
562
- // break;
563
- // }
564
- // });
565
536
  });
566
537
 
567
538
  Then(
@@ -571,6 +542,13 @@ Then(
571
542
  cy.checkUvvA11y(A11yReferenceEnum.RGAA, JSON.parse(expectedResult));
572
543
  });
573
544
 
545
+ Then(
546
+ `je dois avoir les résultats partiels suivants selon le référentiel rgaa`,
547
+ async function(expectedResult: string) {
548
+ cy.injectUvvA11y();
549
+ cy.checkUvvA11y(A11yReferenceEnum.RGAA, JSON.parse(expectedResult), true);
550
+ });
551
+
574
552
  function pressKey(context: Cypress.Chainable<JQuery<HTMLElement>>, key: string) {
575
553
  switch (key) {
576
554
  case KEY_PRESS.TAB: