Changelog
v3.2.0 (2023-08-17)
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).Changelog
v3.1.0 (2023-07-27)
TestCafe 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).