Today we're releasing testcafe-browser-provider-testingbot
, a plugin for TestCafe.
TestCafe is a NodeJS framework to do automate end-to-end web testing. It allows you to write tests in Javascript or TypeScript and is easy to install and use.
It is a popular test framework, mainly because it's open-source and has good documentation and examples.
TestCafe is not built on Selenium. TestCafe uses a URL-rewriting proxy, this allows it to work without using Selenium WebDriver. The proxy adds a driver script to the browser, which emulates user actions into the page. To find out how it works, please see their How It Works page.
What does the plugin do?
The plugin allows you to use TestCafe and TestingBot together, with very little configuration.
All you need to do is install the plugin, add the browsers you want to use in a capabilities.json
file and use TestCafe.
You will see a video, screenshots and logs of each test in the TestingBot member dashboard.
Installing the plugin
To start using the TestCafe plugin, simply install it:
Once that is done, add both the TB_KEY
and TB_SECRET
environment variables to authenticate to the TestingBot browser grid.
A TestCafe example
Let's use a simple TestCafe example which we can run on a TestingBot browser.
import { Selector } from 'testcafe';
fixture `Getting Started`
.page `http://devexpress.github.io/testcafe/example`;
test('My first test', async t => {
await t
.typeText('#developer-name', 'John Smith')
.click('#submit-button')
// Use the assertion to check if the actual header text is equal to the expected one
.expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');
});
This will open a page, type text in an input field, click a button and verify that the page is showing a specific piece of text.
To run this test on TestingBot, simply use this command:
The plugin will start a TestingBot Tunnel, start a new Windows 10 VM and run the test on the VM. Once the test has finished running, you will see the test result in your terminal and see a new test appear in your TestingBot dashboard.
Parallel Testing
One of the advantages of using a Cloud based Selenium grid is that you can run tests with high concurrency.
For example, let's run the same test on 3 different browsers at the same time:
testcafe "testingbot:chrome@83:WIN10","testingbot:safari@13:MOJAVE","testingbot:firefox@79:LINUX" 'example.js'
Your tests will appear in the dashboard, together with a video and logs.
Want to find out more? See our TestCafe documentation for more information.