Skip to content

add testcafe provider plugin #2899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs/web-apps/automated-testing/testcafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
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

Expand Down Expand Up @@ -171,9 +172,13 @@

### 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).

Check notice on line 184 in docs/web-apps/automated-testing/testcafe.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/web-apps/automated-testing/testcafe.md#L184

[sauce.WordsToAvoid] Avoid usage of 'Please'.
Raw output
{"message": "[sauce.WordsToAvoid] Avoid usage of 'Please'.", "location": {"path": "docs/web-apps/automated-testing/testcafe.md", "range": {"start": {"line": 184, "column": 1}}}, "severity": "INFO"}
77 changes: 77 additions & 0 deletions docs/web-apps/automated-testing/testcafe/provider-plugin.md
Original file line number Diff line number Diff line change
@@ -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

Check warning on line 20 in docs/web-apps/automated-testing/testcafe/provider-plugin.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/web-apps/automated-testing/testcafe/provider-plugin.md#L20

[sauce.CurrentStatus] Remove 'currently'. The documentation reflects the current state of the product.
Raw output
{"message": "[sauce.CurrentStatus] Remove 'currently'. The documentation reflects the current state of the product.", "location": {"path": "docs/web-apps/automated-testing/testcafe/provider-plugin.md", "range": {"start": {"line": 20, "column": 16}}}, "severity": "WARNING"}
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 <your-user> -k <your-access-key> --region us-west --tunnel-name <your-tunnel>
```

For more details, please follow our [Sauce Connect Quickstart](/secure-connections/sauce-connect-5/quickstart/)

Check notice on line 49 in docs/web-apps/automated-testing/testcafe/provider-plugin.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/web-apps/automated-testing/testcafe/provider-plugin.md#L49

[sauce.WordsToAvoid] Avoid usage of 'please'.
Raw output
{"message": "[sauce.WordsToAvoid] Avoid usage of 'please'.", "location": {"path": "docs/web-apps/automated-testing/testcafe/provider-plugin.md", "range": {"start": {"line": 49, "column": 19}}}, "severity": "INFO"}
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.
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down