Skip to content

Commit 8bd92d7

Browse files
amgleitmanAdam Gleitman
andauthored
Add spacing E2E tests (#2446)
* Add spacing E2E tests * Change files * Add test ID to Spacing test page * Change files * Remove macOS and Win E2E tests since they don't have the Spacing test page yet Co-authored-by: Adam Gleitman <[email protected]>
1 parent d5c4051 commit 8bd92d7

File tree

6 files changed

+68
-0
lines changed

6 files changed

+68
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { SPACING_TESTPAGE, HOMEPAGE_SPACING_BUTTON } from '../../../../fluent-tester/src/TestComponents/Spacing/consts';
2+
import { BasePage, By } from '../../common/BasePage';
3+
4+
class SpacingTokensPageObject extends BasePage {
5+
/*****************************************/
6+
/**************** Getters ****************/
7+
/*****************************************/
8+
get _testPage() {
9+
return By(SPACING_TESTPAGE);
10+
}
11+
12+
get _pageName() {
13+
return SPACING_TESTPAGE;
14+
}
15+
16+
get _pageButton() {
17+
return By(HOMEPAGE_SPACING_BUTTON);
18+
}
19+
}
20+
21+
export default new SpacingTokensPageObject();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import NavigateAppPage from '../../common/NavigateAppPage';
2+
import SpacingTokensPageObject from '../pages/SpacingTokensPageObject';
3+
import { PAGE_TIMEOUT, BOOT_APP_TIMEOUT } from '../../common/consts';
4+
5+
// Before testing begins, allow up to 60 seconds for app to open
6+
describe('Spacing Tokens Testing Initialization', function () {
7+
it('Wait for app load', async () => {
8+
await NavigateAppPage.waitForPageDisplayed(BOOT_APP_TIMEOUT);
9+
await expect(await NavigateAppPage.isPageLoaded()).toBeTruthy();
10+
});
11+
12+
it('Click and navigate to Spacing tokens test page', async () => {
13+
await SpacingTokensPageObject.mobileScrollToComponentButton();
14+
await SpacingTokensPageObject.waitForButtonDisplayed(PAGE_TIMEOUT);
15+
16+
/* Click on component button to navigate to test page */
17+
await NavigateAppPage.clickAndGoToSpacingTokensPage();
18+
await SpacingTokensPageObject.waitForPageDisplayed(PAGE_TIMEOUT);
19+
20+
await expect(await SpacingTokensPageObject.isPageLoaded()).toBeTruthy();
21+
});
22+
});

apps/E2E/src/common/NavigateAppPage.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { HOMEPAGE_RADIO_GROUP_EXPERIMENTAL_BUTTON } from '../../../fluent-tester
2424
import { HOMEPAGE_SEPARATOR_BUTTON } from '../../../fluent-tester/src/TestComponents/Separator/consts';
2525
import { HOMEPAGE_SHADOW_BUTTON } from '../../../fluent-tester/src/TestComponents/Shadow/consts';
2626
import { HOMEPAGE_SHIMMER_BUTTON } from '../../../fluent-tester/src/TestComponents/Shimmer/consts';
27+
import { HOMEPAGE_SPACING_BUTTON } from '../../../fluent-tester/src/TestComponents/Spacing/consts';
2728
import { HOMEPAGE_STROKEWIDTH_BUTTON } from '../../../fluent-tester/src/TestComponents/StrokeWidth/consts';
2829
import { HOMEPAGE_SVG_BUTTON } from '../../../fluent-tester/src/TestComponents/Svg/consts';
2930
import { HOMEPAGE_SWITCH_BUTTON } from '../../../fluent-tester/src/TestComponents/Switch/consts';
@@ -136,6 +137,10 @@ class NavigateAppPage extends BasePage {
136137
await (await this.shimmerPage).click();
137138
}
138139

140+
async clickAndGoToSpacingTokensPage() {
141+
await (await this.spacingTokensPage).click();
142+
}
143+
139144
async clickAndGoToStrokeWidthTokensPage() {
140145
await (await this.strokeWidthTokensPage).click();
141146
}
@@ -284,6 +289,10 @@ class NavigateAppPage extends BasePage {
284289
return By(HOMEPAGE_STROKEWIDTH_BUTTON);
285290
}
286291

292+
private get spacingTokensPage() {
293+
return By(HOMEPAGE_SPACING_BUTTON);
294+
}
295+
287296
private get svgPage() {
288297
return By(HOMEPAGE_SVG_BUTTON);
289298
}

apps/fluent-tester/src/TestComponents/Spacing/SpacingTest.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as React from 'react';
44
import { Text, View } from 'react-native';
55
import { stackStyle } from '../Common/styles';
66
import { Test, TestSection, PlatformStatus } from '../Test';
7+
import { SPACING_TESTPAGE } from './consts';
78

89
const BasicUsage: React.FunctionComponent = () => {
910
function spacingExample(tokenName: string, spacing?: number | string) {
@@ -62,6 +63,7 @@ export const SpacingTokensTest: React.FunctionComponent = () => {
6263
const spacingSections: TestSection[] = [
6364
{
6465
name: 'Basic Usage',
66+
testID: SPACING_TESTPAGE,
6567
component: BasicUsage,
6668
},
6769
];
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Add spacing E2E tests",
4+
"packageName": "@fluentui-react-native/e2e-testing",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "Add spacing E2E tests",
4+
"packageName": "@fluentui-react-native/tester",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

0 commit comments

Comments
 (0)