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

ci: add xcode 15.1 pattern #2289

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
afa9c19
test: use ~Allow locator for iOS 17
mwakizaka Dec 27, 2023
adc3d64
test: wait 1000 seconds for OK button
mwakizaka Dec 28, 2023
e511750
fix: assign derivedDataPath cap to skip WDA project cleanup
mwakizaka Dec 28, 2023
2963a24
fix: assign derivedDataPath cap to skip WDA project cleanup
mwakizaka Dec 28, 2023
3f1385a
fix: assign derivedDataPath for basic tests
mwakizaka Dec 29, 2023
aa13a83
fix: should get all key-pairs
mwakizaka Jan 2, 2024
071075e
fix: assign derivedDataPath for device tests
mwakizaka Jan 3, 2024
c6bcc46
fix: assign derivedDataPath for web tests
mwakizaka Jan 4, 2024
8fe97f5
fix: assign derivedDataPath for driver tests
mwakizaka Jan 4, 2024
15aa6cf
ci: add xcode 15.1 pattern
mwakizaka Jan 4, 2024
2d55148
ci: retrieve iOS simulator udid with jq
mwakizaka Jan 5, 2024
715a8f9
test: update initTimeout for iOS 17+
mwakizaka Jan 8, 2024
0d70a52
test: extend mocha timeout to 1920000 milliseconds
mwakizaka Jan 9, 2024
44f2f9e
ci: temporary disable iOS 15 and 16 tests
mwakizaka Jan 9, 2024
fab6794
test: update initTimeout and mocha timeout further for iOS 17+
mwakizaka Jan 9, 2024
caa482b
ci: add timestamp to appium log
mwakizaka Jan 9, 2024
ae8115f
ci: extend initTimeout, MOCHA_TIMEOUT and keepAliveTimeout further more
mwakizaka Jan 23, 2024
028df90
test: terminate AUT in after hook
mwakizaka Jan 24, 2024
0e6eaab
ci: always use prebuilt WDA on CI
mwakizaka Jan 24, 2024
3300e5e
test: revert timeouts
mwakizaka Jan 24, 2024
dfab212
revert: "test: revert timeouts"
mwakizaka Jan 24, 2024
2c6f8a3
test: try changing device to reuse already installed WDA
mwakizaka Jan 27, 2024
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
25 changes: 12 additions & 13 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,15 @@ jobs:
- driver
- web
- long
xcodeVersion: ['13.4', '14.2']
xcodeVersion: ['15.1']
include:
- xcodeVersion: '13.4'
iosVersion: '15.5'
deviceName: 'iPhone 12'
tvosVersion: '15.4'
tvosDeviceName: 'Apple TV'
platform: macos-12
- xcodeVersion: '14.2'
iosVersion: '16.2'
deviceName: 'iPhone 13'
- xcodeVersion: '15.1'
iosVersion: '17.2'
deviceName: 'iPhone SE (3rd generation)'
deviceNameForTouchId: 'iPhone SE (3rd generation)'
deviceNameForSafariIpad: 'iPad (10th generation)'
skipTvOs: true
platform: macos-12
platform: macos-13
fail-fast: false

runs-on: ${{ matrix.platform }}
Expand Down Expand Up @@ -83,14 +79,15 @@ jobs:
--port=$APPIUM_TEST_SERVER_PORT \
--address=$APPIUM_TEST_SERVER_HOST \
--relaxed-security \
--keep-alive-timeout 1200 2>&1 > "$cwd/appium.log" &
--log-timestamp \
--keep-alive-timeout 5400 2>&1 > "$cwd/appium.log" &
sleep 5
popd
cat appium.log
name: Prepare the server

- run: |
target_sim_id=$(xcrun simctl list devices available | grep "${{ matrix.deviceName }} (" | cut -d "(" -f2 | cut -d ")" -f1)
target_sim_id=$(xcrun simctl list devices 'iOS ${{ matrix.iosVersion }}' -j | jq '.devices[]' | jq 'select(length > 0)' | jq -r 'map(select( .name == "${{ matrix.deviceName }}" and .isAvailable == true ))[0].udid')
open -Fn "$(xcode-select -p)/Applications/Simulator.app"
xcrun simctl bootstatus $target_sim_id -b
name: Preboot ${{ matrix.deviceName }}
Expand All @@ -104,6 +101,8 @@ jobs:

