@uuv/runner-commons 2.9.1 → 2.10.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.10.0](https://github.com/Orange-OpenSource/uuv/compare/runner-commons-v2.9.1...runner-commons-v2.10.0) (2024-04-08)
2
+
3
+
4
+ ### Features
5
+
6
+ * add keyboard navigation sentences, [#493](https://github.com/Orange-OpenSource/uuv/issues/493) ([a6135ba](https://github.com/Orange-OpenSource/uuv/commit/a6135baf8c91866081bd3cec930cada4c94e21d4))
7
+
1
8
  ## [2.9.1](https://github.com/Orange-OpenSource/uuv/compare/runner-commons-v2.9.0...runner-commons-v2.9.1) (2024-04-04)
2
9
 
3
10
 
@@ -12,6 +12,12 @@
12
12
  "wording": "I should see $indefiniteArticle $roleName named {string}",
13
13
  "section": "general"
14
14
  },
15
+ {
16
+ "key": "key.then.element.withRoleAndNameFocused",
17
+ "description": "Checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused",
18
+ "wording": "I should see $indefiniteArticle $roleName named {string} keyboard focused",
19
+ "section": "keyboard"
20
+ },
15
21
  {
16
22
  "key": "key.then.element.not.withRoleAndName",
17
23
  "description": "Checks that an Html element does not exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/)",
@@ -18,7 +18,8 @@ class EnAccessibleRole extends accessible_role_1.AccessibleRole {
18
18
  indefiniteArticle;
19
19
  shouldGenerateTypeSentence;
20
20
  shouldGenerateContainsSentence;
21
- constructor(id, name, definiteArticle = DEFINITE_ARTICLE.THE, indefiniteArticle = INDEFINITE_ARTICLE.A, shouldGenerateTypeSentence = true, shouldGenerateContainsSentence = true) {
21
+ shouldGenerateKeyboardSentence;
22
+ constructor(id, name, definiteArticle = DEFINITE_ARTICLE.THE, indefiniteArticle = INDEFINITE_ARTICLE.A, shouldGenerateTypeSentence = true, shouldGenerateContainsSentence = true, shouldGenerateKeyboardSentence = false) {
22
23
  super();
23
24
  this.id = id;
24
25
  this.name = name;
@@ -26,9 +27,10 @@ class EnAccessibleRole extends accessible_role_1.AccessibleRole {
26
27
  this.indefiniteArticle = indefiniteArticle;
27
28
  this.shouldGenerateTypeSentence = shouldGenerateTypeSentence;
28
29
  this.shouldGenerateContainsSentence = shouldGenerateContainsSentence;
30
+ this.shouldGenerateKeyboardSentence = shouldGenerateKeyboardSentence;
29
31
  }
30
32
  static from(input) {
31
- return new EnAccessibleRole(input.id, input.name, input.definiteArticle, input.indefiniteArticle, input.shouldGenerateTypeSentence, input.shouldGenerateContainsSentence);
33
+ return new EnAccessibleRole(input.id, input.name, input.definiteArticle, input.indefiniteArticle, input.shouldGenerateTypeSentence, input.shouldGenerateContainsSentence, input.shouldGenerateKeyboardSentence);
32
34
  }
33
35
  getDefiniteArticle() {
34
36
  return this.definiteArticle.toString();
@@ -49,11 +51,11 @@ exports.EN_ROLES = [
49
51
  { id: "application", name: "application", indefiniteArticle: INDEFINITE_ARTICLE.AN },
50
52
  { id: "article", name: "article", indefiniteArticle: INDEFINITE_ARTICLE.AN },
51
53
  { id: "banner", name: "banner" },
52
- { id: "button", name: "button" },
54
+ { id: "button", name: "button", shouldGenerateKeyboardSentence: true },
53
55
  { id: "cell", name: "cell" },
54
- { id: "checkbox", name: "checkbox" },
56
+ { id: "checkbox", name: "checkbox", shouldGenerateKeyboardSentence: true },
55
57
  { id: "columnheader", name: "column header" },
56
- { id: "combobox", name: "combo box" },
58
+ { id: "combobox", name: "combo box", shouldGenerateKeyboardSentence: true },
57
59
  { id: "command", name: "command" },
58
60
  { id: "comment", name: "comment" },
59
61
  { id: "complementary", name: "complementary" },
@@ -72,11 +74,10 @@ exports.EN_ROLES = [
72
74
  { id: "group", name: "group" },
73
75
  { id: "heading", name: "title" },
74
76
  { id: "img", name: "picture" },
75
- { id: "input", name: "entry", indefiniteArticle: INDEFINITE_ARTICLE.AN },
76
77
  { id: "landmark", name: "landmark" },
77
- { id: "link", name: "link" },
78
+ { id: "link", name: "link", shouldGenerateKeyboardSentence: true },
78
79
  { id: "list", name: "list", shouldGenerateContainsSentence: false, shouldGenerateTypeSentence: false },
79
- { id: "listbox", name: "list box" },
80
+ { id: "listbox", name: "list box", shouldGenerateKeyboardSentence: true },
80
81
  { id: "listitem", name: "list item" },
81
82
  { id: "log", name: "log" },
82
83
  { id: "main", name: "main" },
@@ -84,9 +85,9 @@ exports.EN_ROLES = [
84
85
  { id: "math", name: "math" },
85
86
  { id: "menu", name: "menu" },
86
87
  { id: "menubar", name: "menubar" },
87
- { id: "menuitem", name: "menuitem" },
88
- { id: "menuitemcheckbox", name: "menuitemcheckbox" },
89
- { id: "menuitemradio", name: "menuitemradio" },
88
+ { id: "menuitem", name: "menuitem", shouldGenerateKeyboardSentence: true },
89
+ { id: "menuitemcheckbox", name: "menuitemcheckbox", shouldGenerateKeyboardSentence: true },
90
+ { id: "menuitemradio", name: "menuitemradio", shouldGenerateKeyboardSentence: true },
90
91
  { id: "meter", name: "counter" },
91
92
  { id: "navigation", name: "navigation" },
92
93
  { id: "none", name: "no" },
@@ -94,7 +95,7 @@ exports.EN_ROLES = [
94
95
  { id: "option", name: "option", indefiniteArticle: INDEFINITE_ARTICLE.AN },
95
96
  { id: "presentation", name: "presentation" },
96
97
  { id: "progressbar", name: "progress bar" },
97
- { id: "radio", name: "radio" },
98
+ { id: "radio", name: "radio", shouldGenerateKeyboardSentence: true },
98
99
  { id: "radiogroup", name: "radio group" },
99
100
  { id: "range", name: "range" },
100
101
  { id: "region", name: "region" },
@@ -103,30 +104,30 @@ exports.EN_ROLES = [
103
104
  { id: "rowgroup", name: "row group" },
104
105
  { id: "rowheader", name: "row header" },
105
106
  { id: "scrollbar", name: "scroll bar" },
106
- { id: "search", name: "search" },
107
- { id: "searchbox", name: "search box" },
107
+ { id: "search", name: "search", shouldGenerateKeyboardSentence: true },
108
+ { id: "searchbox", name: "search box", shouldGenerateKeyboardSentence: true },
108
109
  { id: "section", name: "section" },
109
110
  { id: "sectionhead", name: "section header" },
110
- { id: "select", name: "select" },
111
+ { id: "select", name: "select", shouldGenerateKeyboardSentence: true },
111
112
  { id: "separator", name: "separator" },
112
- { id: "slider", name: "slider" },
113
- { id: "spinbutton", name: "spin button" },
113
+ { id: "slider", name: "slider", shouldGenerateKeyboardSentence: true },
114
+ { id: "spinbutton", name: "spin button", shouldGenerateKeyboardSentence: true },
114
115
  { id: "status", name: "status" },
115
116
  { id: "structure", name: "structure" },
116
117
  { id: "suggestion", name: "suggestion" },
117
- { id: "switch", name: "switch" },
118
- { id: "tab", name: "tab" },
118
+ { id: "switch", name: "switch", shouldGenerateKeyboardSentence: true },
119
+ { id: "tab", name: "tab", shouldGenerateKeyboardSentence: true },
119
120
  { id: "table", name: "table" },
120
121
  { id: "tablist", name: "tablist" },
121
122
  { id: "tabpanel", name: "tabpanel" },
122
123
  { id: "term", name: "term" },
123
- { id: "textbox", name: "text box" },
124
+ { id: "textbox", name: "text box", shouldGenerateKeyboardSentence: true },
124
125
  { id: "timer", name: "timer" },
125
126
  { id: "toolbar", name: "toolbar" },
126
127
  { id: "tooltip", name: "tooltip" },
127
128
  { id: "tree", name: "tree" },
128
129
  { id: "treegrid", name: "tree grid" },
129
130
  { id: "treeitem", name: "tree item" },
130
- { id: "widget", name: "widget" },
131
+ { id: "widget", name: "widget", shouldGenerateKeyboardSentence: true },
131
132
  { id: "window", name: "window" }
132
133
  ].map(role => EnAccessibleRole.from(role));
@@ -54,6 +54,16 @@
54
54
  "description": "Press specified key multiple times using | as: num|{key}",
55
55
  "wording": "I press {int} times on {string}"
56
56
  },
57
+ {
58
+ "key": "key.when.keyboard.nextElement",
59
+ "description": "Move to the next html element that can be reached with Tab",
60
+ "wording": "I go to next keyboard element"
61
+ },
62
+ {
63
+ "key": "key.when.keyboard.previousElement",
64
+ "description": "Move to the previous html element that can be reached with back Tab",
65
+ "wording": "I go to previous keyboard element"
66
+ },
57
67
  {
58
68
  "key": "key.when.visit",
59
69
  "description": "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://",
@@ -104,6 +114,11 @@
104
114
  "description": "Sets the viewport dimensions to the specified width and length",
105
115
  "wording": "I set viewport with width {int} and height {int}"
106
116
  },
117
+ {
118
+ "key": "key.given.keyboard.startNavigationFromTheTop",
119
+ "description": "Start a keyboard navigation session from the top of the page",
120
+ "wording": "I start a keyboard navigation from the top of the page"
121
+ },
107
122
  {
108
123
  "key": "key.then.attributes.withValues",
109
124
  "description": "Checks Html attributes of the selected element",
@@ -144,6 +159,11 @@
144
159
  "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and content",
145
160
  "wording": "I should see an element with role {string} and name {string} and content {string}"
146
161
  },
162
+ {
163
+ "key": "key.then.element.withRoleAndNameFocused",
164
+ "description": "Checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused",
165
+ "wording": "the element with role {string} and name {string} should be keyboard focused"
166
+ },
147
167
  {
148
168
  "key": "key.then.element.withRoleAndName",
149
169
  "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/)",
@@ -20,7 +20,8 @@ class FrAccessibleRole extends accessible_role_1.AccessibleRole {
20
20
  indefiniteArticle;
21
21
  shouldGenerateTypeSentence;
22
22
  shouldGenerateContainsSentence;
23
- constructor(id, name, definiteArticle, indefiniteArticle, shouldGenerateTypeSentence = true, shouldGenerateContainsSentence = true) {
23
+ shouldGenerateKeyboardSentence;
24
+ constructor(id, name, definiteArticle, indefiniteArticle, shouldGenerateTypeSentence = true, shouldGenerateContainsSentence = true, shouldGenerateKeyboardSentence = false) {
24
25
  super();
25
26
  this.id = id;
26
27
  this.name = name;
@@ -28,6 +29,7 @@ class FrAccessibleRole extends accessible_role_1.AccessibleRole {
28
29
  this.indefiniteArticle = indefiniteArticle;
29
30
  this.shouldGenerateTypeSentence = shouldGenerateTypeSentence;
30
31
  this.shouldGenerateContainsSentence = shouldGenerateContainsSentence;
32
+ this.shouldGenerateKeyboardSentence = shouldGenerateKeyboardSentence;
31
33
  }
32
34
  getDefiniteArticle() {
33
35
  return this.definiteArticle.toString();
@@ -87,7 +89,8 @@ exports.FR_ROLES = [
87
89
  id: "button",
88
90
  name: "bouton",
89
91
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
90
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
92
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
93
+ shouldGenerateKeyboardSentence: true
91
94
  },
92
95
  {
93
96
  id: "cell",
@@ -99,7 +102,8 @@ exports.FR_ROLES = [
99
102
  id: "checkbox",
100
103
  name: "case à cocher",
101
104
  definiteArticle: FR_DEFINITE_ARTICLE.LA,
102
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE
105
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE,
106
+ shouldGenerateKeyboardSentence: true
103
107
  },
104
108
  {
105
109
  id: "columnheader",
@@ -111,7 +115,8 @@ exports.FR_ROLES = [
111
115
  id: "combobox",
112
116
  name: "boîte à choix",
113
117
  definiteArticle: FR_DEFINITE_ARTICLE.LA,
114
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE
118
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE,
119
+ shouldGenerateKeyboardSentence: true
115
120
  },
116
121
  {
117
122
  id: "command",
@@ -221,12 +226,6 @@ exports.FR_ROLES = [
221
226
  definiteArticle: FR_DEFINITE_ARTICLE.L,
222
227
  indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE
223
228
  },
224
- {
225
- id: "input",
226
- name: "entrée",
227
- definiteArticle: FR_DEFINITE_ARTICLE.L,
228
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
229
- },
230
229
  {
231
230
  id: "landmark",
232
231
  name: "point de repère",
@@ -237,7 +236,8 @@ exports.FR_ROLES = [
237
236
  id: "link",
238
237
  name: "lien",
239
238
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
240
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
239
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
240
+ shouldGenerateKeyboardSentence: true
241
241
  },
242
242
  {
243
243
  id: "list",
@@ -251,7 +251,8 @@ exports.FR_ROLES = [
251
251
  id: "listbox",
252
252
  name: "boîte à liste",
253
253
  definiteArticle: FR_DEFINITE_ARTICLE.LA,
254
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE
254
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE,
255
+ shouldGenerateKeyboardSentence: true
255
256
  },
256
257
  {
257
258
  id: "listitem",
@@ -299,19 +300,22 @@ exports.FR_ROLES = [
299
300
  id: "menuitem",
300
301
  name: "élément de menu",
301
302
  definiteArticle: FR_DEFINITE_ARTICLE.L,
302
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
303
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
304
+ shouldGenerateKeyboardSentence: true
303
305
  },
304
306
  {
305
307
  id: "menuitemcheckbox",
306
308
  name: "menu d'élément de boîte à choix",
307
309
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
308
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
310
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
311
+ shouldGenerateKeyboardSentence: true
309
312
  },
310
313
  {
311
314
  id: "menuitemradio",
312
315
  name: "menu d'élement de bouton radio",
313
316
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
314
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
317
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
318
+ shouldGenerateKeyboardSentence: true
315
319
  },
316
320
  {
317
321
  id: "meter",
@@ -359,7 +363,8 @@ exports.FR_ROLES = [
359
363
  id: "radio",
360
364
  name: "bouton radio",
361
365
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
362
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
366
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
367
+ shouldGenerateKeyboardSentence: true
363
368
  },
364
369
  {
365
370
  id: "radiogroup",
@@ -413,13 +418,15 @@ exports.FR_ROLES = [
413
418
  id: "search",
414
419
  name: "recherche",
415
420
  definiteArticle: FR_DEFINITE_ARTICLE.LA,
416
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE
421
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE,
422
+ shouldGenerateKeyboardSentence: true
417
423
  },
418
424
  {
419
425
  id: "searchbox",
420
426
  name: "boîte de recherche",
421
427
  definiteArticle: FR_DEFINITE_ARTICLE.LA,
422
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE
428
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE,
429
+ shouldGenerateKeyboardSentence: true
423
430
  },
424
431
  {
425
432
  id: "section",
@@ -437,7 +444,8 @@ exports.FR_ROLES = [
437
444
  id: "select",
438
445
  name: "sélecteur",
439
446
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
440
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
447
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
448
+ shouldGenerateKeyboardSentence: true
441
449
  },
442
450
  {
443
451
  id: "separator",
@@ -449,13 +457,15 @@ exports.FR_ROLES = [
449
457
  id: "slider",
450
458
  name: "curseur",
451
459
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
452
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
460
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
461
+ shouldGenerateKeyboardSentence: true
453
462
  },
454
463
  {
455
464
  id: "spinbutton",
456
465
  name: "bouton rotatif",
457
466
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
458
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
467
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
468
+ shouldGenerateKeyboardSentence: true
459
469
  },
460
470
  {
461
471
  id: "status",
@@ -479,13 +489,15 @@ exports.FR_ROLES = [
479
489
  id: "switch",
480
490
  name: "interrupteur",
481
491
  definiteArticle: FR_DEFINITE_ARTICLE.L,
482
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
492
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
493
+ shouldGenerateKeyboardSentence: true
483
494
  },
484
495
  {
485
496
  id: "tab",
486
497
  name: "onglet",
487
498
  definiteArticle: FR_DEFINITE_ARTICLE.L,
488
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
499
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
500
+ shouldGenerateKeyboardSentence: true
489
501
  },
490
502
  {
491
503
  id: "table",
@@ -515,7 +527,8 @@ exports.FR_ROLES = [
515
527
  id: "textbox",
516
528
  name: "boîte à texte",
517
529
  definiteArticle: FR_DEFINITE_ARTICLE.LA,
518
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE
530
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE,
531
+ shouldGenerateKeyboardSentence: true
519
532
  },
520
533
  {
521
534
  id: "timer",
@@ -557,7 +570,8 @@ exports.FR_ROLES = [
557
570
  id: "widget",
558
571
  name: "widget",
559
572
  definiteArticle: FR_DEFINITE_ARTICLE.LE,
560
- indefiniteArticle: FR_INDEFINITE_ARTICLE.UN
573
+ indefiniteArticle: FR_INDEFINITE_ARTICLE.UN,
574
+ shouldGenerateKeyboardSentence: true
561
575
  },
562
576
  {
563
577
  id: "window",
@@ -565,4 +579,4 @@ exports.FR_ROLES = [
565
579
  definiteArticle: FR_DEFINITE_ARTICLE.LA,
566
580
  indefiniteArticle: FR_INDEFINITE_ARTICLE.UNE
567
581
  }
568
- ].map((role) => new FrAccessibleRole(role.id, role.name, role.definiteArticle, role.indefiniteArticle, role.shouldGenerateContainsSentence, role.shouldGenerateContainsSentence));
582
+ ].map((role) => new FrAccessibleRole(role.id, role.name, role.definiteArticle, role.indefiniteArticle, role.shouldGenerateContainsSentence, role.shouldGenerateContainsSentence, role.shouldGenerateKeyboardSentence));
@@ -9,7 +9,9 @@
9
9
  "type": "",
10
10
  "keyboard": {
11
11
  "multiplePress": "",
12
- "press": ""
12
+ "press": "",
13
+ "previousElement": "",
14
+ "nextElement": ""
13
15
  },
14
16
  "timeout": "",
15
17
  "withinElement": {
@@ -33,6 +35,9 @@
33
35
  "viewport": {
34
36
  "preset": "",
35
37
  "withWidthAndHeight": ""
38
+ },
39
+ "keyboard": {
40
+ "startNavigationFromTheTop": ""
36
41
  }
37
42
  },
38
43
  "then": {
@@ -41,6 +46,7 @@
41
46
  "withRoleAndName": "",
42
47
  "withTestId": "",
43
48
  "withRoleAndNameAndContent": "",
49
+ "withRoleAndNameFocused": "",
44
50
  "withRoleAndNameAndContentDisabled": "",
45
51
  "withRoleAndNameAndContentEnabled": "",
46
52
  "withAriaLabel": "",
@@ -1,6 +1,4 @@
1
- type focusedElement = any;
2
1
  export interface IContext {
3
- focusedElement?: focusedElement;
2
+ withinFocusedElement?: any;
4
3
  timeout: number | null;
5
4
  }
6
- export {};
@@ -3,6 +3,7 @@ export declare abstract class AccessibleRole {
3
3
  name: string;
4
4
  shouldGenerateTypeSentence: boolean;
5
5
  shouldGenerateContainsSentence: boolean;
6
+ shouldGenerateKeyboardSentence: boolean;
6
7
  abstract getDefiniteArticle(): string;
7
8
  abstract getIndefiniteArticle(): string;
8
9
  abstract getOfDefiniteArticle(): string;
@@ -6,5 +6,6 @@ class AccessibleRole {
6
6
  name;
7
7
  shouldGenerateTypeSentence;
8
8
  shouldGenerateContainsSentence;
9
+ shouldGenerateKeyboardSentence = false;
9
10
  }
10
11
  exports.AccessibleRole = AccessibleRole;
@@ -98,6 +98,10 @@ class BasedRoleStepDefinition extends common_1.GenerateFileProcessing {
98
98
  if (!role.shouldGenerateTypeSentence) {
99
99
  dataUpdated = dataUpdated.replace(/\/\/ Begin of Type Section[\s\S]*?\/\/ End of Type Section/, "");
100
100
  }
101
+ // Exclude Role based Keyboard sentence if specified
102
+ if (!role.shouldGenerateKeyboardSentence) {
103
+ dataUpdated = dataUpdated.replace(/\/\/ Begin of Keyboard Section[\s\S]*?\/\/ End of Keyboard Section/, "");
104
+ }
101
105
  const generatedFilename = generatedFile.replace("$roleId", role.id);
102
106
  // console.debug(">>> data", dataUpdated)
103
107
  // console.debug(">>> generatedFilename", generatedFilename)
@@ -200,6 +200,8 @@ function runGenerateDoc(destDir) {
200
200
  return role.shouldGenerateContainsSentence;
201
201
  case "type":
202
202
  return role.shouldGenerateTypeSentence;
203
+ case "keyboard":
204
+ return role.shouldGenerateKeyboardSentence;
203
205
  default:
204
206
  return true;
205
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuv/runner-commons",
3
- "version": "2.9.1",
3
+ "version": "2.10.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 common lib for uuv",
@@ -12,6 +12,12 @@
12
12
  "wording": "I should see $indefiniteArticle $roleName named {string}",
13
13
  "section": "general"
14
14
  },
15
+ {
16
+ "key": "key.then.element.withRoleAndNameFocused",
17
+ "description": "Checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused",
18
+ "wording": "I should see $indefiniteArticle $roleName named {string} keyboard focused",
19
+ "section": "keyboard"
20
+ },
15
21
  {
16
22
  "key": "key.then.element.not.withRoleAndName",
17
23
  "description": "Checks that an Html element does not exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/)",
@@ -54,6 +54,16 @@
54
54
  "description": "Press specified key multiple times using | as: num|{key}",
55
55
  "wording": "I press {int} times on {string}"
56
56
  },
57
+ {
58
+ "key": "key.when.keyboard.nextElement",
59
+ "description": "Move to the next html element that can be reached with Tab",
60
+ "wording": "I go to next keyboard element"
61
+ },
62
+ {
63
+ "key": "key.when.keyboard.previousElement",
64
+ "description": "Move to the previous html element that can be reached with back Tab",
65
+ "wording": "I go to previous keyboard element"
66
+ },
57
67
  {
58
68
  "key": "key.when.visit",
59
69
  "description": "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://",
@@ -104,6 +114,11 @@
104
114
  "description": "Sets the viewport dimensions to the specified width and length",
105
115
  "wording": "I set viewport with width {int} and height {int}"
106
116
  },
117
+ {
118
+ "key": "key.given.keyboard.startNavigationFromTheTop",
119
+ "description": "Start a keyboard navigation session from the top of the page",
120
+ "wording": "I start a keyboard navigation from the top of the page"
121
+ },
107
122
  {
108
123
  "key": "key.then.attributes.withValues",
109
124
  "description": "Checks Html attributes of the selected element",
@@ -144,6 +159,11 @@
144
159
  "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and content",
145
160
  "wording": "I should see an element with role {string} and name {string} and content {string}"
146
161
  },
162
+ {
163
+ "key": "key.then.element.withRoleAndNameFocused",
164
+ "description": "Checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused",
165
+ "wording": "the element with role {string} and name {string} should be keyboard focused"
166
+ },
147
167
  {
148
168
  "key": "key.then.element.withRoleAndName",
149
169
  "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/)",
@@ -12,6 +12,12 @@
12
12
  "wording": "je dois voir $indefiniteArticle $roleName $namedAdjective {string}",
13
13
  "section": "general"
14
14
  },
15
+ {
16
+ "key": "key.then.element.withRoleAndNameFocused",
17
+ "description": "Vérifie que l'élément Html avec le [rôle accessible](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) est focus",
18
+ "wording": "je dois voir $indefiniteArticle $roleName $namedAdjective {string} avoir le focus clavier",
19
+ "section": "keyboard"
20
+ },
15
21
  {
16
22
  "key": "key.then.element.not.withRoleAndName",
17
23
  "description": "Vérifie l'inexistence d'un élément Html ayant le rôle $roleId et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) spécifiés",
@@ -54,6 +54,16 @@
54
54
  "description": "Répète la touche le nombre de fois spécifié en utilisant | comme ceci : num|{key}",
55
55
  "wording": "j'appuie {int} fois sur {string}"
56
56
  },
57
+ {
58
+ "key": "key.when.keyboard.nextElement",
59
+ "description": "se déplace au prochain élément HTML atteignable avec la tabulation",
60
+ "wording": "je vais au prochain élément au clavier"
61
+ },
62
+ {
63
+ "key": "key.when.keyboard.previousElement",
64
+ "description": "se déplace au précédent élément HTML atteignable avec la tabulation retour",
65
+ "wording": "je vais au précédent élément au clavier"
66
+ },
57
67
  {
58
68
  "key": "key.when.visit",
59
69
  "description": "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://",
@@ -104,6 +114,11 @@
104
114
  "description": "Configure les dimensions de la fenêtre à la largeur et la longueur spécifiées",
105
115
  "wording": "je redimensionne la fenêtre avec une largeur de {int} px et une longueur de {int} px"
106
116
  },
117
+ {
118
+ "key": "key.given.keyboard.startNavigationFromTheTop",
119
+ "description": "Démarre une session de navigation au clavier à partir du haut de la page",
120
+ "wording": "je commence une navigation au clavier depuis le haut de la page"
121
+ },
107
122
  {
108
123
  "key": "key.then.attributes.withValues",
109
124
  "description": "Vérifie des attributs Html de l'élément sélectionné",
@@ -144,6 +159,11 @@
144
159
  "description": "Vérifie qu'un élément Html existe avec le [rôle accessible](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) et le contenu spécifiés",
145
160
  "wording": "je dois voir un élément avec le rôle {string} et le nom {string} et pour contenu {string}"
146
161
  },
162
+ {
163
+ "key": "key.then.element.withRoleAndNameFocused",
164
+ "description": "Vérifie que l'élément Html avec le [rôle accessible](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) est focus",
165
+ "wording": "l'élément avec le rôle {string} et le nom {string} doit avoir le focus clavier"
166
+ },
147
167
  {
148
168
  "key": "key.then.element.withRoleAndName",
149
169
  "description": "Vérifie qu'un élément Html existe avec le [rôle accessible](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) et le [nom accessible](https://russmaxdesign.github.io/html-elements-names/) spécifiés",