Skip to main content
Version: 26.1

Mobitru

To install the Mobitru plugin, see Upload plugin section.

The Mobitru plugin automatically loads Mobitru session recordings to ReportPortal by linking each test execution to its corresponding video. This allows you to access the recording directly from the test results.

Once you've set up the ReportPortal-Mobitru integration, simply open the video to see how the test was executed. You can also click any point on the video timeline to jump directly to the corresponding log entry in ReportPortal in case of multiple recordings per test result.

note

Admin can upload Mobitru plugin and create global integration (applicable to all organizations/projects on the instance) on the Instance plugins page.

Manager and user with edit permissions can re-write global configuration with project one on Project Settings -> Integrations.

Configure Mobitru plugin​

Global Mobitru integration​

To configure Mobitru for the whole instance:

  1. Log in to ReportPortal as Admin.
  2. Navigate to Instance plugins page -> Other section.
  3. Click on "Mobitru" panel.
  4. Click on "Add Integration" button.
  5. Fill and confirm the authorization form.
'API key': <can be generated in User Settings on the Mobitru side>
'Mobitru Billing unit (slug)': <the name of the project in Mobitru>
'Workspace ID': <the ID of the workspace in Mobitru>

The API key can be generated in User Settings on the Mobitru side.

Mobitru Billing unit (slug) is the name of the project in Mobitru.

Workspace ID can also be found in Mobitru.

Delete Mobitru global integration​

To delete Mobitru global integration:

  1. Log in to ReportPortal as Admin.
  2. Navigate to Instance plugins page -> Other section.
  3. Click on "Mobitru" panel.
  4. Open global integration.
  5. Click "Delete" icon.
  6. Click "Delete" button.

Project Mobitru integration​

By default, projects use the global Mobitru integration configuration. If you configure a project-specific integration, it takes precedence over the global configuration for that project.

To configure Mobitru for the project:

  1. Log in to ReportPortal as Admin, Manager, or user with edit permissions.
  2. Go to the Project settings -> Integrations tab -> Other section.
  3. Click on "Mobitru" panel.
  4. Click "Create Integration" button.
  5. Fill and confirm the authorization form.
'API key': <can be generated in User Settings on the Mobitru side>
'Mobitru Billing unit (slug)': <the name of the project in Mobitru>
'Workspace ID': <the ID of the workspace in Mobitru>

Delete Mobitru project integration​

To delete Mobitru project integration:

  1. Log in to ReportPortal as Admin, Manager, or user with edit permissions.
  2. Go to the Project settings -> Integrations tab -> Other section.
  3. Click on "Mobitru" panel.
  4. Click "Reset to Global Integration" button.
  5. Click "Reset" button.

Prerequisites: Your test framework must already be integrated with ReportPortal.

Connect your test project to Mobitru to run tests on real devices and browsers. Then add the Mobitru video recording ID attribute so ReportPortal can match each test execution to its session video. The setup process depends on the testing framework you use.

Full examples with configuration details and source code are available in the corresponding guides.

Selenium​

1. Integrate your tests with Mobitru.

async function createMobitruDriver() {
const billingUnit = process.env.MOBITRU_BILLING_UNIT;
const accessToken = process.env.MOBITRU_ACCESS_TOKEN;

if (!billingUnit || !accessToken) {
throw new Error(
'MOBITRU_BILLING_UNIT and MOBITRU_ACCESS_TOKEN environment variables are required when BROWSER_PROVIDER=mobitru',
);
}

const mobitruOptions = {
'mobitru:options': {
enableVideo: true,
},
};

return new Builder()
.withCapabilities(mobitruOptions)
.forBrowser(Browser.CHROME)
.usingServer(`https://${billingUnit}:${accessToken}@${MOBITRU_HUB_URL}/wd/hub`)
.build();
}

Full example

2. Add the recording attribute.

async function getMobitruRecordingId(driver) {
const session = await driver.getSession();

return session.getId();
}
// ...

it('should display the Google title', async () => {
const attributes = [
{ key: 'browser', value: 'chrome' },
];

attributes.push({
key: 'mobitru_selenium_recording_id',
value: await getMobitruRecordingId(driver),
});

PublicReportingAPI.addAttributes(attributes);
})

Full example

3. Run the tests

Execute your test project as usual (CLI, IDE, etc.). Tests run on Mobitru's real devices and browsers.

Playwright​

1. Integrate your tests with Mobitru.

