Skip to content

Commit

Permalink
Merge pull request #1608 from wordpress-mobile/fix/xcode-11
Browse files Browse the repository at this point in the history
Update tests for Xcode 11/iOS 13
  • Loading branch information
SergioEstevao authored Dec 9, 2019
2 parents f47c127 + a8d56bf commit 7644a01
Show file tree
Hide file tree
Showing 8 changed files with 926 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
path: ./reports/test-results
ios-device-checks:
macos:
xcode: "10.2.0"
xcode: "11.2.1"
steps:
- checkout
- checkout-gutenberg
Expand Down
3 changes: 3 additions & 0 deletions __device-tests__/gutenberg-editor-block-insertion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
isLocalEnvironment,
stopDriver,
isAndroid,
swipeDown,
clickMiddleOfElement,
} from './helpers/utils';
import testData from './helpers/test-data';
Expand Down Expand Up @@ -39,6 +40,7 @@ describe( 'Gutenberg Editor tests for Block insertion', () => {
} );

it( 'should be able to see visual editor', async () => {
// wait for the block editor to load
await expect( editorPage.getBlockList() ).resolves.toBe( true );
} );

Expand Down Expand Up @@ -100,6 +102,7 @@ describe( 'Gutenberg Editor tests for Block insertion', () => {
await editorPage.dismissKeyboard();
}

await swipeDown( driver );
const titleElement = await editorPage.getTitleElement( { autoscroll: true } );
await titleElement.click();
await titleElement.click();
Expand Down
10 changes: 5 additions & 5 deletions __device-tests__/helpers/caps.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
exports.ios12 = {
exports.ios = {
browserName: '',
platformName: 'iOS',
platformVersion: '12.2',
deviceName: 'iPhone Simulator',
platformVersion: '13.0',
deviceName: 'iPhone 11 Simulator',
os: 'iOS',
deviceOrientation: 'portrait',
automationName: 'XCUITest',
appiumVersion: '1.13.0', // SauceLabs requires appiumVersion to be specified.
appiumVersion: '1.15.0', // SauceLabs requires appiumVersion to be specified.
app: undefined, // will be set later, locally this is relative to root of project
};

Expand All @@ -20,6 +20,6 @@ exports.android8 = {
appPackage: 'com.gutenberg',
appActivity: 'com.gutenberg.MainActivity',
deviceOrientation: 'portrait',
appiumVersion: '1.13.0',
appiumVersion: '1.15.0',
app: undefined,
};
8 changes: 5 additions & 3 deletions __device-tests__/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import path from 'path';
* Internal dependencies
*/
import serverConfigs from './serverConfigs';
import { ios12, android8 } from './caps';
import { ios, android8 } from './caps';
import AppiumLocal from './appium-local';
import _ from 'underscore';

Expand Down Expand Up @@ -64,7 +64,7 @@ const setupDriver = async () => {
} catch ( err ) {
// Ignore error here, Appium is probably already running (Appium desktop has its own server for instance)
// eslint-disable-next-line no-console
console.log( 'Could not start Appium server', err.toString() );
await console.log( 'Could not start Appium server', err.toString() );
}
}

Expand Down Expand Up @@ -92,9 +92,11 @@ const setupDriver = async () => {
desiredCaps.app = `sauce-storage:Gutenberg-${ safeBranchName }.apk`; // App should be preloaded to sauce storage, this can also be a URL
}
} else {
desiredCaps = _.clone( ios12 );
desiredCaps = _.clone( ios );
if ( isLocalEnvironment() ) {
desiredCaps.app = path.resolve( localIOSAppPath );
delete desiredCaps.platformVersion;
desiredCaps.deviceName = 'iPhone 11';
} else {
desiredCaps.app = `sauce-storage:Gutenberg-${ safeBranchName }.app.zip`; // App should be preloaded to sauce storage, this can also be a URL
}
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class EditorPage {
}

async getBlockList() {
return this.driver.hasElementByAccessibilityId( 'block-list' );
return await this.driver.hasElementByAccessibilityId( 'block-list' );
}

// Finds the wd element for new block that was added and sets the element attribute
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@wordpress/babel-preset-default": "^4.0.0",
"@wordpress/eslint-plugin": "^2.0.0",
"@wordpress/jest-preset-default": "^4.0.0",
"appium": "^1.13.0",
"appium": "1.16.0-rc.1",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^24.1.0",
Expand Down Expand Up @@ -111,7 +111,7 @@
"test:e2e:build-app:android": "yarn test:e2e:bundle:android && cd android && ./gradlew clean && ./gradlew assembleDebug",
"test:e2e:install-app:android": "cd android && ./gradlew installDebug",
"test:e2e:bundle:ios": "react-native bundle --reset-cache --platform=ios --dev=false --minify false --entry-file=index.js --bundle-output=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/gutenberg.app/main.jsbundle --assets-dest=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/gutenberg.app",
"test:e2e:build-app:ios": "react-native run-ios --configuration Release --no-packager && yarn test:e2e:bundle:ios && WORK_DIR=$(pwd) && cd ./ios/build/gutenberg/Build/Products/Release-iphonesimulator && zip -r $WORK_DIR/ios/Gutenberg.app.zip gutenberg.app",
"test:e2e:build-app:ios": "react-native run-ios --configuration Release --no-packager --simulator=\"iPhone 11\" && yarn test:e2e:bundle:ios && WORK_DIR=$(pwd) && cd ./ios/build/gutenberg/Build/Products/Release-iphonesimulator && zip -r $WORK_DIR/ios/Gutenberg.app.zip gutenberg.app",
"test:e2e:install-app:ios": "yarn test:e2e:build-app:ios",
"flow": "flow",
"prettier": "prettier-eslint --write $npm_package_config_jsfiles $npm_package_config_scssfiles",
Expand Down
Loading

0 comments on commit 7644a01

Please sign in to comment.