export DEVICE_NAME="${{ matrix.deviceName }}"
export PLATFORM_VERSION="${{ matrix.iosVersion }}"
export DEVICE_NAME_FOR_TOUCH_ID="${{ matrix.deviceNameForTouchId }}"
export DEVICE_NAME_FOR_SAFARI_IPAD="${{ matrix.deviceNameForSafariIpad }}"

export RESULTS_XML=test-results.xml
echo "{\"reporterEnabled\": \"spec, xunit\", \"xunitReporterOptions\": {\"output\": \"$RESULTS_XML\"}}" > reporter_config.json
Expand Down
14 changes: 9 additions & 5 deletions test/functional/basic/alert-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import B from 'bluebird';
import {retryInterval} from 'asyncbox';
import {amendCapabilities, UICATALOG_CAPS} from '../desired';
import {initSession, deleteSession, hasDefaultPrebuiltWDA, MOCHA_TIMEOUT} from '../helpers/session';
import {amendCapabilities, UICATALOG_CAPS, UICATALOG_BUNDLE_ID} from '../desired';
import {initSession, deleteSession, getUsePrebuiltWDACaps, MOCHA_TIMEOUT} from '../helpers/session';

chai.should();
chai.use(chaiAsPromised);
Expand All @@ -13,12 +13,16 @@ describe('XCUITestDriver - alerts -', function () {

let driver;
before(async function () {
const caps = amendCapabilities(UICATALOG_CAPS, {
'appium:usePrebuiltWDA': hasDefaultPrebuiltWDA(),
});
const caps = amendCapabilities(UICATALOG_CAPS, await getUsePrebuiltWDACaps());
driver = await initSession(caps);
});
after(async function () {
try {
await driver.terminateApp(UICATALOG_BUNDLE_ID);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
await deleteSession();
});

Expand Down
16 changes: 10 additions & 6 deletions test/functional/basic/basic-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import chaiSubset from 'chai-subset';
import B from 'bluebird';
import util from 'util';
import {retryInterval} from 'asyncbox';
import {amendCapabilities, UICATALOG_CAPS} from '../desired';
import {initSession, deleteSession, hasDefaultPrebuiltWDA, MOCHA_TIMEOUT} from '../helpers/session';
import {amendCapabilities, UICATALOG_CAPS, UICATALOG_BUNDLE_ID} from '../desired';
import {initSession, deleteSession, getUsePrebuiltWDACaps, MOCHA_TIMEOUT} from '../helpers/session';
import {GUINEA_PIG_PAGE} from '../web/helpers';
import sharp from 'sharp';

Expand All @@ -18,12 +18,16 @@ describe('XCUITestDriver - basics -', function () {

let driver;
before(async function () {
const caps = amendCapabilities(UICATALOG_CAPS, {
'appium:usePrebuiltWDA': hasDefaultPrebuiltWDA(),
});
const caps = amendCapabilities(UICATALOG_CAPS, await getUsePrebuiltWDACaps());
driver = await initSession(caps);
});
after(async function () {
try {
await driver.terminateApp(UICATALOG_BUNDLE_ID);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
await deleteSession();
});

Expand Down Expand Up @@ -117,7 +121,7 @@ describe('XCUITestDriver - basics -', function () {
describe('viewportScreenshot -', function () {
it('should get a cropped screenshot of the viewport without statusbar', async function () {
const {statusBarSize, scale} = await driver.execute('mobile: deviceScreenInfo');
const {viewportRect} = await driver.execute('mobile: viewportRect');
const viewportRect = await driver.execute('mobile: viewportRect');
const fullScreen = await driver.takeScreenshot();
const viewScreen = await driver.execute('mobile: viewportScreenshot');
const fullImg = sharp(Buffer.from(fullScreen, 'base64'));
Expand Down
14 changes: 9 additions & 5 deletions test/functional/basic/element-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import chaiAsPromised from 'chai-as-promised';
import _ from 'lodash';
import B from 'bluebird';
import {retryInterval} from 'asyncbox';
import {extractCapabilityValue, amendCapabilities, UICATALOG_CAPS} from '../desired';
import {initSession, deleteSession, hasDefaultPrebuiltWDA, MOCHA_TIMEOUT} from '../helpers/session';
import {extractCapabilityValue, amendCapabilities, UICATALOG_CAPS, UICATALOG_BUNDLE_ID} from '../desired';
import {initSession, deleteSession, getUsePrebuiltWDACaps, MOCHA_TIMEOUT} from '../helpers/session';
import {util} from 'appium/support';

chai.should();
Expand All @@ -15,12 +15,16 @@ describe('XCUITestDriver - elements -', function () {

let driver;
before(async function () {
const caps = amendCapabilities(UICATALOG_CAPS, {
'appium:usePrebuiltWDA': hasDefaultPrebuiltWDA(),
});
const caps = amendCapabilities(UICATALOG_CAPS, await getUsePrebuiltWDACaps());
driver = await initSession(caps);
});
after(async function () {
try {
await driver.terminateApp(UICATALOG_BUNDLE_ID);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
await deleteSession();
});

Expand Down
27 changes: 14 additions & 13 deletions test/functional/basic/face-id-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import {amendCapabilities, FACEIDAPP_CAPS} from '../desired';
import {initSession, deleteSession, hasDefaultPrebuiltWDA, MOCHA_TIMEOUT} from '../helpers/session';
import {amendCapabilities, extractCapabilityValue, FACEIDAPP_CAPS} from '../desired';
import {initSession, deleteSession, getUsePrebuiltWDACaps, MOCHA_TIMEOUT} from '../helpers/session';
import B from 'bluebird';
import {killAllSimulators} from '../helpers/simulator';
import {CLASS_CHAIN_SEARCH} from '../helpers/element';
import {util} from 'appium/support';
import {waitForCondition} from 'asyncbox';

chai.should();
Expand All @@ -14,9 +15,10 @@ const expect = chai.expect;
const DEFAULT_IMPLICIT_TIMEOUT_MS = 1000;
const FACE_ID_SELECTOR = '**/XCUIElementTypeStaticText[`label == "Face ID"`]';
const FACE_ID_LOCATOR = `${CLASS_CHAIN_SEARCH}:${FACE_ID_SELECTOR}`;
const ALLOW_SELECTOR =
const BIOMETRIC_SELECTOR =
'**/XCUIElementTypeStaticText[`label == "Do you want to allow “biometric” to use Face ID?"`]';
const ALLOW_LOCATOR = `${CLASS_CHAIN_SEARCH}:${ALLOW_SELECTOR}`;
const BIOMETRIC_LOCATOR = `${CLASS_CHAIN_SEARCH}:${BIOMETRIC_SELECTOR}`;
const ALLOW_LOCATOR = util.compareVersions(extractCapabilityValue(FACEIDAPP_CAPS, 'appium:platformVersion'), '>=', '17.0') ? '~Allow' : '~OK';

const MOCHA_RETRIES = process.env.CI ? 3 : 1;

Expand Down Expand Up @@ -68,9 +70,7 @@ if (!process.env.CI) {

describe('faceID enrollment functional tests applied to FaceID sample app', function () {
beforeEach(async function () {
const caps = amendCapabilities(FACEIDAPP_CAPS, {
'appium:usePrebuiltWDA': hasDefaultPrebuiltWDA(),
});
const caps = amendCapabilities(FACEIDAPP_CAPS, await getUsePrebuiltWDACaps());
driver = await initSession(caps);
await B.delay(2000); // Give the app a couple seconds to open
});
Expand All @@ -88,8 +88,8 @@ if (!process.env.CI) {
await authenticateButton.click();

// This is necessary only for the first time
if (await driver.$(ALLOW_LOCATOR).elementId) {
const okButton = await driver.$('~OK');
if (await driver.$(BIOMETRIC_LOCATOR).elementId) {
const okButton = await driver.$(ALLOW_LOCATOR);
await okButton.click();
}
await waitUntilExist(FACE_ID_LOCATOR);
Expand All @@ -104,8 +104,8 @@ if (!process.env.CI) {
await authenticateButton.click();

// This is necessary only for the first time
if (await driver.$(ALLOW_LOCATOR).elementId) {
const okButton = await driver.$('~OK');
if (await driver.$(BIOMETRIC_LOCATOR).elementId) {
const okButton = await driver.$(ALLOW_LOCATOR);
await okButton.click();
}
await waitUntilExist(FACE_ID_LOCATOR);
Expand All @@ -129,14 +129,15 @@ if (!process.env.CI) {
await authenticateButton.click();

// This is necessary only for the first time
if (await driver.$(ALLOW_LOCATOR).elementId) {
const okButton = await driver.$('~OK');
if (await driver.$(BIOMETRIC_LOCATOR).elementId) {
const okButton = await driver.$(ALLOW_LOCATOR);
await okButton.click();
}
await waitUntilExist(FACE_ID_LOCATOR);

await driver.execute('mobile: sendBiometricMatch', {type: 'faceId', match: true});
expect(await driver.$('~Succeeded').elementId).to.exist;
await B.delay(1000); // For iOS 17
okButton = await driver.$('~OK');
await okButton.click();
await B.delay(1000);
Expand Down
13 changes: 9 additions & 4 deletions test/functional/basic/find-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import {
extractCapabilityValue,
amendCapabilities,
UICATALOG_CAPS,
UICATALOG_BUNDLE_ID,
PLATFORM_VERSION,
} from '../desired';
import {PREDICATE_SEARCH, CLASS_CHAIN_SEARCH} from '../helpers/element';
import {initSession, deleteSession, hasDefaultPrebuiltWDA, MOCHA_TIMEOUT} from '../helpers/session';
import {initSession, deleteSession, getUsePrebuiltWDACaps, MOCHA_TIMEOUT} from '../helpers/session';
import {util} from 'appium/support';

chai.should();
Expand All @@ -29,12 +30,16 @@ describe('XCUITestDriver - find -', function () {

let driver;
before(async function () {
const caps = amendCapabilities(UICATALOG_CAPS, {
'appium:usePrebuiltWDA': hasDefaultPrebuiltWDA(),
});
const caps = amendCapabilities(UICATALOG_CAPS, await getUsePrebuiltWDACaps());
driver = await initSession(caps);
});
after(async function () {
try {
await driver.terminateApp(UICATALOG_BUNDLE_ID);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
await deleteSession();
});

Expand Down
14 changes: 9 additions & 5 deletions test/functional/basic/gesture-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import B from 'bluebird';
import {retryInterval} from 'asyncbox';
import {UICATALOG_CAPS, amendCapabilities} from '../desired';
import {UICATALOG_CAPS, UICATALOG_BUNDLE_ID, amendCapabilities} from '../desired';
import {PREDICATE_SEARCH} from '../helpers/element';
import {initSession, deleteSession, hasDefaultPrebuiltWDA, MOCHA_TIMEOUT} from '../helpers/session';
import {initSession, deleteSession, getUsePrebuiltWDACaps, MOCHA_TIMEOUT} from '../helpers/session';
import {APPIUM_IMAGE} from '../web/helpers';

chai.should();
Expand All @@ -19,9 +19,7 @@ describe('XCUITestDriver - gestures', function () {

describe('dynamic gestures', function () {
before(async function () {
const caps = amendCapabilities(UICATALOG_CAPS, {
'appium:usePrebuiltWDA': hasDefaultPrebuiltWDA(),
});
const caps = amendCapabilities(UICATALOG_CAPS, await getUsePrebuiltWDACaps());
driver = await initSession(caps);
});
beforeEach(async function () {
Expand All @@ -32,6 +30,12 @@ describe('XCUITestDriver - gestures', function () {
});
});
after(async function () {
try {
await driver.terminateApp(UICATALOG_BUNDLE_ID);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
await deleteSession();
});
afterEach(async function () {
Expand Down
6 changes: 2 additions & 4 deletions test/functional/basic/touch-id-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import {amendCapabilities, TOUCHIDAPP_CAPS} from '../desired';
import {initSession, deleteSession, hasDefaultPrebuiltWDA, MOCHA_TIMEOUT} from '../helpers/session';
import {initSession, deleteSession, getUsePrebuiltWDACaps, MOCHA_TIMEOUT} from '../helpers/session';
import B from 'bluebird';
import {killAllSimulators} from '../helpers/simulator';
import {CLASS_CHAIN_SEARCH} from '../helpers/element';
Expand Down Expand Up @@ -65,9 +65,7 @@ if (!process.env.CI) {

describe('touchID enrollment functional tests applied to TouchId sample app', function () {
beforeEach(async function () {
const caps = amendCapabilities(TOUCHIDAPP_CAPS, {
'appium:usePrebuiltWDA': hasDefaultPrebuiltWDA(),
});
const caps = amendCapabilities(TOUCHIDAPP_CAPS, await getUsePrebuiltWDACaps());
driver = await initSession(caps);
await B.delay(2000); // Give the app a couple seconds to open
});
Expand Down
9 changes: 7 additions & 2 deletions test/functional/desired.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ const APPS = {
biometricApp: path.resolve(__dirname, '..', 'assets', 'biometric.app'), // https://github.com/mwakizaka/LocalAuthentication
};

const initTimeout = 60 * 1000 * (process.env.CI ? 16 : 4);
const initTimeout = 60 * 1000 * (process.env.CI ?
util.compareVersions(PLATFORM_VERSION, '>=', '17.0') ? 96 : 16
: 4);
const GENERIC_CAPS = node.deepFreeze({
alwaysMatch: {
platformName: 'iOS',
Expand All @@ -55,7 +57,7 @@ const GENERIC_CAPS = node.deepFreeze({
'appium:showXcodeLog': SHOW_XCODE_LOG,
'appium:wdaLaunchTimeout': initTimeout,
'appium:wdaConnectionTimeout': initTimeout,
'appium:useNewWDA': true,
'appium:useNewWDA': !process.env.CI,
'appium:webviewConnectTimeout': 30000,
'appium:simulatorStartupTimeout': initTimeout,
},
Expand Down Expand Up @@ -104,6 +106,8 @@ const TVOS_CAPS = amendCapabilities(GENERIC_CAPS, {
'appium:deviceName': 'Apple TV',
});

const UICATALOG_BUNDLE_ID = 'com.example.apple-samplecode.UICatalog';

export {
UICATALOG_CAPS,
UICATALOG_SIM_CAPS,
Expand All @@ -118,6 +122,7 @@ export {
TVOS_CAPS,
MULTIPLE_APPS,
GENERIC_CAPS,
UICATALOG_BUNDLE_ID,
amendCapabilities,
extractCapabilityValue,
};
8 changes: 3 additions & 5 deletions test/functional/device/accessibility-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import {PREDICATE_SEARCH} from '../helpers/element';
import {MOCHA_TIMEOUT, initSession, deleteSession, hasDefaultPrebuiltWDA} from '../helpers/session';
import {MOCHA_TIMEOUT, initSession, deleteSession, getUsePrebuiltWDACaps} from '../helpers/session';
import {SETTINGS_CAPS, amendCapabilities} from '../desired';

chai.should();
Expand All @@ -12,10 +12,8 @@ describe('Accessibility', function () {

let driver, caps;

beforeEach(function () {
caps = amendCapabilities(SETTINGS_CAPS, {
'appium:usePrebuiltWDA': hasDefaultPrebuiltWDA(),
});
beforeEach(async function () {
caps = amendCapabilities(SETTINGS_CAPS, await getUsePrebuiltWDACaps());
});

afterEach(async function () {
Expand Down
Loading
Loading