A Node.js tool to automate end-to-end web testing.
TestCafe v3.2.0 allows you to check whether TestCafe uses native automation to control the browser.
The nativeAutomation
property of the t.browser object indicates whether TestCafe uses native automation to control the browser. The property's value is true
when TestCafe uses native automation and false
when TestCafe uses the Hammerhead proxy.
You can check the browser's native automation status before you start the test:
import { Selector } from 'testcafe';
fixture`TestController.browser`
.page`https://example.com`;
test('Native automation check', async t => {
await t.expect(t.browser.nativeAutomation).ok();
//the test continues only if you use native automation
});
error-stack-parser
package that contains a vulnerable dependency (PR #7919 by @sethidden).t.browser.nativeAutomation
property (#7930) @miherlosevTestCafe v3.1.0 introduces two enhancements:
t.setNativeDialogHandler
method.Main article: t.setNativeDialogHandler
Use the t.setNativeDialogHandler
method to respond to geolocation
requests.
Error
type object to Block geolocation requests.success
callback of the getCurrentPosition method.// Test
test('Switch from "allow" to "block"', async t => {
await t
.setNativeDialogHandler((type) => {
if (type === 'geolocation')
return { timestamp: 12356, accuracy: 20, coords: {latitude: '34.15321262322903', longitude: '-118.25543996370723'}; // Passes this data to geolocation requests
return null;
});
.click('#buttonGeo')
.setNativeDialogHandler((type) => {
if (type !== 'geolocation')
return null;
const err = new Error('Some error');
err.code = 1;
return err; // Blocks geolocation requests
})
.click('#buttonGeo');
Main article: Version Logger API
Earlier versions of TestCafe could output the framework's version number to the console:
TestCafe 3.1.0 and up allows you to access the framework's version number in test code:
import { version } from 'testcafe';
console.log(`TestCafe version: ${version}`);
To access the framework's version number in your custom reporter, reference the first argument (version
) of the init
method:
init (version) {
this
.write(`Using TestCafe ${version}`)
.newline()
}
setFileUpload
method does not work (#7832).t.click
action fails if the event handler accounts for pointer input pressure (#7867).httpOnly
flag when you use the t.setCookies
method (#7793).Session with given id not found
(closes #7865, #7810) by @AlexKamaev in https://github.com/DevExpress/testcafe/pull/7875
Full Changelog: https://github.com/DevExpress/testcafe/compare/v3.0.1...v3.1.0-rc.2
This major update includes two breaking changes:
Other changes include:
print
dialog with the native dialog handler.TestCafe v2.5.0 introduced an experimental mode that allows users to automate Chromium-based browsers, such as Google Chrome and Microsoft Edge, with the native CDP protocol. TestCafe v3.0.0 and up enables this capability out of the box.
Native automation increases test quality, stability, and speed.
You can now access the following data in fixture hooks (fixture.before
, fixture.after
) :
Test hooks (fixture.beforeEach
, fixture.afterEach
, test.before
, test.after
) can access fixture data and the following test data:
fixture `Example Fixture`
.page `http://example.com`
.meta({ fixtureMeta: 'v' })
.before( async (ctx, info) => {
const fixtureName = info.name; /* Example Fixture */
const fixtureMeta = info.meta; /* { fixtureMeta: 'v' } */
const fixturePath = info.path /* /Users/dan/testcafe/fixture.js */
});
.beforeEach( async t => {
const fixtureName = t.fixture.name; /* Example Fixture */
const fixtureMeta = t.fixture.meta; /* { fixtureMeta: 'v' } */
const fixturePath = t.fixture.path /* /Users/dan/testcafe/fixture.js */
const testName = t.test.name; /* MyTest */
const testMeta = t.test.meta; /* { 'key': 'value' } */
})
Read the Hooks guide for more information.
You can now use the t.setNativeDialogHandler method to dismiss the print dialog.
TestCafe v3.0.0 removes support for Internet Explorer 11, six months after the browser's official retirement. The browser came out more than 9 years ago, and has a worldwide market of less than 0.5%. It is survived by Edge, a popular Chromium-based browser that ships with modern versions of Windows.
sellectaAll
command added to ctrl+a
combination in NA mode (#7767) @aleks-pro