From 8e3ef6ecf44d40b278d5bcf1fa5c4641ee519009 Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Wed, 21 Aug 2024 14:49:55 -0700 Subject: [PATCH 1/4] add testcafe provider plugin --- docs/web-apps/automated-testing/testcafe.md | 13 ++-- .../testcafe/provider-plugin.md | 71 +++++++++++++++++++ sidebars.js | 1 + 3 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 docs/web-apps/automated-testing/testcafe/provider-plugin.md diff --git a/docs/web-apps/automated-testing/testcafe.md b/docs/web-apps/automated-testing/testcafe.md index 3f458e15ae..12f98d8ade 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 @@ -180,9 +181,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..47c173b8c3 --- /dev/null +++ b/docs/web-apps/automated-testing/testcafe/provider-plugin.md @@ -0,0 +1,71 @@ +--- +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. + +## 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 b27c841be1..cd6dc7964d 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1528,6 +1528,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', From 2d65c27b8ebf6e1ac453784faac708544bc0a975 Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Tue, 17 Sep 2024 15:43:30 -0700 Subject: [PATCH 2/4] fix: title level --- docs/web-apps/automated-testing/testcafe/provider-plugin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web-apps/automated-testing/testcafe/provider-plugin.md b/docs/web-apps/automated-testing/testcafe/provider-plugin.md index 47c173b8c3..3b20a3a296 100644 --- a/docs/web-apps/automated-testing/testcafe/provider-plugin.md +++ b/docs/web-apps/automated-testing/testcafe/provider-plugin.md @@ -65,7 +65,7 @@ returned: testcafe "sauce:chrome@latest:Windows 11" path/to/test/file.js --reporter saucelabs ``` -# Limitations +## Limitations - TestCafe may incorrectly report the platform of a remote browser session, such as mistaking Windows 11 for Windows 10. From f1799ace6c3a0deba057104d31ebc74ecc826ed7 Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Tue, 17 Sep 2024 16:10:11 -0700 Subject: [PATCH 3/4] docs: add beta note --- docs/web-apps/automated-testing/testcafe/provider-plugin.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/web-apps/automated-testing/testcafe/provider-plugin.md b/docs/web-apps/automated-testing/testcafe/provider-plugin.md index 3b20a3a296..064398d92e 100644 --- a/docs/web-apps/automated-testing/testcafe/provider-plugin.md +++ b/docs/web-apps/automated-testing/testcafe/provider-plugin.md @@ -16,6 +16,10 @@ project setup flexibility. We recommend that you give both approaches a try and pick the one that suits your use case best. +🚧 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+ From da765f8646fc40bd7a977afd3e11cde142961717 Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Tue, 17 Sep 2024 16:11:16 -0700 Subject: [PATCH 4/4] use proper docusaurus note --- docs/web-apps/automated-testing/testcafe/provider-plugin.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/web-apps/automated-testing/testcafe/provider-plugin.md b/docs/web-apps/automated-testing/testcafe/provider-plugin.md index 064398d92e..7626912670 100644 --- a/docs/web-apps/automated-testing/testcafe/provider-plugin.md +++ b/docs/web-apps/automated-testing/testcafe/provider-plugin.md @@ -16,9 +16,11 @@ project setup flexibility. We recommend that you give both approaches a try and pick the one that suits your use case best. -🚧 This plugin is currently in beta. We caution against using it in production +:::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