Grunt testcafe plugin
npm install grunt-testcafe
> Tests runner
This plugin requires Grunt 0.4 - 1.
``shell`
npm install grunt-testcafe --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks("grunt-testcafe")
In your project's Gruntfile, add a section named testcafe to the data object passed into grunt.initConfig().
`js`
grunt.initConfig({
testcafe: {
test: {
options: {
files: ["tests/*.test.js"],
browsers: ["chrome"]
}
}
}
})
#### Advanced example:
`js`
grunt.initConfig({
testcafe: {
test: {
options: {
files: ["tests/*.test.js"],
browsers: ["firefox", "chrome"],
takeScreenshotsOnFail: true,
screenshotsPath: "tests/screenshots",
filter: (testName, fixtureName, fixturePath) => {
const testNameFilter = testName.match(
new RegExp(grunt.option("testName"))
)
const fixtureNameFilter = fixtureName.match(
new RegExp(grunt.option("fixtureName"))
)
const fixturePathFilter = fixturePath.match(
new RegExp(grunt.option("fixturePath"))
)
return (
testNameFilter && fixtureNameFilter && fixturePathFilter
)
}
}
}
}
})
#### files
_Type_: Array
_Default_: []
_Details_: Configures the test runner to run tests from the specified files.
#### browsers
_Type_: Array
_Default_: []
_Details_: Specifying Browsers for Test Task
Configures the test runner to run tests in the specified browsers.
_Required_
#### concurrency
_Type_: Number
_Default_: 1
_Details_: Specifies that tests should run concurrently.
#### reporters
_Type_: Array
_Default_: ['spec']
_Details_: Reporters
Specifies the reporter. Output file can be passed along with reporter name by colon (:) separator. Example
reporters: ['json:report.json', 'xunit:report.xml']
#### filter
_Type_: function(testName, fixtureName, fixturePath)
_Default_: null
_Details_: runner.filter
Allows you to manually select which tests should be run.
#### screenshotsPath
_Type_: String
_Default_: null
_Details_: Screenshots path
The path to which the screenshots will be saved. Enables the test runner to take screenshots of the tested webpages.
#### screenshotsPathPattern
_Type_: String
_Default_: null
_Details_: Screenshots path pattern
Specifies a custom pattern to compose screenshot files' relative path and name. This pattern overrides the default path pattern.
#### takeScreenshotsOnFail
_Type_: Boolean
_Default_: false
_Details_: Take screenshots on fail
Specifies if screenshots should be taken automatically whenever a test fails. Requires that the screenshotsPath is set.
#### skipJsErrors
_Type_: Boolean
_Default_: false
_Details_: Skip JS errors
Defines whether to continue running a test after a JavaScript error occurs on a page (true), or consider such a test failed (false).
#### quarantineMode
_Type_: Boolean
_Default_: false
Defines whether to enable the quarantine mode.
#### selectorTimeout
_Type_: Number
_Default_: 10000
_Details_: Selector timeout
Specifies the amount of time, in milliseconds, within which selectors make attempts to obtain a node to be returned.
#### assertionTimeout
_Type_: Number
_Default_: 3000
_Details_: Assertion options
Specifies the amount of time, in milliseconds, within which TestCafe makes attempts to successfully execute an assertion if a selector property or a client function was passed as an actual value.
#### speed
_Type_: Number
_Default_: 1
_Details_ : Speed factor
Specifies the speed of test execution. Should be a number between 1 (the fastest) and 0.01 (the slowest).
#### startApp
_Type_: Object { command, initDelay }
_Default_: { initDelay: 1000 }
_Details_ : startApp
Specifies a shell command that will be executed before running tests. Use it to launch or deploy the application that will be tested.
#### proxyHost
_Type_: String
_Default_: null`
_Details_ : proxy
Specifies the proxy server used in your local network to access the Internet. You can also specify authentication credentials with the proxy host.