Open Deeplink in iOS Programmatically, For Test Automation say

  1. Identify the UUID of your device/ simulator using
xcrun simctl list devices
xcrun simctl openurl [booted | <Your device/ Simulator UUID>] '<Deeplink URL>'For e.g.
xcrun simctl openurl booted 'http://maps.apple.com?q=Townsville'
xcrun simctl openurl 81DD15309-E59D-4C37-9F35-66EEDC67C702 'http://maps.apple.com?q=Townsville'
{ 
platform: 'iOS',
waitForTimeout: 300000,
desiredCapabilities: {
deviceName: '<DEVICE_NAME>',
platformVersion: '<PLATFORM_VERSION>',
app: path.join(
__dirname,
'<APP_LOCATION>'
),
udid: '<DEVICE_UUID>',
xcodeOrgId: '<APPLE_DEVELOPER_SIGNATURE_ORG>',
xcodeSigningId: 'iPhone Developer',
automationName: 'XCUITest',
noReset: true,
fullReset: false,
},
}
const MapDetailPage = require('../page_objects').screens.map.MapDetailPage;
const MapPermissionPage = require('../page_objects').screens.map.MapPermissionPage;
var spawn = require('child_process').spawn;
const LOCATION = 'Townsville Queensland, Australia'
/**@type MapDetailPage */
let mapDetailPage;
Feature('MAP').tag('Feature=MAP');
Before(async function () {

spawn('xcrun', ['xctrace', 'simctl', 'openurl', 'http://maps.apple.com?q=Townsville'], {
stdio: ['ignore', out, err],
detached: true
}).unref();

const mapPermissionPage = new MapPermissionPage();
await mapPermissionPage.heading.seeElement();
await mapPermissionPage.allowWhileUsingTheAppButton.tap();
//Initialize MapDetailPage Page
mapDetailPage = new MapDetailPage();
await mapDetailPage.heading.seeElement();
});
Scenario('Deeplink Test', async () => {
await mapDetailPage.search(LOCATION);
await mapDetailPage.searchResult.success.seeElement();
})
.tag('FUNCTIONAL')
.tag('APP-LOADING')
.tag('MAP')
.tag('POSITIVE')
.tag('RELEASE');

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sandeep Dinesh

Sandeep Dinesh

Test Automation, CI/CD, DevOps & SRE