Skip to content

Commit d9d5da9

Browse files
Add E2E Testing Variable (#3620)
* Adding resolutions to specific packages with security vulnerabilities * Remove * Adding whitespace * Revert * Removing unused file * Adding global var * Adding native var * Revert changes * Change files
1 parent 4a3336c commit d9d5da9

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

apps/E2E/src/ContextualMenu/specs/ContextualMenu.spec.win.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ describe('ContextualMenu Functional Tests', () => {
2323
/* Scrolls and waits for the ContextualMenu to be visible on the Test Page */
2424
beforeEach(async () => {
2525
await ContextualMenuPageObject.scrollToTestElement(await ContextualMenuPageObject._contextualMenu);
26-
27-
await ContextualMenuPageObject.closeContextualMenu(); // Reset ContextualMenu state for next test
2826
});
2927

3028
it('Click on ContextualMenu Button. Validate that the menu opens by checking if its items are displayed.', async () => {

apps/E2E/src/common/BasePage.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616
const DUMMY_CHAR = '';
1717
// The E2ETEST_PLATFORM environment variable should be set in the beforeSession hook in the wdio.conf file for the respective platform
1818
const PLATFORM = process.env['E2ETEST_PLATFORM'] as Platform;
19+
// NATIVE_TESTING should be set to true when testing natively. Should be false when testing in the FURN repo
20+
const NATIVE_TESTING = process.env['NATIVE_TESTING'] == 'true';
1921
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)
2022

2123
let rootView: WebdriverIO.Element | null = null;
@@ -384,6 +386,9 @@ export abstract class BasePage {
384386
* Unfortunately, afterEach() is designed for setup/teardown - not for determining if a test should fail or not.
385387
* */
386388
async didAssertPopup(): Promise<boolean> {
389+
// Natively we have task libs already looking for asserts, we don't need this logic
390+
if (NATIVE_TESTING) return false;
391+
387392
/* On Android, we can't get the window handles. Instead, we check if the page is still visible.
388393
* In case of any error, a full page crash message is displayed and the test page is no longer accessible. */
389394
if (PLATFORM === 'android') {

apps/E2E/wdio.conf.win32.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ exports.config = {
102102
beforeSession: (/* config, capabilities, specs */) => {
103103
fs.mkdirSync('./errorShots', { recursive: true });
104104
process.env['E2ETEST_PLATFORM'] = 'win32';
105+
process.env['NATIVE_TESTING'] = false;
105106
},
106107
/**
107108
* Gets executed before test execution begins. At this point you can access to all global
@@ -147,7 +148,7 @@ exports.config = {
147148
*/
148149
afterTest: async (test, context, results) => {
149150
const resultString = results.passed ? 'Passed' : 'Failed';
150-
console.log(`\nTest Case: "${test.description}".\nResult: "${resultString}".\nDuration: "${(results.duration/600).toFixed(2)}s". \n`);
151+
console.log(`\nTest Case: "${test.description}".\nResult: "${resultString}".\nDuration: "${(results.duration / 600).toFixed(2)}s". \n`);
151152

152153
// if test passed, ignore, else take and save screenshot. Unless it's the first test that boots the app,
153154
// it may be useful to have a screenshot of the app on load.
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 env var for e2e testing",
4+
"packageName": "@fluentui-react-native/e2e-testing",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

0 commit comments

Comments
 (0)