Skip to content

Commit 27d9fd2

Browse files
author
Alex Plischke
authored
add testcafe provider plugin (#2899)
1 parent 67e31ee commit 27d9fd2

File tree

3 files changed

+87
-4
lines changed

3 files changed

+87
-4
lines changed

docs/web-apps/automated-testing/testcafe.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import Tabs from '@theme/Tabs';
88
import TabItem from '@theme/TabItem';
99
import useBaseUrl from '@docusaurus/useBaseUrl';
1010

11-
[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).
11+
[TestCafe](https://github.com/DevExpress/testcafe) is a testing framework that
12+
you can use to test your web apps remotely on Sauce Labs cloud using the [`saucectl` CLI](/dev/cli/saucectl).
1213

1314
## System Requirements
1415

@@ -171,9 +172,13 @@ Sauce Labs supports the following test configurations for TestCafe:
171172

172173
### TestCafe Plugins for Sauce Labs
173174

174-
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.
175-
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)!
175+
If you prefer to run your tests directly from TestCafe against a remote Sauce
176+
Labs browser, try our [TestCafe Provider Plugin](provider-plugin).
177+
178+
If all you want is to publish your TestCafe test results to Sauce Labs, but not
179+
run _on_ Sauce Labs or use a Sauce Labs provided browser, check out our
180+
[TestCafe Reporter](https://github.com/saucelabs/testcafe-reporter)!
176181

177182
## Limitations
178183

179-
Please check the [Limitations Page](testcafe/limitations.md).
184+
Please check the [Limitations Page](limitations).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
id: provider-plugin
3+
title: Provider Plugin
4+
sidebar_label: Provider Plugin
5+
---
6+
7+
# TestCafe Provider Plugin
8+
9+
TestCafe can also connect to Sauce Labs _remotely_ via our [Provider Plugin](https://github.com/saucelabs/testcafe-provider).
10+
11+
Unlike [saucectl](/dev/cli/saucectl/), which transmits and runs your TestCafe
12+
tests directly on a Sauce Labs VM, the Sauce Labs [Provider Plugin](https://github.com/saucelabs/testcafe-provider)
13+
allows TestCafe to connect to a browser session remotely, allowing for a greater
14+
project setup flexibility.
15+
16+
We recommend that you give both approaches a try and pick the one that suits
17+
your use case best.
18+
19+
:::note
20+
This plugin is currently in beta. We caution against using it in production
21+
pipelines. We do seek feedback and encourage you to report any issues you
22+
encounter.
23+
:::
24+
25+
## Requirements
26+
27+
- Node.js 20+
28+
- [TestCafe Sauce Labs Browser Provider Plugin](https://github.com/saucelabs/testcafe-provider)
29+
- [TestCafe Sauce Labs Reporter](https://github.com/saucelabs/testcafe-reporter)
30+
- [Sauce Connect](/secure-connections/sauce-connect-5)
31+
32+
## Install
33+
34+
Install the provider plugin and the reporter:
35+
```shell
36+
npm install testcafe-browser-provider-sauce
37+
npm install testcafe-reporter-saucelabs
38+
```
39+
40+
## Start Tunnel
41+
42+
A tunnel is necessary for the remote browser to establish a connection back to
43+
TestCafe.
44+
45+
```shell
46+
sc run -u <your-user> -k <your-access-key> --region us-west --tunnel-name <your-tunnel>
47+
```
48+
49+
For more details, please follow our [Sauce Connect Quickstart](/secure-connections/sauce-connect-5/quickstart/)
50+
instructions.
51+
52+
## Run TestCafe
53+
54+
Set the necessary environment variables.
55+
56+
```shell
57+
export SAUCE_USERNAME=your-user
58+
export SAUCE_ACCESS_KEY=your-access-key
59+
export SAUCE_TUNNEL_NAME=your-tunnel
60+
```
61+
62+
Verify that the provider has been properly installed and is able to talk to
63+
Sauce Labs by asking TestCafe to print out a list of supported remote browsers:
64+
```shell
65+
testcafe -b sauce
66+
```
67+
68+
You are ready to run tests, using a browser alias that the previous command
69+
returned:
70+
```shell
71+
testcafe "sauce:chrome@latest:Windows 11" path/to/test/file.js --reporter saucelabs
72+
```
73+
74+
## Limitations
75+
76+
- TestCafe may incorrectly report the platform of a remote browser session, such
77+
as mistaking Windows 11 for Windows 10.

sidebars.js

+1
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,7 @@ module.exports = {
15301530
items: [
15311531
'web-apps/automated-testing/testcafe',
15321532
'web-apps/automated-testing/testcafe/quickstart',
1533+
'web-apps/automated-testing/testcafe/provider-plugin',
15331534
'web-apps/automated-testing/testcafe/yaml',
15341535
'web-apps/automated-testing/testcafe/advanced',
15351536
'web-apps/automated-testing/testcafe/limitations',

0 commit comments

Comments
 (0)