diff --git a/docs/web-apps/automated-testing/testcafe.md b/docs/web-apps/automated-testing/testcafe.md index 795359cc3d..1b4e707d04 100644 --- a/docs/web-apps/automated-testing/testcafe.md +++ b/docs/web-apps/automated-testing/testcafe.md @@ -8,7 +8,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import useBaseUrl from '@docusaurus/useBaseUrl'; -[TestCafe](https://github.com/DevExpress/testcafe) is a testing framework that you can use to test your web apps remotely on Sauce Labs cloud using the [`saucectl` CLI](/dev/cli/saucectl). +[TestCafe](https://github.com/DevExpress/testcafe) is a testing framework that +you can use to test your web apps remotely on Sauce Labs cloud using the [`saucectl` CLI](/dev/cli/saucectl). ## System Requirements @@ -171,9 +172,13 @@ Sauce Labs supports the following test configurations for TestCafe: ### TestCafe Plugins for Sauce Labs -If you prefer to stay in TestCafe, try the new [TestCafe Sauce Labs Plugin](https://github.com/DevExpress/testcafe-browser-provider-saucelabs). Connect to your Sauce Labs account from within your TestCafe project to configure and run your tests directly from TestCafe. -If all you want is to publish your TestCafe test results to Sauce Labs (but not run on Sauce Labs), check out our [TestCafe reporter](https://github.com/saucelabs/testcafe-reporter)! +If you prefer to run your tests directly from TestCafe against a remote Sauce +Labs browser, try our [TestCafe Provider Plugin](provider-plugin). + +If all you want is to publish your TestCafe test results to Sauce Labs, but not +run _on_ Sauce Labs or use a Sauce Labs provided browser, check out our +[TestCafe Reporter](https://github.com/saucelabs/testcafe-reporter)! ## Limitations -Please check the [Limitations Page](testcafe/limitations.md). +Please check the [Limitations Page](limitations). diff --git a/docs/web-apps/automated-testing/testcafe/provider-plugin.md b/docs/web-apps/automated-testing/testcafe/provider-plugin.md new file mode 100644 index 0000000000..7626912670 --- /dev/null +++ b/docs/web-apps/automated-testing/testcafe/provider-plugin.md @@ -0,0 +1,77 @@ +--- +id: provider-plugin +title: Provider Plugin +sidebar_label: Provider Plugin +--- + +# TestCafe Provider Plugin + +TestCafe can also connect to Sauce Labs _remotely_ via our [Provider Plugin](https://github.com/saucelabs/testcafe-provider). + +Unlike [saucectl](/dev/cli/saucectl/), which transmits and runs your TestCafe +tests directly on a Sauce Labs VM, the Sauce Labs [Provider Plugin](https://github.com/saucelabs/testcafe-provider) +allows TestCafe to connect to a browser session remotely, allowing for a greater +project setup flexibility. + +We recommend that you give both approaches a try and pick the one that suits +your use case best. + +:::note +This plugin is currently in beta. We caution against using it in production +pipelines. We do seek feedback and encourage you to report any issues you +encounter. +::: + +## Requirements + +- Node.js 20+ +- [TestCafe Sauce Labs Browser Provider Plugin](https://github.com/saucelabs/testcafe-provider) +- [TestCafe Sauce Labs Reporter](https://github.com/saucelabs/testcafe-reporter) +- [Sauce Connect](/secure-connections/sauce-connect-5) + +## Install + +Install the provider plugin and the reporter: +```shell +npm install testcafe-browser-provider-sauce +npm install testcafe-reporter-saucelabs +``` + +## Start Tunnel + +A tunnel is necessary for the remote browser to establish a connection back to +TestCafe. + +```shell +sc run -u -k --region us-west --tunnel-name +``` + +For more details, please follow our [Sauce Connect Quickstart](/secure-connections/sauce-connect-5/quickstart/) +instructions. + +## Run TestCafe + +Set the necessary environment variables. + +```shell +export SAUCE_USERNAME=your-user +export SAUCE_ACCESS_KEY=your-access-key +export SAUCE_TUNNEL_NAME=your-tunnel +``` + +Verify that the provider has been properly installed and is able to talk to +Sauce Labs by asking TestCafe to print out a list of supported remote browsers: +```shell +testcafe -b sauce +``` + +You are ready to run tests, using a browser alias that the previous command +returned: +```shell +testcafe "sauce:chrome@latest:Windows 11" path/to/test/file.js --reporter saucelabs +``` + +## Limitations + +- TestCafe may incorrectly report the platform of a remote browser session, such +as mistaking Windows 11 for Windows 10. diff --git a/sidebars.js b/sidebars.js index 73df2f5b32..99acf5d3f0 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1530,6 +1530,7 @@ module.exports = { items: [ 'web-apps/automated-testing/testcafe', 'web-apps/automated-testing/testcafe/quickstart', + 'web-apps/automated-testing/testcafe/provider-plugin', 'web-apps/automated-testing/testcafe/yaml', 'web-apps/automated-testing/testcafe/advanced', 'web-apps/automated-testing/testcafe/limitations',