@fluentui-react-native/tester 0.50.28 → 0.51.3

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 (103) hide show
  1. package/CHANGELOG.json +250 -4
  2. package/CHANGELOG.md +65 -2
  3. package/lib/E2E/Button/pages/ButtonPageObject.d.ts +4 -0
  4. package/lib/E2E/Button/pages/ButtonPageObject.d.ts.map +1 -1
  5. package/lib/E2E/Button/pages/ButtonPageObject.js +15 -1
  6. package/lib/E2E/Button/pages/ButtonPageObject.js.map +1 -1
  7. package/lib/E2E/Button/specs/Button.spec.win.js +25 -5
  8. package/lib/E2E/Button/specs/Button.spec.win.js.map +1 -1
  9. package/lib/E2E/Checkbox/pages/CheckboxPageObject.d.ts +3 -1
  10. package/lib/E2E/Checkbox/pages/CheckboxPageObject.d.ts.map +1 -1
  11. package/lib/E2E/Checkbox/pages/CheckboxPageObject.js +21 -4
  12. package/lib/E2E/Checkbox/pages/CheckboxPageObject.js.map +1 -1
  13. package/lib/E2E/Checkbox/specs/Checkbox.spec.win.js +32 -5
  14. package/lib/E2E/Checkbox/specs/Checkbox.spec.win.js.map +1 -1
  15. package/lib/E2E/Checkbox/specs/Checkbox.spec.windows.d.ts +2 -0
  16. package/lib/E2E/Checkbox/specs/Checkbox.spec.windows.d.ts.map +1 -0
  17. package/lib/E2E/Checkbox/specs/Checkbox.spec.windows.js +67 -0
  18. package/lib/E2E/Checkbox/specs/Checkbox.spec.windows.js.map +1 -0
  19. package/lib/E2E/Text/pages/TextPageObject.macos.js +2 -2
  20. package/lib/E2E/Text/pages/TextPageObject.macos.js.map +1 -1
  21. package/lib/E2E/Text/pages/TextPageObject.win.d.ts +1 -0
  22. package/lib/E2E/Text/pages/TextPageObject.win.d.ts.map +1 -1
  23. package/lib/E2E/Text/pages/TextPageObject.win.js +9 -2
  24. package/lib/E2E/Text/pages/TextPageObject.win.js.map +1 -1
  25. package/lib/E2E/Text/specs/Text.spec.win.js +10 -1
  26. package/lib/E2E/Text/specs/Text.spec.win.js.map +1 -1
  27. package/lib/E2E/common/BasePage.win.d.ts +2 -0
  28. package/lib/E2E/common/BasePage.win.d.ts.map +1 -1
  29. package/lib/E2E/common/BasePage.win.js +11 -0
  30. package/lib/E2E/common/BasePage.win.js.map +1 -1
  31. package/lib/E2E/common/consts.d.ts +9 -0
  32. package/lib/E2E/common/consts.d.ts.map +1 -1
  33. package/lib/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.d.ts +3 -0
  34. package/lib/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.d.ts.map +1 -0
  35. package/lib/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.js +32 -0
  36. package/lib/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.js.map +1 -0
  37. package/lib/FluentTester/TestComponents/ButtonExperimental/ButtonTest.d.ts.map +1 -1
  38. package/lib/FluentTester/TestComponents/ButtonExperimental/ButtonTest.js +5 -0
  39. package/lib/FluentTester/TestComponents/ButtonExperimental/ButtonTest.js.map +1 -1
  40. package/lib/FluentTester/TestComponents/Text/TextE2ETest.js +3 -3
  41. package/lib/FluentTester/TestComponents/Text/TextE2ETest.js.map +1 -1
  42. package/lib/FluentTester/TestComponents/Text/consts.d.ts +3 -3
  43. package/lib/FluentTester/TestComponents/Text/consts.d.ts.map +1 -1
  44. package/lib/FluentTester/TestComponents/Text/consts.js +3 -3
  45. package/lib/FluentTester/TestComponents/Text/consts.js.map +1 -1
  46. package/lib-commonjs/E2E/Button/pages/ButtonPageObject.d.ts +4 -0
  47. package/lib-commonjs/E2E/Button/pages/ButtonPageObject.d.ts.map +1 -1
  48. package/lib-commonjs/E2E/Button/pages/ButtonPageObject.js +14 -0
  49. package/lib-commonjs/E2E/Button/pages/ButtonPageObject.js.map +1 -1
  50. package/lib-commonjs/E2E/Button/specs/Button.spec.win.js +24 -4
  51. package/lib-commonjs/E2E/Button/specs/Button.spec.win.js.map +1 -1
  52. package/lib-commonjs/E2E/Checkbox/pages/CheckboxPageObject.d.ts +3 -1
  53. package/lib-commonjs/E2E/Checkbox/pages/CheckboxPageObject.d.ts.map +1 -1
  54. package/lib-commonjs/E2E/Checkbox/pages/CheckboxPageObject.js +20 -3
  55. package/lib-commonjs/E2E/Checkbox/pages/CheckboxPageObject.js.map +1 -1
  56. package/lib-commonjs/E2E/Checkbox/specs/Checkbox.spec.win.js +31 -4
  57. package/lib-commonjs/E2E/Checkbox/specs/Checkbox.spec.win.js.map +1 -1
  58. package/lib-commonjs/E2E/Checkbox/specs/Checkbox.spec.windows.d.ts +2 -0
  59. package/lib-commonjs/E2E/Checkbox/specs/Checkbox.spec.windows.d.ts.map +1 -0
  60. package/lib-commonjs/E2E/Checkbox/specs/Checkbox.spec.windows.js +70 -0
  61. package/lib-commonjs/E2E/Checkbox/specs/Checkbox.spec.windows.js.map +1 -0
  62. package/lib-commonjs/E2E/Text/pages/TextPageObject.macos.js +1 -1
  63. package/lib-commonjs/E2E/Text/pages/TextPageObject.macos.js.map +1 -1
  64. package/lib-commonjs/E2E/Text/pages/TextPageObject.win.d.ts +1 -0
  65. package/lib-commonjs/E2E/Text/pages/TextPageObject.win.d.ts.map +1 -1
  66. package/lib-commonjs/E2E/Text/pages/TextPageObject.win.js +8 -1
  67. package/lib-commonjs/E2E/Text/pages/TextPageObject.win.js.map +1 -1
  68. package/lib-commonjs/E2E/Text/specs/Text.spec.win.js +10 -1
  69. package/lib-commonjs/E2E/Text/specs/Text.spec.win.js.map +1 -1
  70. package/lib-commonjs/E2E/common/BasePage.win.d.ts +2 -0
  71. package/lib-commonjs/E2E/common/BasePage.win.d.ts.map +1 -1
  72. package/lib-commonjs/E2E/common/BasePage.win.js +11 -0
  73. package/lib-commonjs/E2E/common/BasePage.win.js.map +1 -1
  74. package/lib-commonjs/E2E/common/consts.d.ts +9 -0
  75. package/lib-commonjs/E2E/common/consts.d.ts.map +1 -1
  76. package/lib-commonjs/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.d.ts +3 -0
  77. package/lib-commonjs/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.d.ts.map +1 -0
  78. package/lib-commonjs/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.js +37 -0
  79. package/lib-commonjs/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.js.map +1 -0
  80. package/lib-commonjs/FluentTester/TestComponents/ButtonExperimental/ButtonTest.d.ts.map +1 -1
  81. package/lib-commonjs/FluentTester/TestComponents/ButtonExperimental/ButtonTest.js +5 -0
  82. package/lib-commonjs/FluentTester/TestComponents/ButtonExperimental/ButtonTest.js.map +1 -1
  83. package/lib-commonjs/FluentTester/TestComponents/Text/TextE2ETest.js +2 -2
  84. package/lib-commonjs/FluentTester/TestComponents/Text/TextE2ETest.js.map +1 -1
  85. package/lib-commonjs/FluentTester/TestComponents/Text/consts.d.ts +3 -3
  86. package/lib-commonjs/FluentTester/TestComponents/Text/consts.d.ts.map +1 -1
  87. package/lib-commonjs/FluentTester/TestComponents/Text/consts.js +4 -4
  88. package/lib-commonjs/FluentTester/TestComponents/Text/consts.js.map +1 -1
  89. package/package.json +9 -9
  90. package/src/E2E/Button/pages/ButtonPageObject.ts +20 -0
  91. package/src/E2E/Button/specs/Button.spec.win.ts +37 -6
  92. package/src/E2E/Checkbox/pages/CheckboxPageObject.ts +27 -3
  93. package/src/E2E/Checkbox/specs/Checkbox.spec.win.ts +48 -6
  94. package/src/E2E/Checkbox/specs/Checkbox.spec.windows.ts +86 -0
  95. package/src/E2E/Text/pages/TextPageObject.macos.ts +2 -2
  96. package/src/E2E/Text/pages/TextPageObject.win.ts +11 -2
  97. package/src/E2E/Text/specs/Text.spec.win.ts +14 -1
  98. package/src/E2E/common/BasePage.win.ts +13 -0
  99. package/src/E2E/common/consts.ts +11 -0
  100. package/src/FluentTester/TestComponents/ButtonExperimental/ButtonHOCTestSection.tsx +43 -0
  101. package/src/FluentTester/TestComponents/ButtonExperimental/ButtonTest.tsx +5 -0
  102. package/src/FluentTester/TestComponents/Text/TextE2ETest.tsx +4 -4
  103. package/src/FluentTester/TestComponents/Text/consts.ts +3 -3
