Features

Learn how to export mabl tests to TestingBot

  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

Mabl is a test automation platform that offers a low-code interface for anyone to create and run automated browser and mobile tests. Mabl uses AI-powered test automation to handle dynamic content and UI changes more gracefully.

Once signed up through Mabl, you can download a standalone application to record and run tests. There is a UI tool called mabl Trainer that allows you to record tests.

Compared to TestingBot, Mabl has a more limited browser and device coverage. It uses a Proprietary Testing Framework, while TestingBot supports open-source frameworks such as Selenium, Appium, Playwright and other test frameworks.

In this article, we'll go over the techniques you can use to transition from running tests on mabl to using TestingBot's extensive browser and device grid.

Converting Mabl tests to Playwright

Mabl provides a mabl CLI utility which you can install to interact with the Mabl framework through commandline. This CLI utility provides functionality to exports tests in various formats, including as a Playwright test or in .SIDE format (Selenium IDE).

To convert a Mabl test to Playwright, you can follow the steps below:

  1. Install The Mabl CLI: npm i -g @mablhq/mabl-cli

  2. Log into the The Mabl CLI: mabl auth login

  3. Now you can fetch a list of tests that are available to export: mabl tests list

  4. For each test, fetch its id and pass it to the export command: mabl tests export --format playwright {id}. For example, if there's a test WfoA52mEnMoBVz9JoPHACA-j, the command to export would be mabl tests export --format playwright WfoA52mEnMoBVz9JoPHACA-j

  5. A new .spec.ts file will be generated with the converted mabl code to Playwright code.

You can now use these new .spec.ts files with playwright-test and TestingBot.

Create a file called playwright.config.js with the following contents:

Copy code
import { defineConfig } from '@playwright/test'
import { getConnectWsEndpoint } from './testingbot.config'

/**
 * See https://playwright.dev/docs/test-configuration.
 */
export default defineConfig({

  testDir: './tests',

  /* Maximum time one test can run for. */
  timeout: 30 * 1000,

  /* Fail the build on CI if you accidentally left test.only in the source code. */
  forbidOnly: !!process.env.CI,

  /* Retry on CI only */
  retries: process.env.CI ? 2 : 0,

  /* Opt out of parallel tests on CI. */
  workers: process.env.CI ? 1 : undefined,

  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: 'html',

  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  use: {
    /* Base URL to use in actions like `await page.goto('/')`. */
    // baseURL: 'http://localhost:3000',


    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
    trace: 'on-first-retry',
  },

  projects: [
    {
      name: 'playwright-chrome@latest:Windows 10',
      use: {
        connectOptions: { 
          wsEndpoint: getConnectWsEndpoint({
            browserName: 'chrome',
            browserVersion: 'latest',
            platform: 'WIN10'
          }) 
        }
      },
    },
    {
      name: 'playwright-firefox@latest:Linux',
      use: {
        connectOptions: { 
          wsEndpoint: getConnectWsEndpoint({
            browserName: 'firefox',
            browserVersion: 'latest',
            platform: 'LINUX'
          }) 
        }
      }
    }
  ]
})

You will also need to create a testingbot.config.js file, which will contain code to connect to our Playwright server:

Copy code
export function getConnectWsEndpoint(userCapabilities) {
    const defaultCapabilities = {
        'tb:options': {
            key: process.env.TB_KEY,
            secret: process.env.TB_SECRET
        }
    }
    const capabilities = { ...defaultCapabilities, ...userCapabilities }
    const connectUrl = `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    return connectUrl
}

You can now move all generated .spec.ts files to a new directory called tests.

Finally, you can run the exported mabl tests on TestingBot:

Copy code
TB_KEY=.. TB_SECRET=.. npx playwright test

Converting Mabl tests to Side

Similar to converting mabl tests to Playwright, it is also possible to convert mabl tests to .side files, which are used by Selenium IDE.
Selenium IDE is an open-source browser extension that allows you to record your actions in a browser, add assertions and run these as tests at a later stage with Selenium.

Selenium is a popular, open-source test framework that supports running automated browser tests on a wide variety of browsers. By using Selenium in combination with Selenium Grid, you can run tests simultaneously across various browser configurations (browser name + browser version + operating system). TestingBot offers a cloud-based Selenium grid that allows you to run Selenium tests in parallel, on a wide number of browsers and devices.

To convert mabl tests to .side formatted files, please follow these steps:

  1. Install The Mabl CLI: npm i -g @mablhq/mabl-cli

  2. Log into the The Mabl CLI: mabl auth login

  3. Now you can fetch a list of tests that are available to export to Selenium IDE format: mabl tests list

  4. For each test, fetch their id and pass it to the export command: mabl tests export --format side {id}. For example, if there's a test WfoA52mEnMoBVz9JoPHACA-j, the command to export would be mabl tests export --format side WfoA52mEnMoBVz9JoPHACA-j

  5. A new .side file will be generated with the converted mabl code to Selenium IDE code.

For each of these new .side files, you can choose to import these in your Selenium IDE extension or you can upload these to TestingBot's Codeless Automation feature. TestingBot's codeless automation will run your Selenium IDE tests at the interval you specify, on various browsers. For each test run, you will get back the result, a video, screenshots and log files generated during the test. You can receive alerts when a test fails, through SMS, e-mail and Slack hooks.

TestingBot currently does not support controls or if/else commands in Codeless Automation. The generated SIDE files might contain this, so please make sure to refactor/remove these if necessary.

A great Mabl alternative: TestingBot

TestingBot offers a great alternative to using Mabl for automated browser testing. Here are some of the reasons why you might want to switch from Mabl to TestingBot:

  • TestingBot offers better pricing for automated tests.
  • Mabl's low-code test creation can be exchanged with Selenium IDE test recording and TestingBot's Codeless Automation.
  • Run tests on physical mobile devices, not using Mabl's Chrome Mobile Emulation.
  • Run tests on different operating systems, multiple browser versions and beta/dev versions.
  • Auto-healing tests is a hyped topic and does rarely work acurrately.
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews
TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

Inject webcam and microphone feeds during Selenium testing.

Find out how to run automated browser tests with a fake microphone and webcam.

Read more
Javascript Test Frameworks: Top 15

An overview of the top 15 Javascript Testing Frameworks

Read more
Automated Browser Extension Testing

Learn how to perform automated testing against browser extensions.

Read more
The best Python Web Testing frameworks

A top 5 of the best Python Test Frameworks available for automated website testing.

Read more
Cucumber testing with Selenium and IntelliJ or Eclipse

Find out how to run Cucumber tests with Selenium straight from your own IntelliJ or Eclipse IDE.

Read more
Selenium & ElementClickInterceptedException

What is an ElementClickInterceptedException and how can you avoid it?

Read more