@fluentui-react-native/tester 0.99.14 → 0.100.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.
Files changed (173) hide show
  1. package/CHANGELOG.json +30 -1
  2. package/CHANGELOG.md +15 -2
  3. package/lib/E2E/Button/pages/ButtonPageObject.js +1 -1
  4. package/lib/E2E/Button/pages/ButtonPageObject.js.map +1 -1
  5. package/lib/E2E/Button/specs/Button.spec.win.js +3 -3
  6. package/lib/E2E/Button/specs/Button.spec.win.js.map +1 -1
  7. package/lib/E2E/ButtonExperimental/pages/ButtonExperimentalPageObject.js +1 -1
  8. package/lib/E2E/ButtonExperimental/pages/ButtonExperimentalPageObject.js.map +1 -1
  9. package/lib/E2E/ButtonExperimental/specs/ButtonExperimental.spec.win.js +3 -3
  10. package/lib/E2E/ButtonExperimental/specs/ButtonExperimental.spec.win.js.map +1 -1
  11. package/lib/E2E/Checkbox/pages/CheckboxPageObject.js +2 -2
  12. package/lib/E2E/Checkbox/pages/CheckboxPageObject.js.map +1 -1
  13. package/lib/E2E/Checkbox/specs/Checkbox.spec.win.js +2 -2
  14. package/lib/E2E/Checkbox/specs/Checkbox.spec.win.js.map +1 -1
  15. package/lib/E2E/CheckboxExperimental/pages/ExperimentalCheckboxPageObject.js +2 -2
  16. package/lib/E2E/CheckboxExperimental/pages/ExperimentalCheckboxPageObject.js.map +1 -1
  17. package/lib/E2E/CheckboxExperimental/specs/ExperimentalCheckbox.spec.win.js +2 -2
  18. package/lib/E2E/CheckboxExperimental/specs/ExperimentalCheckbox.spec.win.js.map +1 -1
  19. package/lib/E2E/ContextualMenu/pages/ContextualMenuPageObject.win.js +1 -1
  20. package/lib/E2E/ContextualMenu/pages/ContextualMenuPageObject.win.js.map +1 -1
  21. package/lib/E2E/ContextualMenu/specs/ContextualMenu.spec.win.js +4 -4
  22. package/lib/E2E/ContextualMenu/specs/ContextualMenu.spec.win.js.map +1 -1
  23. package/lib/E2E/Menu/pages/MenuPageObject.js +2 -2
  24. package/lib/E2E/Menu/pages/MenuPageObject.js.map +1 -1
  25. package/lib/E2E/Menu/specs/Menu.spec.win.js +74 -210
  26. package/lib/E2E/Menu/specs/Menu.spec.win.js.map +1 -1
  27. package/lib/E2E/MenuButton/pages/MenuButtonPageObject.win.js +1 -1
  28. package/lib/E2E/MenuButton/pages/MenuButtonPageObject.win.js.map +1 -1
  29. package/lib/E2E/MenuButton/specs/MenuButton.spec.win.js +4 -4
  30. package/lib/E2E/MenuButton/specs/MenuButton.spec.win.js.map +1 -1
  31. package/lib/E2E/RadioGroup/pages/RadioGroupPageObject.js +1 -1
  32. package/lib/E2E/RadioGroup/pages/RadioGroupPageObject.js.map +1 -1
  33. package/lib/E2E/RadioGroup/specs/RadioGroup.spec.win.js +2 -2
  34. package/lib/E2E/RadioGroup/specs/RadioGroup.spec.win.js.map +1 -1
  35. package/lib/E2E/Switch/pages/SwitchPageObject.js +2 -2
  36. package/lib/E2E/Switch/pages/SwitchPageObject.js.map +1 -1
  37. package/lib/E2E/Switch/specs/Switch.spec.win.js +5 -5
  38. package/lib/E2E/Switch/specs/Switch.spec.win.js.map +1 -1
  39. package/lib/E2E/Tabs/pages/TabsPageObject.js +1 -1
  40. package/lib/E2E/Tabs/pages/TabsPageObject.js.map +1 -1
  41. package/lib/E2E/Tabs/specs/Tabs.spec.win.js +4 -4
  42. package/lib/E2E/Tabs/specs/Tabs.spec.win.js.map +1 -1
  43. package/lib/E2E/common/BasePage.d.ts +5 -2
  44. package/lib/E2E/common/BasePage.d.ts.map +1 -1
  45. package/lib/E2E/common/BasePage.js +152 -48
  46. package/lib/E2E/common/BasePage.js.map +1 -1
  47. package/lib/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.d.ts +0 -2
  48. package/lib/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.d.ts.map +1 -1
  49. package/lib/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.js +6 -13
  50. package/lib/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.js.map +1 -1
  51. package/lib/E2E/common/consts.d.ts +58 -7
  52. package/lib/E2E/common/consts.d.ts.map +1 -1
  53. package/lib/FluentTester.js +2 -2
  54. package/lib/FluentTester.js.map +1 -1
  55. package/lib/TestComponents/Common/consts.d.ts +1 -0
  56. package/lib/TestComponents/Common/consts.d.ts.map +1 -1
  57. package/lib/TestComponents/Common/consts.js +2 -0
  58. package/lib/TestComponents/Common/consts.js.map +1 -1
  59. package/lib/TestComponents/Dropdown/DropdownTest.d.ts.map +1 -1
  60. package/lib/TestComponents/Dropdown/DropdownTest.js +2 -1
  61. package/lib/TestComponents/Dropdown/DropdownTest.js.map +1 -1
  62. package/lib/TestComponents/Menu/E2EMenuTest.d.ts.map +1 -1
  63. package/lib/TestComponents/Menu/E2EMenuTest.js +14 -11
  64. package/lib/TestComponents/Menu/E2EMenuTest.js.map +1 -1
  65. package/lib/TestComponents/Menu/consts.d.ts +1 -0
  66. package/lib/TestComponents/Menu/consts.d.ts.map +1 -1
  67. package/lib/TestComponents/Menu/consts.js +1 -0
  68. package/lib/TestComponents/Menu/consts.js.map +1 -1
  69. package/lib/TestComponents/Test.d.ts.map +1 -1
  70. package/lib/TestComponents/Test.js +8 -1
  71. package/lib/TestComponents/Test.js.map +1 -1
  72. package/lib-commonjs/E2E/Button/pages/ButtonPageObject.js +1 -1
  73. package/lib-commonjs/E2E/Button/pages/ButtonPageObject.js.map +1 -1
  74. package/lib-commonjs/E2E/Button/specs/Button.spec.win.js +3 -3
  75. package/lib-commonjs/E2E/Button/specs/Button.spec.win.js.map +1 -1
  76. package/lib-commonjs/E2E/ButtonExperimental/pages/ButtonExperimentalPageObject.js +1 -1
  77. package/lib-commonjs/E2E/ButtonExperimental/pages/ButtonExperimentalPageObject.js.map +1 -1
  78. package/lib-commonjs/E2E/ButtonExperimental/specs/ButtonExperimental.spec.win.js +3 -3
  79. package/lib-commonjs/E2E/ButtonExperimental/specs/ButtonExperimental.spec.win.js.map +1 -1
  80. package/lib-commonjs/E2E/Checkbox/pages/CheckboxPageObject.js +2 -2
  81. package/lib-commonjs/E2E/Checkbox/pages/CheckboxPageObject.js.map +1 -1
  82. package/lib-commonjs/E2E/Checkbox/specs/Checkbox.spec.win.js +2 -2
  83. package/lib-commonjs/E2E/Checkbox/specs/Checkbox.spec.win.js.map +1 -1
  84. package/lib-commonjs/E2E/CheckboxExperimental/pages/ExperimentalCheckboxPageObject.js +2 -2
  85. package/lib-commonjs/E2E/CheckboxExperimental/pages/ExperimentalCheckboxPageObject.js.map +1 -1
  86. package/lib-commonjs/E2E/CheckboxExperimental/specs/ExperimentalCheckbox.spec.win.js +2 -2
  87. package/lib-commonjs/E2E/CheckboxExperimental/specs/ExperimentalCheckbox.spec.win.js.map +1 -1
  88. package/lib-commonjs/E2E/ContextualMenu/pages/ContextualMenuPageObject.win.js +1 -1
  89. package/lib-commonjs/E2E/ContextualMenu/pages/ContextualMenuPageObject.win.js.map +1 -1
  90. package/lib-commonjs/E2E/ContextualMenu/specs/ContextualMenu.spec.win.js +4 -4
  91. package/lib-commonjs/E2E/ContextualMenu/specs/ContextualMenu.spec.win.js.map +1 -1
  92. package/lib-commonjs/E2E/Menu/pages/MenuPageObject.js +2 -2
  93. package/lib-commonjs/E2E/Menu/pages/MenuPageObject.js.map +1 -1
  94. package/lib-commonjs/E2E/Menu/specs/Menu.spec.win.js +73 -209
  95. package/lib-commonjs/E2E/Menu/specs/Menu.spec.win.js.map +1 -1
  96. package/lib-commonjs/E2E/MenuButton/pages/MenuButtonPageObject.win.js +1 -1
  97. package/lib-commonjs/E2E/MenuButton/pages/MenuButtonPageObject.win.js.map +1 -1
  98. package/lib-commonjs/E2E/MenuButton/specs/MenuButton.spec.win.js +4 -4
  99. package/lib-commonjs/E2E/MenuButton/specs/MenuButton.spec.win.js.map +1 -1
  100. package/lib-commonjs/E2E/RadioGroup/pages/RadioGroupPageObject.js +1 -1
  101. package/lib-commonjs/E2E/RadioGroup/pages/RadioGroupPageObject.js.map +1 -1
  102. package/lib-commonjs/E2E/RadioGroup/specs/RadioGroup.spec.win.js +2 -2
  103. package/lib-commonjs/E2E/RadioGroup/specs/RadioGroup.spec.win.js.map +1 -1
  104. package/lib-commonjs/E2E/Switch/pages/SwitchPageObject.js +2 -2
  105. package/lib-commonjs/E2E/Switch/pages/SwitchPageObject.js.map +1 -1
  106. package/lib-commonjs/E2E/Switch/specs/Switch.spec.win.js +5 -5
  107. package/lib-commonjs/E2E/Switch/specs/Switch.spec.win.js.map +1 -1
  108. package/lib-commonjs/E2E/Tabs/pages/TabsPageObject.js +1 -1
  109. package/lib-commonjs/E2E/Tabs/pages/TabsPageObject.js.map +1 -1
  110. package/lib-commonjs/E2E/Tabs/specs/Tabs.spec.win.js +4 -4
  111. package/lib-commonjs/E2E/Tabs/specs/Tabs.spec.win.js.map +1 -1
  112. package/lib-commonjs/E2E/common/BasePage.d.ts +5 -2
  113. package/lib-commonjs/E2E/common/BasePage.d.ts.map +1 -1
  114. package/lib-commonjs/E2E/common/BasePage.js +152 -48
  115. package/lib-commonjs/E2E/common/BasePage.js.map +1 -1
  116. package/lib-commonjs/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.d.ts +0 -2
  117. package/lib-commonjs/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.d.ts.map +1 -1
  118. package/lib-commonjs/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.js +5 -12
  119. package/lib-commonjs/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.js.map +1 -1
  120. package/lib-commonjs/E2E/common/consts.d.ts +58 -7
  121. package/lib-commonjs/E2E/common/consts.d.ts.map +1 -1
  122. package/lib-commonjs/FluentTester.js +1 -1
  123. package/lib-commonjs/FluentTester.js.map +1 -1
  124. package/lib-commonjs/TestComponents/Common/consts.d.ts +1 -0
  125. package/lib-commonjs/TestComponents/Common/consts.d.ts.map +1 -1
  126. package/lib-commonjs/TestComponents/Common/consts.js +3 -1
  127. package/lib-commonjs/TestComponents/Common/consts.js.map +1 -1
  128. package/lib-commonjs/TestComponents/Dropdown/DropdownTest.d.ts.map +1 -1
  129. package/lib-commonjs/TestComponents/Dropdown/DropdownTest.js +1 -0
  130. package/lib-commonjs/TestComponents/Dropdown/DropdownTest.js.map +1 -1
  131. package/lib-commonjs/TestComponents/Menu/E2EMenuTest.d.ts.map +1 -1
  132. package/lib-commonjs/TestComponents/Menu/E2EMenuTest.js +12 -9
  133. package/lib-commonjs/TestComponents/Menu/E2EMenuTest.js.map +1 -1
  134. package/lib-commonjs/TestComponents/Menu/consts.d.ts +1 -0
  135. package/lib-commonjs/TestComponents/Menu/consts.d.ts.map +1 -1
  136. package/lib-commonjs/TestComponents/Menu/consts.js +2 -1
  137. package/lib-commonjs/TestComponents/Menu/consts.js.map +1 -1
  138. package/lib-commonjs/TestComponents/Test.d.ts.map +1 -1
  139. package/lib-commonjs/TestComponents/Test.js +8 -1
  140. package/lib-commonjs/TestComponents/Test.js.map +1 -1
  141. package/package.json +2 -2
  142. package/src/E2E/Button/pages/ButtonPageObject.ts +1 -1
  143. package/src/E2E/Button/specs/Button.spec.win.ts +3 -3
  144. package/src/E2E/ButtonExperimental/pages/ButtonExperimentalPageObject.ts +1 -1
  145. package/src/E2E/ButtonExperimental/specs/ButtonExperimental.spec.win.ts +3 -3
  146. package/src/E2E/Checkbox/pages/CheckboxPageObject.ts +2 -2
  147. package/src/E2E/Checkbox/specs/Checkbox.spec.win.ts +2 -2
  148. package/src/E2E/CheckboxExperimental/pages/ExperimentalCheckboxPageObject.ts +2 -2
  149. package/src/E2E/CheckboxExperimental/specs/ExperimentalCheckbox.spec.win.ts +2 -2
  150. package/src/E2E/ContextualMenu/pages/ContextualMenuPageObject.win.ts +1 -1
  151. package/src/E2E/ContextualMenu/specs/ContextualMenu.spec.win.ts +4 -4
  152. package/src/E2E/Menu/pages/MenuPageObject.ts +2 -2
  153. package/src/E2E/Menu/specs/Menu.spec.win.ts +24 -69
  154. package/src/E2E/MenuButton/pages/MenuButtonPageObject.win.ts +1 -1
  155. package/src/E2E/MenuButton/specs/MenuButton.spec.win.ts +4 -4
  156. package/src/E2E/RadioGroup/pages/RadioGroupPageObject.ts +1 -1
  157. package/src/E2E/RadioGroup/specs/RadioGroup.spec.win.ts +2 -2
  158. package/src/E2E/Switch/pages/SwitchPageObject.ts +2 -2
  159. package/src/E2E/Switch/specs/Switch.spec.win.ts +5 -5
  160. package/src/E2E/Tabs/pages/TabsPageObject.ts +1 -1
  161. package/src/E2E/Tabs/specs/Tabs.spec.win.ts +4 -4
  162. package/src/E2E/common/BasePage.ts +92 -21
  163. package/src/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.ts +6 -11
  164. package/src/E2E/common/consts.ts +60 -7
  165. package/src/FluentTester.tsx +2 -2
  166. package/src/TestComponents/Common/consts.ts +3 -0
  167. package/src/TestComponents/Dropdown/DropdownTest.tsx +2 -1
  168. package/src/TestComponents/Menu/E2EMenuTest.tsx +21 -17
  169. package/src/TestComponents/Menu/consts.ts +2 -0
  170. package/src/TestComponents/Test.tsx +10 -1
  171. package/wdio.conf.ios.js +5 -2
  172. package/wdio.conf.macos.js +3 -0
  173. package/wdio.conf.windows.js +3 -0
