Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.2 KB

APIRef.MockingOpenFromURL.md

File metadata and controls

36 lines (27 loc) · 1.2 KB

Mocking Open from URL (Deep Links)

You can mock opening the app from URL to test your app's deep link handling mechanism.

Mocking App Launch from a URL

await device.launchApp({newInstance: true, url: url, sourceApp: bundleId}); //sourceApp is optional

Example:

describe('launch app from URL', () => {
    before(async () => {
      await device.launchApp({
        newInstance: true,
        url: 'scheme://some.url',
        sourceApp: 'com.apple.mobilesafari'
      });
    });

    it('should tap successfully', async () => {
      await expect(element(by.text('a label'))).toBeVisible();
    });
  });

Mocking Opening URL on a Launched App

await device.openURL({url: 'scheme://some.url', sourceApp: 'com.apple.mobilesafari'});

iOS Requirements

This API requires that the application:openURL:options: method is implemented in the application delegate. The legacy deprecated application:openURL:sourceApplication:annotation: method is not supported.