@@ -1,8 +1,12 @@
1
1
  import NavigateAppPage from '../../common/NavigateAppPage.win';
2
2
  import ButtonPageObject from '../pages/ButtonPageObject';
3
3
  import { ComponentSelector } from '../../common/BasePage.win';
4
- import { PAGE_TIMEOUT, BOOT_APP_TIMEOUT, BUTTON_A11Y_ROLE } from '../../common/consts';
5
- import { BUTTON_ACCESSIBILITY_LABEL, BUTTON_TEST_COMPONENT_LABEL } from '../../../FluentTester/TestComponents/Button/consts';
4
+ import { PAGE_TIMEOUT, BOOT_APP_TIMEOUT, BUTTON_A11Y_ROLE, Keys } from '../../common/consts';
5
+ import {
6
+ BUTTON_TEST_COMPONENT,
7
+ BUTTON_ACCESSIBILITY_LABEL,
8
+ BUTTON_TEST_COMPONENT_LABEL,
9
+ } from '../../../FluentTester/TestComponents/Button/consts';
6
10
 
7
11
  // Before testing begins, allow up to 60 seconds for app to open
8
12
  describe('Button Testing Initialization', function () {
@@ -25,21 +29,48 @@ describe('Button Testing Initialization', function () {
25
29
  });
26
30
 
27
31
  describe('Button Accessibility Testing', () => {
28
- it('Button - Validate accessibilityRole is correct', () => {
32
+ /* Scrolls and waits for the Button to be visible on the Test Page */
33
+ beforeEach(() => {
29
34
  ButtonPageObject.scrollToTestElement();
30
35
  ButtonPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
36
+ });
37
+
38
+ it('Button - Validate accessibilityRole is correct', () => {
31
39
  expect(ButtonPageObject.getAccessibilityRole()).toEqual(BUTTON_A11Y_ROLE);
32
40
  });
33
41
 
34
42
  it('Button - Set accessibilityLabel', () => {
35
- ButtonPageObject.scrollToTestElement();
36
- ButtonPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
37
43
  expect(ButtonPageObject.getAccessibilityLabel(ComponentSelector.Primary)).toEqual(BUTTON_ACCESSIBILITY_LABEL);
38
44
  });
39
45
 
40
46
  it('Button - Do not set accessibilityLabel -> Default to Button label', () => {
47
+ expect(ButtonPageObject.getAccessibilityLabel(ComponentSelector.Secondary)).toEqual(BUTTON_TEST_COMPONENT_LABEL);
48
+ });
49
+ });
50
+
51
+ describe('Button Functional Testing', () => {
52
+ /* Scrolls and waits for the Button to be visible on the Test Page */
53
+ beforeEach(() => {
41
54
  ButtonPageObject.scrollToTestElement();
42
55
  ButtonPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
43
- expect(ButtonPageObject.getAccessibilityLabel(ComponentSelector.Secondary)).toEqual(BUTTON_TEST_COMPONENT_LABEL);
56
+ });
57
+
58
+ it('Validate OnClick() callback was fired -> Click', () => {
59
+ ButtonPageObject.clickComponent();
60
+ expect(ButtonPageObject.didOnClickCallbackFire()).toBeTruthy();
61
+
62
+ ButtonPageObject.clickComponent(); // Reset Button State
63
+ });
64
+
65
+ it('Validate OnClick() callback was fired -> Type "Enter"', () => {
66
+ ButtonPageObject.sendKey(BUTTON_TEST_COMPONENT, Keys.Enter);
67
+ expect(ButtonPageObject.didOnClickCallbackFire()).toBeTruthy();
68
+
69
+ ButtonPageObject.clickComponent(); // Reset Button State
70
+ });
71
+
72
+ it('Validate OnClick() callback was fired -> Type "Spacebar"', () => {
73
+ ButtonPageObject.sendKey(BUTTON_TEST_COMPONENT, Keys.Spacebar);
74
+ expect(ButtonPageObject.didOnClickCallbackFire()).toBeTruthy();
44
75
  });
45
76
  });
@@ -3,6 +3,7 @@ import {
3
3
  CHECKBOX_TEST_COMPONENT,
4
4
  CHECKBOX_NO_A11Y_LABEL_COMPONENT,
5
5
  HOMEPAGE_CHECKBOX_BUTTON,
6
+ CHECKBOX_ON_PRESS,
6
7
  } from '../../../FluentTester/TestComponents/Checkbox/consts';
7
8
  import { BasePage, By } from '../../common/BasePage.win';
8
9
 
@@ -14,19 +15,42 @@ class CheckboxPageObject extends BasePage {
14
15
  return this._primaryComponent.isSelected();
15
16
  }
16
17
 
17
- waitForCheckboxUnchecked(timeout?: number): void {
18
+ waitForCheckboxChecked(timeout?: number): void {
18
19
  browser.waitUntil(
19
20
  () => {
20
- return !this.isCheckboxChecked();
21
+ return this.isCheckboxChecked();
21
22
  },
22
23
  {
23
24
  timeout: timeout ?? this.waitForPageTimeout,
24
- timeoutMsg: 'The onPress() callback for ' + this._pageName + ' did not fire correctly.',
25
+ timeoutMsg: 'The Checkbox was not toggled correctly',
25
26
  interval: 1000,
26
27
  },
27
28
  );
28
29
  }
29
30
 
31
+ /* Useful in beforeEach() hook to reset the checkbox before every test */
32
+ toggleCheckboxToUnchecked(): void {
33
+ if (this.isCheckboxChecked()) {
34
+ this._primaryComponent.click();
35
+ }
36
+ }
37
+
38
+ didOnChangeCallbackFire(): boolean {
39
+ const callbackText = By(CHECKBOX_ON_PRESS);
40
+ browser.waitUntil(
41
+ () => {
42
+ return callbackText.isDisplayed();
43
+ },
44
+ {
45
+ timeout: this.waitForPageTimeout,
46
+ timeoutMsg: 'The OnChange callback did not fire.',
47
+ interval: 1000,
48
+ },
49
+ );
50
+
51
+ return callbackText.isDisplayed();
52
+ }
53
+
30
54
  /*****************************************/
31
55
  /**************** Getters ****************/
32
56
  /*****************************************/
@@ -1,8 +1,12 @@
1
1
  import NavigateAppPage from '../../common/NavigateAppPage.win';
2
2
  import CheckboxPageObject from '../pages/CheckboxPageObject';
3
3
  import { ComponentSelector } from '../../common/BasePage.win';
4
- import { CHECKBOX_TEST_COMPONENT_LABEL, CHECKBOX_ACCESSIBILITY_LABEL } from '../../../FluentTester/TestComponents/Checkbox/consts';
5
- import { CHECKBOX_A11Y_ROLE, PAGE_TIMEOUT, BOOT_APP_TIMEOUT } from '../../common/consts';
4
+ import {
5
+ CHECKBOX_TEST_COMPONENT_LABEL,
6
+ CHECKBOX_ACCESSIBILITY_LABEL,
7
+ CHECKBOX_TEST_COMPONENT,
8
+ } from '../../../FluentTester/TestComponents/Checkbox/consts';
9
+ import { CHECKBOX_A11Y_ROLE, PAGE_TIMEOUT, BOOT_APP_TIMEOUT, Keys } from '../../common/consts';
6
10
 
7
11
  describe('Checkbox Testing Initialization', () => {
8
12
  it('Wait for app load', () => {
@@ -24,21 +28,59 @@ describe('Checkbox Testing Initialization', () => {
24
28
  });
25
29
 
26
30
  describe('Checkbox Accessibility Testing', () => {
27
- it('Checkbox - Validate accessibilityRole is correct', () => {
31
+ /* Scrolls and waits for the Checkbox to be visible on the Test Page */
32
+ beforeEach(() => {
28
33
  CheckboxPageObject.scrollToTestElement();
29
34
  CheckboxPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
35
+ });
36
+
37
+ it('Checkbox - Validate accessibilityRole is correct', () => {
30
38
  expect(CheckboxPageObject.getAccessibilityRole()).toEqual(CHECKBOX_A11Y_ROLE);
31
39
  });
32
40
 
33
41
  it('Checkbox - Set accessibilityLabel', () => {
34
- CheckboxPageObject.scrollToTestElement();
35
- CheckboxPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
36
42
  expect(CheckboxPageObject.getAccessibilityLabel(ComponentSelector.Primary)).toEqual(CHECKBOX_ACCESSIBILITY_LABEL);
37
43
  });
38
44
 
39
45
  it('Checkbox - Do not set accessibilityLabel -> Default to Checkbox label', () => {
46
+ expect(CheckboxPageObject.getAccessibilityLabel(ComponentSelector.Secondary)).toEqual(CHECKBOX_TEST_COMPONENT_LABEL);
47
+ });
48
+ });
49
+
50
+ describe('Checkbox Functional Testing', () => {
51
+ /* Scrolls and waits for the Checkbox to be visible on the Test Page AND un-checks the Checkbox */
52
+ beforeEach(() => {
40
53
  CheckboxPageObject.scrollToTestElement();
41
54
  CheckboxPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
42
- expect(CheckboxPageObject.getAccessibilityLabel(ComponentSelector.Secondary)).toEqual(CHECKBOX_TEST_COMPONENT_LABEL);
55
+
56
+ CheckboxPageObject.toggleCheckboxToUnchecked();
57
+ });
58
+
59
+ it("Click on a Checkbox -> Validate it toggles correctly AND calls the user's onChange", () => {
60
+ /* Validate the Checkbox is initially toggled OFF */
61
+ expect(CheckboxPageObject.isCheckboxChecked()).toBeFalsy();
62
+
63
+ /* Click on the Checkbox to toggle on */
64
+ CheckboxPageObject.clickComponent();
65
+ CheckboxPageObject.waitForCheckboxChecked(PAGE_TIMEOUT);
66
+
67
+ expect(CheckboxPageObject.didOnChangeCallbackFire()).toBeTruthy();
68
+
69
+ /* Validate the Checkbox is toggled ON */
70
+ expect(CheckboxPageObject.isCheckboxChecked()).toBeTruthy();
71
+
72
+ CheckboxPageObject.clickComponent();
73
+
74
+ /* Validate the Checkbox is toggled OFF */
75
+ expect(CheckboxPageObject.isCheckboxChecked()).toBeFalsy();
76
+ });
77
+
78
+ it('Click the "Spacebar" on a Checkbox and verify it toggles', () => {
79
+ /* Presses the "space bar" to select the Checkbox */
80
+ CheckboxPageObject.sendKey(CHECKBOX_TEST_COMPONENT, Keys.Spacebar);
81
+ CheckboxPageObject.waitForCheckboxChecked(PAGE_TIMEOUT);
82
+
83
+ /* Validate the Checkbox is selected */
84
+ expect(CheckboxPageObject.isCheckboxChecked()).toBeTruthy();
43
85
  });
44
86
  });
@@ -0,0 +1,86 @@
1
+ import NavigateAppPage from '../../common/NavigateAppPage.win';
2
+ import CheckboxPageObject from '../pages/CheckboxPageObject';
3
+ import { ComponentSelector } from '../../common/BasePage.win';
4
+ import { CHECKBOX_TEST_COMPONENT_LABEL, CHECKBOX_ACCESSIBILITY_LABEL } from '../../../FluentTester/TestComponents/Checkbox/consts';
5
+ import { CHECKBOX_A11Y_ROLE, PAGE_TIMEOUT, BOOT_APP_TIMEOUT } from '../../common/consts';
6
+
7
+ describe('Checkbox Testing Initialization', () => {
8
+ it('Wait for app load', () => {
9
+ NavigateAppPage.waitForPageDisplayed(BOOT_APP_TIMEOUT);
10
+ expect(NavigateAppPage.isPageLoaded()).toBeTruthy();
11
+ });
12
+
13
+ it('Click and navigate to Checkbox test page', () => {
14
+ /* Scroll to component test page button in scrollview if not already visible*/
15
+ CheckboxPageObject.scrollToComponentButton();
16
+ CheckboxPageObject.waitForButtonDisplayed(PAGE_TIMEOUT);
17
+
18
+ /* Click on component button to navigate to test page */
19
+ NavigateAppPage.clickAndGoToCheckboxPage();
20
+ CheckboxPageObject.waitForPageDisplayed(PAGE_TIMEOUT);
21
+
22
+ expect(CheckboxPageObject.isPageLoaded()).toBeTruthy();
23
+ });
24
+ });
25
+
26
+ describe('Checkbox Accessibility Testing', () => {
27
+ /* Scrolls and waits for the Checkbox to be visible on the Test Page */
28
+ beforeEach(() => {
29
+ CheckboxPageObject.scrollToTestElement();
30
+ CheckboxPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
31
+ });
32
+
33
+ it('Checkbox - Validate accessibilityRole is correct', () => {
34
+ expect(CheckboxPageObject.getAccessibilityRole()).toEqual(CHECKBOX_A11Y_ROLE);
35
+ });
36
+
37
+ it('Checkbox - Set accessibilityLabel', () => {
38
+ expect(CheckboxPageObject.getAccessibilityLabel(ComponentSelector.Primary)).toEqual(CHECKBOX_ACCESSIBILITY_LABEL);
39
+ });
40
+
41
+ it('Checkbox - Do not set accessibilityLabel -> Default to Checkbox label', () => {
42
+ expect(CheckboxPageObject.getAccessibilityLabel(ComponentSelector.Secondary)).toEqual(CHECKBOX_TEST_COMPONENT_LABEL);
43
+ });
44
+ });
45
+
46
+ /* These currently don't work on UWP because element.isSelected() always returns false. I will need to debug and figure
47
+ * out why this isn't supported on UWP, and if there's a potential workaround. Task #5747337 */
48
+ // describe('Checkbox Functional Testing', () => {
49
+ // /* Scrolls and waits for the Checkbox to be visible on the Test Page AND un-checks the Checkbox */
50
+ // beforeEach(() => {
51
+ // CheckboxPageObject.scrollToTestElement();
52
+ // CheckboxPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
53
+
54
+ // CheckboxPageObject.toggleCheckboxToUnchecked();
55
+ // });
56
+
57
+ // it("Click on a Checkbox -> Validate it toggles correctly AND calls the user's onChange", () => {
58
+ // /* Validate the Checkbox is initially toggled OFF */
59
+ // expect(CheckboxPageObject.isCheckboxChecked()).toBeFalsy();
60
+ // console.log('Checkbox is checked: ' + CheckboxPageObject.isCheckboxChecked());
61
+
62
+ // /* Click on the Checkbox to toggle on */
63
+ // CheckboxPageObject.clickComponent();
64
+
65
+ // CheckboxPageObject.waitForCheckboxChecked(PAGE_TIMEOUT);
66
+
67
+ // expect(CheckboxPageObject.didOnChangeCallbackFire()).toBeTruthy();
68
+
69
+ // /* Validate the Checkbox is toggled ON */
70
+ // expect(CheckboxPageObject.isCheckboxChecked()).toBeTruthy();
71
+
72
+ // CheckboxPageObject.clickComponent();
73
+
74
+ // /* Validate the Checkbox is toggled OFF */
75
+ // expect(CheckboxPageObject.isCheckboxChecked()).toBeFalsy();
76
+ // });
77
+
78
+ // it('Click the "Spacebar" on a Checkbox and verify it toggles', () => {
79
+ // /* Presses the "space bar" to select the Checkbox */
80
+ // CheckboxPageObject.sendKey(CHECKBOX_TEST_COMPONENT, Keys.Spacebar);
81
+ // CheckboxPageObject.waitForCheckboxChecked(PAGE_TIMEOUT);
82
+
83
+ // /* Validate the Checkbox is selected */
84
+ // expect(CheckboxPageObject.isCheckboxChecked()).toBeTruthy();
85
+ // });
86
+ // });
@@ -1,4 +1,4 @@
1
- import { TEXT_TESTPAGE, TEXT_TEST_COMPONENT, HOMEPAGE_TEXT_BUTTON } from '../../../FluentTester/TestComponents/Text/consts';
1
+ import { TEXT_TESTPAGE, FIRST_TEXT_COMPONENT, HOMEPAGE_TEXT_BUTTON } from '../../../FluentTester/TestComponents/Text/consts';
2
2
  import { BasePage, By } from '../../common/BasePage.macos';
3
3
 
4
4
  class TextPageObject extends BasePage {
@@ -14,7 +14,7 @@ class TextPageObject extends BasePage {
14
14
  }
15
15
 
16
16
  get _primaryComponent() {
17
- return By(TEXT_TEST_COMPONENT);
17
+ return By(FIRST_TEXT_COMPONENT);
18
18
  }
19
19
 
20
20
  get _pageButton() {
@@ -1,4 +1,9 @@
1
- import { TEXT_TESTPAGE, TEXT_TEST_COMPONENT, HOMEPAGE_TEXT_BUTTON } from '../../../FluentTester/TestComponents/Text/consts';
1
+ import {
2
+ TEXT_TESTPAGE,
3
+ FIRST_TEXT_COMPONENT,
4
+ HOMEPAGE_TEXT_BUTTON,
5
+ SECOND_TEXT_COMPONENT,
6
+ } from '../../../FluentTester/TestComponents/Text/consts';
2
7
  import { BasePage, By } from '../../common/BasePage.win';
3
8
 
4
9
  class TextPageObject extends BasePage {
@@ -14,7 +19,11 @@ class TextPageObject extends BasePage {
14
19
  }
15
20
 
16
21
  get _primaryComponent() {
17
- return By(TEXT_TEST_COMPONENT);
22
+ return By(FIRST_TEXT_COMPONENT);
23
+ }
24
+
25
+ get _secondaryComponent() {
26
+ return By(SECOND_TEXT_COMPONENT);
18
27
  }
19
28
 
20
29
  get _pageButton() {
@@ -1,6 +1,8 @@
1
1
  import NavigateAppPage from '../../common/NavigateAppPage.win';
2
2
  import TextPageObject from '../pages/TextPageObject.win';
3
+ import { ComponentSelector } from '../../common/BasePage.win';
3
4
  import { TEXT_A11Y_ROLE, PAGE_TIMEOUT, BOOT_APP_TIMEOUT } from '../../common/consts';
5
+ import { TEXT_ACCESSIBILITY_LABEL, TEXT_COMPONENT_CONTENT } from '../../../FluentTester/TestComponents/Text/consts';
4
6
 
5
7
  // Before testing begins, allow up to 60 seconds for app to open
6
8
  describe('Text Testing Initialization', function () {
@@ -23,9 +25,20 @@ describe('Text Testing Initialization', function () {
23
25
  });
24
26
 
25
27
  describe('Text Accessibility Testing', () => {
26
- it('Text - Validate accessibilityRole is correct', () => {
28
+ beforeEach(() => {
27
29
  TextPageObject.scrollToTestElement();
28
30
  TextPageObject.waitForPrimaryElementDisplayed(PAGE_TIMEOUT);
31
+ });
32
+
33
+ it('Text - Validate accessibilityRole is correct', () => {
29
34
  expect(TextPageObject.getAccessibilityRole()).toEqual(TEXT_A11Y_ROLE);
30
35
  });
36
+
37
+ it('Text - Set accessibilityLabel', () => {
38
+ expect(TextPageObject.getAccessibilityLabel(ComponentSelector.Primary)).toEqual(TEXT_ACCESSIBILITY_LABEL);
39
+ });
40
+
41
+ it('Text - Do not accessibilityLabel -> Default to content', () => {
42
+ expect(TextPageObject.getAccessibilityLabel(ComponentSelector.Secondary)).toEqual(TEXT_COMPONENT_CONTENT);
43
+ });
31
44
  });
@@ -52,6 +52,18 @@ export class BasePage {
52
52
  return this._pageButton.isDisplayed();
53
53
  }
54
54
 
55
+ clickComponent(): void {
56
+ this._primaryComponent.click();
57
+ }
58
+
59
+ /* ****TODO****: I need to better use the ComponentSelector for this. We shouldn't have the spec needing to import the constant string */
60
+ sendKey(componentID?: string, key?: string): void {
61
+ const component = By(componentID);
62
+ if (component.isDisplayed()) {
63
+ component.addValue(key); // Adding a value sends the key on that component
64
+ }
65
+ }
66
+
55
67
  /* Scrolls until the desired test page's button is displayed. We use the scroll viewer UI element as the point to start scrolling.
56
68
  * We use a negative number as the Y-coordinate because that enables us to scroll downwards */
57
69
  scrollToComponentButton(): void {
@@ -109,6 +121,7 @@ export class BasePage {
109
121
  while (!this._primaryComponent.isDisplayed()) {
110
122
  driver.touchScroll(COMPONENT_SCROLL_COORDINATES.x, COMPONENT_SCROLL_COORDINATES.y, $('~ScrollViewAreaForComponents').elementId);
111
123
  }
124
+ driver.touchScroll(COMPONENT_SCROLL_COORDINATES.x, COMPONENT_SCROLL_COORDINATES.y, $('~ScrollViewAreaForComponents').elementId);
112
125
  }
113
126
 
114
127
  /* A method that allows the caller to pass in a condition. A wrapper for waitUntil(). Once testing becomes more extensive,
@@ -13,3 +13,14 @@ export const TEXT_A11Y_ROLE = 'ControlType.Text';
13
13
  /* Jasmine Timeouts */
14
14
  export const BOOT_APP_TIMEOUT = 60000;
15
15
  export const PAGE_TIMEOUT = 15000;
16
+
17
+ /* Keyboard Key Constants */
18
+ export const enum Keys {
19
+ Up_Arrow = 'ArrowUp',
20
+ Right_Arrow = 'ArrowRight',
21
+ Down_Arrow = 'ArrowDown',
22
+ Left_Arrow = 'ArrowLeft',
23
+ Spacebar = ' ',
24
+ Enter = 'Enter',
25
+ Escape = 'Escape',
26
+ }
@@ -0,0 +1,43 @@
1
+ import { Button } from '@fluentui-react-native/experimental-button';
2
+ import { Text } from '@fluentui-react-native/experimental-text';
3
+ import { Icon } from '@fluentui-react-native/icon';
4
+ import * as React from 'react';
5
+ import { View } from 'react-native';
6
+ import { commonTestStyles, stackStyle } from '../Common/styles';
7
+
8
+ export const ButtonHOCTest: React.FunctionComponent = () => {
9
+ const buttonRef = React.useRef(null);
10
+ const CustomText = Text.customize({ fontSize: 'header', color: 'hotpink' });
11
+ const CustomButton = Button.customize({ backgroundColor: 'pink' });
12
+ const ComposedButton = Button.compose({
13
+ slots: {
14
+ root: View,
15
+ icon: Icon,
16
+ content: CustomText,
17
+ },
18
+ slotProps: {
19
+ content: {
20
+ style: { marginTop: -1, marginBottom: 1, marginStart: 0, marginEnd: -2 },
21
+ },
22
+ },
23
+ });
24
+
25
+ return (
26
+ <View style={stackStyle}>
27
+ <CustomButton style={commonTestStyles.vmargin} componentRef={buttonRef}>
28
+ Customized Button with ref
29
+ </CustomButton>
30
+ <Button
31
+ style={commonTestStyles.vmargin}
32
+ onClick={() => {
33
+ if (buttonRef.current) {
34
+ buttonRef.current.focus();
35
+ }
36
+ }}
37
+ >
38
+ Press to focus Customized Button
39
+ </Button>
40
+ <ComposedButton style={commonTestStyles.vmargin}>Composed button using customized Text for text slot</ComposedButton>
41
+ </View>
42
+ );
43
+ };
@@ -7,6 +7,7 @@ import { ButtonIconTest } from './ButtonIconTestSection';
7
7
  import { ButtonSizeTest } from './ButtonSizeTestSection';
8
8
  import { ButtonShapeTest } from './ButtonShapeTestSection';
9
9
  import { E2EButtonExperimentalTest } from './E2EButtonTest';
10
+ import { ButtonHOCTest } from './ButtonHOCTestSection';
10
11
 
11
12
  const buttonSections: TestSection[] = [
12
13
  {
@@ -30,6 +31,10 @@ const buttonSections: TestSection[] = [
30
31
  name: 'Sizes',
31
32
  component: ButtonSizeTest,
32
33
  },
34
+ {
35
+ name: 'Customize, Compose, and Ref',
36
+ component: ButtonHOCTest,
37
+ },
33
38
  {
34
39
  name: 'E2E Button Testing',
35
40
  component: E2EButtonExperimentalTest,
@@ -3,17 +3,17 @@ import { View } from 'react-native';
3
3
  import { Text } from '@fluentui/react-native';
4
4
  import { Stack } from '@fluentui-react-native/stack';
5
5
  import { stackStyle } from '../Common/styles';
6
- import { TEXT_TEST_COMPONENT, TEXT_ACCESSIBILITY_LABEL, TEXT_NO_A11Y_LABEL_COMPONENT, TEXT_TEST_COMPONENT_LABEL } from './consts';
6
+ import { FIRST_TEXT_COMPONENT, TEXT_ACCESSIBILITY_LABEL, SECOND_TEXT_COMPONENT, TEXT_COMPONENT_CONTENT } from './consts';
7
7
 
8
8
  export const E2ETextTest: React.FunctionComponent = () => {
9
9
  return (
10
10
  <View>
11
11
  <Stack style={stackStyle} gap={5}>
12
- <Text variant="captionStandard" testID={TEXT_TEST_COMPONENT} accessibilityLabel={TEXT_ACCESSIBILITY_LABEL}>
12
+ <Text variant="captionStandard" testID={FIRST_TEXT_COMPONENT} accessibilityLabel={TEXT_ACCESSIBILITY_LABEL}>
13
13
  Testing Text Component - AccessibilityLabel Set
14
14
  </Text>
15
- <Text variant="captionStandard" testID={TEXT_NO_A11Y_LABEL_COMPONENT}>
16
- {TEXT_TEST_COMPONENT_LABEL}
15
+ <Text variant="captionStandard" testID={SECOND_TEXT_COMPONENT}>
16
+ {TEXT_COMPONENT_CONTENT}
17
17
  </Text>
18
18
  </Stack>
19
19
  </View>
@@ -2,9 +2,9 @@ export const HOMEPAGE_TEXT_BUTTON = 'Homepage_Text_Button';
2
2
  export const TEXT_TESTPAGE = 'Text_TestPage';
3
3
 
4
4
  /* E2E Testing Text 1 */
5
- export const TEXT_TEST_COMPONENT = 'Text_Test_Component'; // A component on each specific test page
5
+ export const FIRST_TEXT_COMPONENT = 'Text_Test_Component'; // A component on each specific test page
6
6
  export const TEXT_ACCESSIBILITY_LABEL = 'E2E testing Text_Test_Component accessibility label';
7
7
 
8
8
  /* E2E Testing Text 2 */
9
- export const TEXT_NO_A11Y_LABEL_COMPONENT = 'Text_No_A11y_label_Component';
10
- export const TEXT_TEST_COMPONENT_LABEL = 'Test Text2 - No Accessibility Label'; // A component on each specific test page
9
+ export const SECOND_TEXT_COMPONENT = 'Text_No_A11y_label_Component';
10
+ export const TEXT_COMPONENT_CONTENT = 'Test Text2 - No Accessibility Label'; // A component on each specific test page