@@ -1,3 +1,6 @@
1
+ import { Keys } from './consts';
2
+ import { TESTPAGE_BUTTONS_SCROLLVIEWER } from '../../TestComponents/Common/consts';
3
+
1
4
  const DUMMY_CHAR = '';
2
5
  export const COMPONENT_SCROLL_COORDINATES = { x: -0, y: -100 }; // These are the offsets. Y is negative because we want the touch to move up (and thus it scrolls down)
3
6
 
@@ -66,19 +69,43 @@ export class BasePage {
66
69
  /* Scrolls until the desired test page's button is displayed. We use the scroll viewer UI element as the point to start scrolling.
67
70
  * We use a negative number as the Y-coordinate because that enables us to scroll downwards */
68
71
  async scrollToComponentButton(platform: Platform): Promise<void> {
72
+ if (await (await this._pageButton).isDisplayed()) {
73
+ return;
74
+ }
75
+
76
+ const errorMsg =
77
+ 'Could not scroll to the ' + this._pageName + "'s Button. Please see Pipeline artifacts for more debugging information.";
78
+
69
79
  switch (platform) {
70
- case Platform.Win32:
71
- while (!(await this.isButtonInView())) {
72
- const scrollViewElement = await By('SCROLLVIEW_TEST_ID');
73
- await driver.touchScroll(COMPONENT_SCROLL_COORDINATES.x, COMPONENT_SCROLL_COORDINATES.y, scrollViewElement.elementId);
74
- }
80
+ case Platform.Win32: {
81
+ const scrollDownKeys = [Keys.PAGE_DOWN];
82
+ await browser.waitUntil(
83
+ async () => {
84
+ await (await this._firstTestPageButton).addValue(scrollDownKeys);
85
+ scrollDownKeys.push(Keys.PAGE_DOWN);
86
+ return await (await this._pageButton).isDisplayed();
87
+ },
88
+ {
89
+ timeout: this.waitForUiEvent,
90
+ timeoutMsg: errorMsg,
91
+ },
92
+ );
75
93
  break;
76
-
77
- case Platform.iOS:
78
- while (!(await this.isButtonInView())) {
79
- await driver.execute('mobile: scroll', { direction: 'down' });
80
- }
94
+ }
95
+
96
+ case Platform.iOS: {
97
+ await browser.waitUntil(
98
+ async () => {
99
+ await driver.execute('mobile: scroll', { direction: 'down' });
100
+ return await (await this._pageButton).isDisplayed();
101
+ },
102
+ {
103
+ timeout: this.waitForUiEvent,
104
+ timeoutMsg: errorMsg,
105
+ },
106
+ );
81
107
  break;
108
+ }
82
109
 
83
110
  case Platform.macOS:
84
111
  // Not needed for macOS. It automatically scrolls
@@ -94,7 +121,7 @@ export class BasePage {
94
121
  /* Waits for the test page to load. If the test page doesn't load before the timeout, it causes the test to fail. */
95
122
  async waitForPageDisplayed(timeout?: number): Promise<void> {
96
123
  await browser.waitUntil(async () => await this.isPageLoaded(), {
97
- timeout: timeout ?? this.waitForPageTimeout,
124
+ timeout: timeout ?? this.waitForUiEvent,
98
125
  timeoutMsg: this._pageName + ' did not render correctly. Please see /errorShots for more information.',
99
126
  interval: 1500,
100
127
  });
@@ -103,7 +130,7 @@ export class BasePage {
103
130
  /* Waits for the test page's button to be displayed. If the button doesn't load before the timeout, it causes the test to fail. */
104
131
  async waitForButtonDisplayed(timeout?: number): Promise<void> {
105
132
  await browser.waitUntil(async () => await this.isButtonInView(), {
106
- timeout: timeout ?? this.waitForPageTimeout,
133
+ timeout: timeout ?? this.waitForUiEvent,
107
134
  timeoutMsg: 'Could not find the button to navigate to ' + this._pageName + '. Please see /errorShots for more information.',
108
135
  interval: 1500,
109
136
  });
@@ -112,27 +139,47 @@ export class BasePage {
112
139
  /* Waits for the primary UI test element to be displayed. If the element doesn't load before the timeout, it causes the test to fail. */
113
140
  async waitForPrimaryElementDisplayed(timeout?: number): Promise<void> {
114
141
  await browser.waitUntil(async () => await this._primaryComponent.isDisplayed(), {
115
- timeout: timeout ?? this.waitForPageTimeout,
142
+ timeout: timeout ?? this.waitForUiEvent,
116
143
  timeoutMsg:
117
144
  'The primary UI element for testing did not display correctly. Please see /errorShots of the first failed test for more information.',
118
145
  interval: 1500,
119
146
  });
120
147
  }
121
148
 
122
- /* Scrolls to the primary UI test element until it is displayed. It uses the ScrollView that encapsulates each test page. */
123
- async scrollToTestElement(): Promise<void> {
124
- const ScrollViewerID = await By('ScrollViewAreaForComponents').elementId;
125
- while (!(await this._primaryComponent.isDisplayed())) {
126
- await driver.touchScroll(COMPONENT_SCROLL_COORDINATES.x, COMPONENT_SCROLL_COORDINATES.y, ScrollViewerID);
149
+ /* Scrolls to the primary UI test element until it is displayed. */
150
+ async scrollToTestElement(component?: WebdriverIO.Element): Promise<void> {
151
+ const ComponentToScrollTo = component ?? (await this._primaryComponent);
152
+ if (await ComponentToScrollTo.isDisplayed()) {
153
+ return;
127
154
  }
128
- await driver.touchScroll(COMPONENT_SCROLL_COORDINATES.x, COMPONENT_SCROLL_COORDINATES.y, ScrollViewerID);
155
+
156
+ // This button is at the top of every test page. It allows us to put focus in the test page pane so we can type PageDown
157
+ const FocusButton = await By('Focus_Button');
158
+ const scrollDownKeys = [Keys.PAGE_DOWN];
159
+ await browser.waitUntil(
160
+ async () => {
161
+ await FocusButton.addValue(scrollDownKeys);
162
+ scrollDownKeys.push(Keys.PAGE_DOWN);
163
+ return await ComponentToScrollTo.isDisplayed();
164
+ },
165
+ {
166
+ timeout: 30000,
167
+ timeoutMsg:
168
+ 'Could not scroll to the ' +
169
+ this._pageName +
170
+ "'s main test element. Please see Pipeline artifacts for more debugging information.",
171
+ },
172
+ );
173
+
174
+ // We have this extra scroll here to ensure the whole component is visible.
175
+ await FocusButton.addValue(scrollDownKeys);
129
176
  }
130
177
 
131
178
  /* A method that allows the caller to pass in a condition. A wrapper for waitUntil(). Once testing becomes more extensive,
132
179
  * this will allow cleaner code within all the Page Objects. */
133
180
  async waitForCondition(condition?: () => Promise<boolean>, errorMsg?: string, timeout?: number): Promise<void> {
134
181
  await browser.waitUntil(async () => await condition(), {
135
- timeout: timeout ?? this.waitForPageTimeout,
182
+ timeout: timeout ?? this.waitForUiEvent,
136
183
  timeoutMsg: errorMsg ?? 'Error. Please see /errorShots and logs for more information.',
137
184
  interval: 1000,
138
185
  });
@@ -156,6 +203,21 @@ export class BasePage {
156
203
  return windowHandles.length > 1;
157
204
  }
158
205
 
206
+ /* Finds the first test page button in the ScrollView */
207
+ async SetFirstScrollViewButtonChild() {
208
+ const TestChildren = await (await this._testPageButtonScrollViewer).$$('//*');
209
+ const reg = new RegExp('Homepage_[a-zA-Z]*_Button');
210
+
211
+ for (const child of TestChildren) {
212
+ const autoId = await child.getAttribute('AutomationId');
213
+ if (autoId && autoId !== TESTPAGE_BUTTONS_SCROLLVIEWER && autoId.match(reg)) {
214
+ return await child;
215
+ }
216
+ }
217
+
218
+ return null;
219
+ }
220
+
159
221
  /*****************************************/
160
222
  /**************** Getters ****************/
161
223
  /*****************************************/
@@ -197,6 +259,15 @@ export class BasePage {
197
259
  return DUMMY_CHAR;
198
260
  }
199
261
 
262
+ // The scrollviewer containing the list of buttons to navigate to each test page
263
+ get _testPageButtonScrollViewer() {
264
+ return By(TESTPAGE_BUTTONS_SCROLLVIEWER);
265
+ }
266
+
267
+ get _firstTestPageButton() {
268
+ return this.SetFirstScrollViewButtonChild();
269
+ }
270
+
200
271
  /****************** Error Messages ******************/
201
272
  get ERRORMESSAGE_SUFFIX(): string {
202
273
  return 'Please review logs and error screenshots for more information.';
@@ -215,5 +286,5 @@ export class BasePage {
215
286
  }
216
287
 
217
288
  // Default timeout to wait until page is displayed (10s)
218
- waitForPageTimeout: number = 15000;
289
+ waitForUiEvent: number = 25000;
219
290
  }
@@ -1,11 +1,10 @@
1
- import { BasePage, By } from '../../../common/BasePage';
2
-
3
- const ScrollViewTestId = 'SCROLLVIEW_TEST_ID';
1
+ import { BasePage } from '../../../common/BasePage';
2
+ import { TESTPAGE_BUTTONS_SCROLLVIEWER } from '../../../../TestComponents/Common/consts';
4
3
 
5
4
  class NativeTestingPageObject extends BasePage {
6
5
  async waitForScrollViewDisplayed(timeout?: number): Promise<void> {
7
6
  await browser.waitUntil(async () => await this.doesScrollViewParentExist(), {
8
- timeout: timeout ?? this.waitForPageTimeout,
7
+ timeout: timeout ?? this.waitForUiEvent,
9
8
  timeoutMsg:
10
9
  'For testing purposes we require that the root view contains a non-empty, immutable ScrollView of buttons that navigate to test pages.',
11
10
  interval: 1000,
@@ -13,14 +12,14 @@ class NativeTestingPageObject extends BasePage {
13
12
  }
14
13
 
15
14
  async doesScrollViewParentExist(): Promise<boolean> {
16
- return await this._scrollViewParent.isExisting();
15
+ return await this._testPageButtonScrollViewer.isDisplayed();
17
16
  }
18
17
 
19
18
  /* Validate the Children of the ScrollView stay intact. The children are the buttons that
20
19
  * navigate to each test page. Also, validate these children exist with the proper testId format */
21
20
  async validateScrollViewChildren(): Promise<boolean> {
22
21
  // Gets all the children
23
- const testChildren = await this._scrollViewParent.$$('//*');
22
+ const testChildren = await this._testPageButtonScrollViewer.$$('//*');
24
23
  let foundValidButton = false;
25
24
 
26
25
  // Ensure the testID (maps 1:1 to automationId) properties of the button children match the defined testing format
@@ -30,7 +29,7 @@ class NativeTestingPageObject extends BasePage {
30
29
  // If automationId is found in the wrong format, return false.
31
30
  for await (const child of testChildren) {
32
31
  const autoId = await child.getAttribute('AutomationId');
33
- if (autoId && autoId !== ScrollViewTestId) {
32
+ if (autoId && autoId !== TESTPAGE_BUTTONS_SCROLLVIEWER) {
34
33
  if (autoId.match(reg)) {
35
34
  foundValidButton = true;
36
35
  } else {
@@ -42,10 +41,6 @@ class NativeTestingPageObject extends BasePage {
42
41
 
43
42
  return foundValidButton;
44
43
  }
45
-
46
- get _scrollViewParent() {
47
- return By(ScrollViewTestId);
48
- }
49
44
  }
50
45
 
51
46
  export default new NativeTestingPageObject();
@@ -18,11 +18,64 @@ export const PAGE_TIMEOUT = 15000;
18
18
 
19
19
  /* Keyboard Key Constants */
20
20
  export const enum Keys {
21
- Up_Arrow = 'ArrowUp',
22
- Right_Arrow = 'ArrowRight',
23
- Down_Arrow = 'ArrowDown',
24
- Left_Arrow = 'ArrowLeft',
25
- Spacebar = ' ',
26
- Enter = 'Enter',
27
- Escape = 'Escape',
21
+ NULL = '\uE000',
22
+ CANCEL = '\uE001', // ^break
23
+ HELP = '\uE002',
24
+ BACK_SPACE = '\uE003',
25
+ TAB = '\uE004',
26
+ CLEAR = '\uE005',
27
+ RETURN = '\uE006',
28
+ ENTER = '\uE007',
29
+ SHIFT = '\uE008',
30
+ CONTROL = '\uE009',
31
+ ALT = '\uE00A',
32
+ PAUSE = '\uE00B',
33
+ ESCAPE = '\uE00C',
34
+ SPACE = '\uE00D',
35
+ PAGE_UP = '\uE00E',
36
+ PAGE_DOWN = '\uE00F',
37
+ END = '\uE010',
38
+ HOME = '\uE011',
39
+ ARROW_LEFT = '\uE012',
40
+ LEFT = '\uE012',
41
+ ARROW_UP = '\uE013',
42
+ UP = '\uE013',
43
+ ARROW_RIGHT = '\uE014',
44
+ RIGHT = '\uE014',
45
+ ARROW_DOWN = '\uE015',
46
+ DOWN = '\uE015',
47
+ INSERT = '\uE016',
48
+ DELETE = '\uE017',
49
+ SEMICOLON = '\uE018',
50
+ EQUALS = '\uE019',
51
+
52
+ NUMPAD0 = '\uE01A', // number pad keys
53
+ NUMPAD1 = '\uE01B',
54
+ NUMPAD2 = '\uE01C',
55
+ NUMPAD3 = '\uE01D',
56
+ NUMPAD4 = '\uE01E',
57
+ NUMPAD5 = '\uE01F',
58
+ NUMPAD6 = '\uE020',
59
+ NUMPAD7 = '\uE021',
60
+ NUMPAD8 = '\uE022',
61
+ NUMPAD9 = '\uE023',
62
+ MULTIPLY = '\uE024',
63
+ ADD = '\uE025',
64
+ SEPARATOR = '\uE026',
65
+ SUBTRACT = '\uE027',
66
+ DECIMAL = '\uE028',
67
+ DIVIDE = '\uE029',
68
+
69
+ F1 = '\uE031', // function keys
70
+ F2 = '\uE032',
71
+ F3 = '\uE033',
72
+ F4 = '\uE034',
73
+ F5 = '\uE035',
74
+ F6 = '\uE036',
75
+ F7 = '\uE037',
76
+ F8 = '\uE038',
77
+ F9 = '\uE039',
78
+ F10 = '\uE03A',
79
+ F11 = '\uE03B',
80
+ F12 = '\uE03C',
28
81
  }
@@ -4,7 +4,7 @@ import { ButtonV1 as Button } from '@fluentui-react-native/button';
4
4
  import { themedStyleSheet } from '@fluentui-react-native/themed-stylesheet';
5
5
  import * as React from 'react';
6
6
  import { ScrollView, View, Text as RNText, Platform, SafeAreaView, BackHandler } from 'react-native';
7
- import { BASE_TESTPAGE } from './TestComponents/Common/consts';
7
+ import { BASE_TESTPAGE, TESTPAGE_BUTTONS_SCROLLVIEWER } from './TestComponents/Common/consts';
8
8
  import { commonTestStyles, fluentTesterStyles, mobileStyles } from './TestComponents/Common/styles';
9
9
  import { useTheme } from '@fluentui-react-native/theme-types';
10
10
  import { ThemePickers } from './theme/ThemePickers';
@@ -136,7 +136,7 @@ export const FluentTester: React.FunctionComponent<FluentTesterProps> = (props:
136
136
  const TestList: React.FunctionComponent = () => {
137
137
  return (
138
138
  <View style={fluentTesterStyles.testList}>
139
- <ScrollView contentContainerStyle={fluentTesterStyles.testListContainerStyle} testID="SCROLLVIEW_TEST_ID">
139
+ <ScrollView contentContainerStyle={fluentTesterStyles.testListContainerStyle} testID={TESTPAGE_BUTTONS_SCROLLVIEWER}>
140
140
  {sortedTestComponents.map((description, index) => {
141
141
  return (
142
142
  <Button
@@ -1,2 +1,5 @@
1
1
  // Used for E2E testing on base page of FluentTester
2
2
  export const BASE_TESTPAGE = 'Base_TestPage';
3
+
4
+ // ScrollViewer that contains the list of test page buttons
5
+ export const TESTPAGE_BUTTONS_SCROLLVIEWER = 'TestPage_Buttons_ScrollViewer';
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Option } from '@fluentui-react-native/dropdown';
2
+ import { Option, Dropdown } from '@fluentui-react-native/dropdown';
3
3
  import { Stack } from '@fluentui-react-native/stack';
4
4
  import { stackStyle } from '../Common/styles';
5
5
  import { DROPDOWN_TESTPAGE } from './consts';
@@ -8,6 +8,7 @@ import { Test, TestSection, PlatformStatus } from '../Test';
8
8
  const DropdownDefault: React.FunctionComponent = () => {
9
9
  return (
10
10
  <Stack style={stackStyle}>
11
+ <Dropdown />
11
12
  <Option>Test</Option>
12
13
  <Option disabled>Disabled Test</Option>
13
14
  </Stack>
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
+ import { View } from 'react-native';
2
3
  import { Stack } from '@fluentui-react-native/stack';
3
4
  import { stackStyle } from '../Common/styles';
4
- import { ButtonV1 as Button } from '@fluentui-react-native/button';
5
+ import { ButtonV1 as Button, ButtonV1 } from '@fluentui-react-native/button';
5
6
  import { TextV1 as Text } from '@fluentui-react-native/text';
6
7
  import { Menu, MenuItem, MenuList, MenuPopover, MenuTrigger } from '@fluentui-react-native/menu';
7
8
  import {
@@ -13,6 +14,7 @@ import {
13
14
  MENU_ON_OPEN,
14
15
  MENUITEM_TEST_COMPONENT,
15
16
  MENUPOPOVER_TEST_COMPONENT,
17
+ MENU_DEFOCUS_BUTTON,
16
18
  } from './consts';
17
19
 
18
20
  export const E2EMenuTest: React.FunctionComponent = () => {
@@ -27,22 +29,24 @@ export const E2EMenuTest: React.FunctionComponent = () => {
27
29
 
28
30
  return (
29
31
  <Stack style={stackStyle}>
30
- <Menu open={menuOpened} onOpenChange={onOpenChange}>
31
- <MenuTrigger>
32
- <Button testID={MENUTRIGGER_TEST_COMPONENT}>Test</Button>
33
- </MenuTrigger>
34
- <MenuPopover testID={MENUPOPOVER_TEST_COMPONENT}>
35
- <MenuList>
36
- <MenuItem testID={MENUITEM_TEST_COMPONENT} accessibilityLabel={MENUITEM_ACCESSIBILITY_LABEL}>
37
- A plain MenuItem
38
- </MenuItem>
39
- <MenuItem disabled>A second disabled plain MenuItem</MenuItem>
40
- <MenuItem testID={MENUITEM_NO_A11Y_LABEL_COMPONENT}>{MENUITEM_TEST_LABEL}</MenuItem>
41
- </MenuList>
42
- </MenuPopover>
43
- </Menu>
44
-
45
- {menuOpened ? <Text testID={MENU_ON_OPEN}>Menu opened</Text> : <Text testID={MENU_ON_CLOSE}>Menu closed</Text>}
32
+ <View style={{ flexDirection: 'row' }}>
33
+ {menuOpened ? <Text testID={MENU_ON_OPEN}>Menu opened</Text> : <Text testID={MENU_ON_CLOSE}>Menu closed</Text>}
34
+ <ButtonV1 testID={MENU_DEFOCUS_BUTTON}>Defocus Button</ButtonV1>
35
+ <Menu open={menuOpened} onOpenChange={onOpenChange}>
36
+ <MenuTrigger>
37
+ <Button testID={MENUTRIGGER_TEST_COMPONENT}>Test</Button>
38
+ </MenuTrigger>
39
+ <MenuPopover testID={MENUPOPOVER_TEST_COMPONENT}>
40
+ <MenuList>
41
+ <MenuItem testID={MENUITEM_TEST_COMPONENT} accessibilityLabel={MENUITEM_ACCESSIBILITY_LABEL}>
42
+ A plain MenuItem
43
+ </MenuItem>
44
+ <MenuItem disabled>A second disabled plain MenuItem</MenuItem>
45
+ <MenuItem testID={MENUITEM_NO_A11Y_LABEL_COMPONENT}>{MENUITEM_TEST_LABEL}</MenuItem>
46
+ </MenuList>
47
+ </MenuPopover>
48
+ </Menu>
49
+ </View>
46
50
  </Stack>
47
51
  );
48
52
  };
@@ -14,3 +14,5 @@ export const MENUITEM_TEST_LABEL = 'Test MenuItem2 - No Accessibility Label'; //
14
14
 
15
15
  export const MENU_ON_OPEN = 'Menu_On_Open'; // For testing the open functionality of Menu
16
16
  export const MENU_ON_CLOSE = 'Menu_On_Close'; // For testing the open functionality of Menu
17
+
18
+ export const MENU_DEFOCUS_BUTTON = 'Menu_Defocus_Button'; // Used to move focus away from menu button
@@ -6,6 +6,7 @@ import { stackStyle } from './Common/styles';
6
6
  import { useTheme } from '@fluentui-react-native/theme-types';
7
7
  import Svg, { G, Path, SvgProps } from 'react-native-svg';
8
8
  import { SvgIconProps } from '@fluentui-react-native/icon';
9
+ import { Button } from '@fluentui-react-native/experimental-button';
9
10
 
10
11
  export type TestSection = {
11
12
  name: string;
@@ -70,6 +71,11 @@ const styles = StyleSheet.create({
70
71
  status: {
71
72
  fontWeight: 'normal',
72
73
  },
74
+ // This button is only for our E2E testing framework. We want to be able to put keyboard focus in any test page if we need it.
75
+ // This button will be at the top of every test page and allows us to do that. But we don't want partners to see it.
76
+ e2eFocusButton: {
77
+ opacity: 0,
78
+ },
73
79
  });
74
80
 
75
81
  export const Test = (props: TestProps): React.ReactElement<Record<string, never>> => {
@@ -107,11 +113,14 @@ export const Test = (props: TestProps): React.ReactElement<Record<string, never>
107
113
  const toggleIconProps = Platform.OS === 'windows' ? { fontSource: fontIconProps } : { svgSource: svgProps, width: 12, height: 12 };
108
114
 
109
115
  return (
110
- <View testID="ScrollViewAreaForComponents">
116
+ <View>
111
117
  <View style={styles.header}>
112
118
  <Text style={styles.name} variant="heroSemibold">
113
119
  {props.name}
114
120
  </Text>
121
+ <Button testID="Focus_Button" style={styles.e2eFocusButton}>
122
+ E2E Testing Button
123
+ </Button>
115
124
  {props.spec && <Link url={props.spec} content="SPEC" />}
116
125
  </View>
117
126
  <Separator />
package/wdio.conf.ios.js CHANGED
@@ -7,7 +7,7 @@ const jasmineDefaultTimeout = 60000; // 60 seconds for Jasmine test timeout
7
7
  exports.config = {
8
8
  runner: 'local', // Where should your test be launched
9
9
  specs: ['src/E2E/**/specs/*.ios.ts'],
10
- exclude: [ ],
10
+ exclude: [],
11
11
 
12
12
  maxInstances: 30,
13
13
  capabilities: [
@@ -137,6 +137,9 @@ exports.config = {
137
137
  * Function to be executed after a test (in Mocha/Jasmine).
138
138
  */
139
139
  afterTest: function (test, context, results) {
140
+ const resultString = results.passed ? 'Passed' : 'Failed';
141
+ console.log('\n Test Case: ' + test.description + '. Result: ' + resultString + '\n');
142
+
140
143
  // if test passed, ignore, else take and save screenshot. Unless it's the first test that boots the app,
141
144
  // it may be useful to have a screenshot of the app on load.
142
145
  if (results.passed) {
@@ -203,4 +206,4 @@ exports.config = {
203
206
  */
204
207
  //onReload: function(oldSessionId, newSessionId) {
205
208
  //}
206
- };
209
+ };
@@ -154,6 +154,9 @@ exports.config = {
154
154
  * Function to be executed after a test (in Mocha/Jasmine).
155
155
  */
156
156
  afterTest: function (test, context, results) {
157
+ const resultString = results.passed ? 'Passed' : 'Failed';
158
+ console.log('\n Test Case: ' + test.description + '. Result: ' + resultString + '\n');
159
+
157
160
  // if test passed, ignore, else take and save screenshot. Unless it's the first test that boots the app,
158
161
  // it may be useful to have a screenshot of the app on load.
159
162
  if (results.passed) {
@@ -159,6 +159,9 @@ exports.config = {
159
159
  * Function to be executed after a test (in Mocha/Jasmine).
160
160
  */
161
161
  afterTest: function (test, context, results) {
162
+ const resultString = results.passed ? 'Passed' : 'Failed';
163
+ console.log('\n Test Case: ' + test.description + '. Result: ' + resultString + '\n');
164
+
162
165
  // if test passed, ignore, else take and save screenshot.
163
166
  if (results.passed) {
164
167
  return;