DevExpress / testcafe-browser-provider-saucelabs

This is the Sauce Labs browser provider plugin for TestCafe.
https://devexpress.github.io/testcafe/
MIT License
32 stars 41 forks source link

Error: Failed to reach the Sauce Labs API. #72

Closed A142170 closed 3 years ago

A142170 commented 3 years ago

Testcafe: v1.14.0 testcafe-browser-provider-saucelabs: v1.8.2

Receiving the following error on trying to open any browser on any platform:

ERROR Was unable to open the browser "saucelabs:Chrome@85.0:macOS 10.13" due to error.

Error: Failed to reach the Sauce Labs API.
RequestError: connect ECONNREFUSED 127.0.0.1:443
    at /Users/sid/Development/AGL.Digital.MyAccount/node_modules/saucelabs-connector/lib/index.js:117:13
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at SaucelabsConnector.waitForFreeMachines (/Users/sid/Development/AGL.Digital.MyAccount/node_modules/saucelabs-connector/lib/index.js:197:32)

Printed the Params variable from saucelabs-connector/lib/index.js:109:

method: 'GET', url: 'https://saucelabs.com/rest/v1/users/A142170/concurrency', username: 'A142170', password: 'Removed Password from here'

Command that was run:

$ /Users/sid/Development/AGL.Digital.MyAccount/node_modules/.bin/testcafe 'saucelabs:Chrome@85.0:macOS 10.13' e2e/testcafe/smokes/ -c 1 -s 'path=reports/testcafe/testCafeScreenshots,takeOnFails=true,fullPage=true,pathPattern=${TEST_INDEX}/${USERAGENT}/${QUARANTINE_ATTEMPT}/${FILE_INDEX}.png' --fixture-meta type=smoke,suite=overview --cs e2e/testcafe/clientScripts/patchBrowserLogs.js,e2e/testcafe/clientScripts/catchJsErrors.js --skip-js-errors --disable-multiple-windows --browser-init-timeout 180000 -r spec,nunit:reports/testcafe/testcafe.xml,json:reports/testcafe/testcafe.json

Saucelabs View:

The sauce connect tunnel is established successfully. And then the above error occurs, as soon as the tunnel is ready.

Other Sauce Data Centres:

Tried the EU data centre. exactly the same error. Tunnel is established successfully and then I receive RequestError: connect ECONNREFUSED 127.0.0.1:443 error

Farfurix commented 3 years ago

@A142170

Hello,

I cannot reproduce this issue in my environment: Windows 10, TestCafe v1.14.0, testcafe-browser-provider-saucelabs@1.8.2, Node.js v15.14.0. I ran this test successfully on my machine. Could you please install and run this test project? ./package.json:

{
  "name": "saucelabs-provider-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "npx testcafe \"saucelabs:Chrome@85.0:macOS 10.13\" test.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "testcafe": "^1.14.0",
    "testcafe-browser-provider-saucelabs": "^1.8.2"
  }
}

./test.js:

fixture `Fixture`
    .page('https://google.com');

test('test 1', async t => {
    await t.expect(true).ok();
});

test('test 2', async t => {
    await t.expect(true).ok();
});

test('test 3', async t => {
    await t.expect(true).ok();
});

test('test 4', async t => {
    await t.expect(true).ok();
});

Run command:

npm run test

I store Sauce Labs credentials in my environment variables.

Please share your sc-xxxxxxxxxxxxx.log file. You can find it in a project directory after the test fails.

A142170 commented 3 years ago

Thanks for looking into this. The code you have provided is able to connect to Saucelabs. I have come to the conclusion for now, that there is some common dependency between testcafe-browser-provider-saucelabs and other npm libraries I have in my project which might be causing this. I will compare the npm lock files and confirm.

Farfurix commented 3 years ago

@A142170

Thank you for the clarification. I will close this thread as the issue is related to a specific project and its dependencies. If you still face with this issue after updating project dependencies, feel free to open a new bug report with a minimal working example.