const mobitru_test = test.extend<{ page: Page }>({
page: async ({page, request}, use, testInfo) => {
const mobitruHost = process.env.MOBITRU_HUB_URL;
const mobitruTeamCode = process.env.MOBITRU_BILLING_UNIT;
const mobitruAccessToken = process.env.MOBITRU_ACCESS_TOKEN;

const httpCredentials = {
username: mobitruTeamCode,
password: mobitruAccessToken,
};
const mobitruApiAccessToken = btoa(
`${httpCredentials.username}:${httpCredentials.password}`,
);

// prepare a playwright WS endpoint for specific session name and playwright version
const sessionName = crypto.randomUUID();
const videoEnabled = process.env.VIDEO_ENABLED || 'true';
const wsEndpoint =
`wss://${mobitruTeamCode}:${mobitruAccessToken}@${mobitruHost}` +
`/playwright/chromium/playwright-${PW_VERSION}` +
`?headless=false&enableVideo=${videoEnabled}&sessionName=${sessionName}`;

const browser = await chromium.connect({
timeout: 0,
wsEndpoint: wsEndpoint
});
const newPage = await browser.newPage({
ignoreHTTPSErrors: true,
viewport: {width: 1920, height: 1080}
});
await use(newPage);

//close the browser to trigger the saving of video recording
await browser.close();
}
});

Full example

2. Add the recording attribute.

      // get the playwright session id by using the session name specified in WS endpoint
const sessionInfo = await page.request.get(
`https://${mobitruHost}/playwright/session/${sessionName}`,
{
headers: {
Authorization: `Basic ${mobitruApiAccessToken}`,
},
},
);
expect(sessionInfo.ok()).toBeTruthy();
const jsonResponse = await sessionInfo.json();
const sessionId = jsonResponse.sessionId;

// send mobitru recording attribute, so RP will attach the video to the report automatically
ReportingApi.addAttributes([
{
key: 'mobitru_playwright_recording_id',
value: sessionId,
},
]);

Full example

3. Run the tests

Execute your test project as usual (CLI, IDE, etc.). Tests run on Mobitru's real devices and browsers.

Mobile​

The examples below are based on WebdriverIO.

1. Integrate your tests with Mobitru.

exports.config = {
runner: 'local',
protocol: 'https',
hostname: MOBITRU_HOST,
port: 443,
path: '/wd/hub',
headers: {
Authorization: `Basic ${Buffer.from(`${billingUnit}:${accessToken}`).toString('base64')}`,
},

specs: ['./tests/**/*.spec.js'],
// keep a single session to stay within the Mobitru device slot limit
maxInstances: 1,
capabilities: [
{
platformName: 'iOS',
'appium:automationName': 'XCUITest',
'appium:browserName': 'safari',
...(workspaceId && { 'mobitru:wid': workspaceId }),
},
],
};

2. Add the recording attribute.

async function withMobitruRecording(testFn) {
const udid = getDeviceUdid();

await callMobitruApi('POST', `/device/${udid}/recording`);
try {
await testFn();
} finally {
const { recordingId } = await callMobitruApi('DELETE', `/device/${udid}/recording`);

ReportingApi.addAttributes([
...getDeviceAttributes(),
{ key: RECORDING_ATTRIBUTE_KEY, value: recordingId },
]);
}
}

3. Run the tests

Execute your test project as usual (CLI, IDE, etc.). Tests run on Mobitru's real devices and browsers.

For additional details, refer to Mobitru documentation for desktop browser automation and mobile automation.

View Mobitru videos in ReportPortal​

Test results, logs, and the Mobitru execution video with timeline appear together in ReportPortal.

For that:

  1. Open a launch.
  2. Open the test item.
  3. Go to the Logs view.
  4. Open the Remote device tab.

The Remote device tab appears only when the test item (or one of its nested steps) was reported with a Mobitru recording attribute and the video has already been downloaded into ReportPortal binary storage as an attachment. If the attribute is present but the video is not yet stored (or download failed), the tab stays hidden.

info

ReportPortal supports multiple Mobitru videos under one test item or its Nested steps.

important

Mobitru videos are saved in ReportPortal as attachments and are governed by Keep attachments (Project settings -> General). Adjust this policy if you need longer retention; video files can increase storage consumption.

Cloud Devices​

The "Cloud Devices" tab appears in the project sidebar when a global or project Mobitru integration is configured.

It is a read-only catalog of devices available via Mobitru - browse iOS and Android, grouped as Premium and Available. Use Explore Devices or open a device card to continue in Mobitru in a new browser tab. This page does not let you interact with a device from ReportPortal; to run tests on a device, use the Mobitru integration flow described above.

note

For a better viewing experience, enable the following option in Log level settings.