From bfdb6a73ea71b0554e8df6d092b4951a79a35692 Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Wed, 17 Apr 2024 13:36:33 -0700 Subject: [PATCH 1/3] docs: testcafe native automation --- docs/web-apps/automated-testing/testcafe.md | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/web-apps/automated-testing/testcafe.md b/docs/web-apps/automated-testing/testcafe.md index f7fced827e..ea4a9839e6 100644 --- a/docs/web-apps/automated-testing/testcafe.md +++ b/docs/web-apps/automated-testing/testcafe.md @@ -175,3 +175,45 @@ We recommend that you avoid using special characters when naming your tests. If ### TestCafe 3.0.1 + Chrome/Edge + Sauce-Connect When using Sauce-Connect, Chrome, and Edge browsers cannot load any website through the tunnel. It will behave as if there is no tunnel defined. + +### TestCafe Native Automation + Chrome + Sauce Connect + +If your tests are issuing [TestCafe HTTP requests](https://testcafe.io/documentation/403971/guides/intermediate-guides/api-testing#proxy-settings) +and require a Sauce Connect tunnel, you will need to either [set the proxy manually](https://testcafe.io/documentation/403971/guides/intermediate-guides/api-testing#proxy-settings) or disable TestCafe's Native Automation. + +#### Disable Native Automation + +This is the recommended approach, which poses less of a hassle. +Disable Native Automation in your `.testcaferc.js`: +```javascript +module.exports = { + disableNativeAutomation: true, +}; +``` + +and then ensure that our runner picks up the TestCafe config file by also +specifying it in the saucectl yaml config: +```yaml +testcafe: + version: 3.4.0 + configFile: .testcaferc.js +``` + +#### Manually Setting the Request Proxy: + +Alternatively, you can apply the proxy settings as you make requests: +```javascript +// HTTP_PROXY is pre-populated when using Sauce Connect +const items = process.env.HTTP_PROXY.split(':'); +const host = items[1].replaceAll('/', ''); +const port = items[2]; +const response = await t.request({ + url: `http://some-internal-resource.example.com/`, + method: "get", + proxy: { + protocol: 'http', + host, + port, + } +}); +``` From 8c9528e0d9ce4708eaaec08a44b935fb9795e3e7 Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Wed, 17 Apr 2024 13:53:24 -0700 Subject: [PATCH 2/3] the right quotes --- docs/web-apps/automated-testing/testcafe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web-apps/automated-testing/testcafe.md b/docs/web-apps/automated-testing/testcafe.md index ea4a9839e6..66abb761e7 100644 --- a/docs/web-apps/automated-testing/testcafe.md +++ b/docs/web-apps/automated-testing/testcafe.md @@ -209,7 +209,7 @@ const host = items[1].replaceAll('/', ''); const port = items[2]; const response = await t.request({ url: `http://some-internal-resource.example.com/`, - method: "get", + method: 'get', proxy: { protocol: 'http', host, From ed14d9277f73eabbcfd45aaa4fa07a72ab46fb0b Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Wed, 17 Apr 2024 14:03:10 -0700 Subject: [PATCH 3/3] consistent spelling style --- docs/web-apps/automated-testing/testcafe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web-apps/automated-testing/testcafe.md b/docs/web-apps/automated-testing/testcafe.md index 66abb761e7..533132b9c2 100644 --- a/docs/web-apps/automated-testing/testcafe.md +++ b/docs/web-apps/automated-testing/testcafe.md @@ -172,7 +172,7 @@ If all you want is to publish your TestCafe test results to Sauce Labs (but not We recommend that you avoid using special characters when naming your tests. If your test name contains any special characters, your test may not run, or its artifacts may not be visible on our platform. -### TestCafe 3.0.1 + Chrome/Edge + Sauce-Connect +### TestCafe 3.0.1 + Chrome/Edge + Sauce Connect When using Sauce-Connect, Chrome, and Edge browsers cannot load any website through the tunnel. It will behave as if there is no tunnel defined.