Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix smoke tests for Expo 37 SDK #1247

Merged
merged 21 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/smoke/package/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"IOS_SIMULATOR": "iPhone8",
"IOS_VERSION": "12.4",
"CODE_VERSION": "1.40.2",
"EXPO_XDL_VERSION": "57.5.2",
"EXPO_XDL_VERSION": "57.8.10",
"RN_VERSION": "0.62.0",
"PURE_RN_VERSION": "0.59.8",
"PURE_EXPO_VERSION": "36.0.2"
Expand Down
2 changes: 1 addition & 1 deletion test/smoke/package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"mocha": "node ./node_modules/tslint/bin/tslint -c tslint.json --project tsconfig.json 'src/**' && tsc && node ./node_modules/mocha/bin/_mocha --reporter mocha-multi-reporters --reporter-options configFile=./mochaReporterConfig.json"
},
"devDependencies": {
"@expo/xdl": "^57.6.2",
"@expo/xdl": "^57.8.10",
"@types/clipboardy": "^2.0.1",
"@types/gulp-filter": "^3.0.33",
"@types/mkdirp": "^1.0.0",
Expand Down
1 change: 1 addition & 0 deletions test/smoke/package/src/debugAndroid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function setup(testParameters?: TestRunArguments) {
// TODO Add listener to trigger that child expo app has been ran instead of using timeout
console.log(`${testName}: Waiting ${SmokeTestsConstants.expoAppBuildAndInstallTimeout}ms until Expo app is ready...`);
await sleep(SmokeTestsConstants.expoAppBuildAndInstallTimeout);
await AppiumHelper.disableDevMenuInformationalMsg(clientInited, Platform.Android);
await AppiumHelper.enableRemoteDebugJS(clientInited, Platform.Android);
await app.workbench.debug.waitForDebuggingToStart();
console.log(`${testName}: Debugging started`);
Expand Down
2 changes: 1 addition & 1 deletion test/smoke/package/src/debugIos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function setup(testParameters?: TestRunArguments) {
await sleep(SmokeTestsConstants.expoAppBuildAndInstallTimeout);

await AppiumHelper.disableExpoErrorRedBox(clientInited);
await AppiumHelper.disableDevMenuInformationalMsg(clientInited);
await AppiumHelper.disableDevMenuInformationalMsg(clientInited, Platform.iOS_Expo);
await AppiumHelper.enableRemoteDebugJS(clientInited, Platform.iOS_Expo);
await sleep(5 * 1000);

Expand Down
25 changes: 15 additions & 10 deletions test/smoke/package/src/helpers/appiumHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ export class AppiumHelper {
[Platform.iOS_Expo]: "//XCUIElementTypeOther[@name='Reload JS Bundle']",
},
RN_ENABLE_REMOTE_DEBUGGING_BUTTON: {
[Platform.Android]: "//*[@text='Debug JS Remotely' or @text='Debug']",
[Platform.Android]: "//*[@text='Debug JS Remotely' or @text='Debug' or @text='Debug Remote JS']",
[Platform.iOS]: "//XCUIElementTypeButton[@name='Debug JS Remotely' or @name='Debug']",
[Platform.iOS_Expo]: "//XCUIElementTypeOther[@name='Debug Remote JS']",
[Platform.iOS_Expo]: "//XCUIElementTypeOther[@name='Debug Remote JS']",
},
RN_STOP_REMOTE_DEBUGGING_BUTTON: {
[Platform.Android]: "//*[@text='Stop Remote JS Debugging' or @text='Stop Debugging']",
[Platform.Android]: "//*[@text='Stop Remote JS Debugging' or @text='Stop Debugging' or @text='Stop Remote Debugging']",
[Platform.iOS]: "//XCUIElementTypeButton[@name='Stop Remote JS Debugging' or @name='Stop Debugging']",
[Platform.iOS_Expo]: "//XCUIElementTypeOther[@name='Stop Remote JS Debugging']",
[Platform.iOS_Expo]: "//XCUIElementTypeOther[@name='Stop Remote Debugging']",
},
RN_DEV_MENU_CANCEL: {
[Platform.Android]: "//*[@text='Cancel']",
Expand All @@ -48,6 +48,11 @@ export class AppiumHelper {
[Platform.iOS]: "", // todo
[Platform.iOS_Expo]: "", // todo
},
GOT_IT_BUTTON: {
[Platform.Android]: "//*[@text='Got it']",
[Platform.iOS]: "",
[Platform.iOS_Expo]: "//XCUIElementTypeOther[@name='Got it']",
},
};

public static runAppium() {
Expand Down Expand Up @@ -235,10 +240,10 @@ export class AppiumHelper {
}
}

// New Expo versions shows DevMenu on iOS at first launch with informational message,
// New Expo versions shows DevMenu at first launch with informational message,
// it is better to disable this message and then call DevMenu ourselves
public static async disableDevMenuInformationalMsg(client: AppiumClient) {
const GOT_IT_BUTTON = "//XCUIElementTypeOther[@name='Got it']";
public static async disableDevMenuInformationalMsg(client: AppiumClient, platform: Platform) {
const GOT_IT_BUTTON = this.XPATH.GOT_IT_BUTTON[platform];
if (await client.isExisting(GOT_IT_BUTTON)) {
console.log("*** Expo DevMenu informational message found, disabling...");
await client.click(GOT_IT_BUTTON);
Expand Down Expand Up @@ -283,13 +288,13 @@ export class AppiumHelper {
console.log(`*** Opening Expo app via Project URL`);
console.log(`*** Pressing "Add" button...`);

const EXPO_ADD_BUTTON = `(//XCUIElementTypeOther[@name=""])[2]`;
const EXOP_PROJECTS_PAGE = "(//XCUIElementTypeOther[@name=\"CLIPBOARD Press ⌘+v to move clipboard to simulator. RECENTLY IN DEVELOPMENT HELP Sign in to your Expo account to see the projects you have recently been working on. RECENTLY OPENED CLEAR You haven't opened any projects recently. Device ID: bbcb-0dc2 Client version: 2.15.3.10122 Supported SDKs: 34, 35, 36, 37 Projects \"])[3]";
SounD120 marked this conversation as resolved.
Show resolved Hide resolved
const FIND_A_PROJECT_ELEMENT = `//XCUIElementTypeTextField`;
const OPEN_BUTTON = `//XCUIElementTypeButton[@name="Open"]`;

await client
.waitForExist(EXPO_ADD_BUTTON, 30 * 1000)
.click(EXPO_ADD_BUTTON);
.waitForExist(EXOP_PROJECTS_PAGE, 30 * 1000)
SounD120 marked this conversation as resolved.
Show resolved Hide resolved
.leftClick(EXOP_PROJECTS_PAGE, 365, 45);
SounD120 marked this conversation as resolved.
Show resolved Hide resolved

console.log(`*** Pasting ${expoURL} to search field...`);
// Run Expo app by expoURL
Expand Down
Loading