Code Monkey home page Code Monkey logo

testcafe-browser-provider-saucelabs's Introduction

testcafe-browser-provider-saucelabs

Build Status Build Status

This plugin integrates TestCafe with the SauceLabs Testing Cloud.

Install

npm install testcafe-browser-provider-saucelabs

Usage

Before using this plugin, save the SauceLabs username and access key to environment variables SAUCE_USERNAME and SAUCE_ACCESS_KEY, as described in SauceLabs documentation.

You can determine the available browser aliases by running

testcafe -b saucelabs

If you run tests from the command line, use the browser alias when specifying browsers:

testcafe "saucelabs:Chrome@beta:Windows 10" 'path/to/test/file.js'

If you leave out the browser version, it'll run against the latest stable version:

testcafe "saucelabs:Chrome:Windows 10" 'path/to/test/file.js'

When you use API, pass the alias to the browsers() method:

testCafe
    .createRunner()
    .src('path/to/test/file.js')
    .browsers('saucelabs:Chrome@beta:Windows 10')
    .run();

Configuration

Use the following environment variables to set additional configuration options:

  • SAUCE_JOB - the text that will be displayed as Job Name on SauceLabs,

  • SAUCE_BUILD - the text that will be displayed as Build Name on SauceLabs.

  • SAUCE_CONFIG_PATH - path to a file which contains additional job options as JSON. See SauceLabs Test Configuration for a full list.

  • SAUCE_CONNECT_OVERRIDES_PATH - path to a file that overrides SauceLabs connector options. See Sauce Connect launcher documentation for more information.

  • SAUCE_CAPABILITIES_OVERRIDES_PATH - path to a file that contains overrides for capabilities. See SauceLabs Test Configuration for details.

  • SAUCE_SCREEN_RESOLUTION - allows setting the screen resolution for desktop browsers in the ${width}x${height} format, has no effect when specified for a mobile browser. See Specifying the Screen Resolution for additional information.

  • SAUCE_API_HOST - if your SauceLabs account is registered in an EU country, you need to specify an EU-based data center, for instance, eu-central-1.saucelabs.com.

Example:

export SAUCE_SCREEN_RESOLUTION="1920x1080"
export SAUCE_JOB="E2E TestCafe"
export SAUCE_BUILD="Build 42"
testcafe saucelabs:safari,saucelabs:chrome tests/

Author

Developer Express Inc. (https://devexpress.com)

testcafe-browser-provider-saucelabs's People

Contributors

aleks-pro avatar aleksey28 avatar alexplischke avatar alexskorkin avatar andreybelym avatar bayheck avatar dependabot[bot] avatar farfurix avatar fpoppinga avatar inikulin avatar mbracker avatar patrykkopycinski avatar pavelmor25 avatar sdotson avatar trodrigues avatar ungb avatar vasilystrelyaev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testcafe-browser-provider-saucelabs's Issues

Allow to apply Chrome arguments via browser aliases

Description

  1. Running Testcafe using travis CI on sauce labs.
  2. command used --> saucelabs:[email protected]:Windows 10
  3. when I try to pass --> "saucelabs:Chrome --autoplay-policy=no-user-gesture-required" flag or args with command travis CI error out with

ERROR Unable to find the browser. "saucelabs:Chrome --autoplay-policy=no-user-gesture-required" is not a browser alias or path to an executable file.

Environment
Chrome:76
Windows10
testcafe version:- 1.4.0
"testcafe-browser-provider-saucelabs": "^1.7.0"
Using testcafe-sauce-browser-provider plugin
It works great on local machine when I gave the command
testcafe "chrome --autoplay-policy=no-user-gesture-required" test//.ts
Local machine is windows10 browser 76

Thanks in advance, Please let me know if need anything else

Browser config not found although it exists

I get the following error :

Error: Unable to find the browser. “saucelabs:[email protected]:Windows 10” is not a browser alias or path to an executable file.
at Object.getBrowserInfo (/MYDIR/node_modules/testcafe/lib/browser/provider/pool.js:84:19)

This happens randomly each test it is run. It's more common to get this error on chrome 77 than on chrome 76, but problem persists with both versions.

Also we are having trouble when taking screenshots on failure :
Testcafe failing taking screenshot

Error: Could not start Sauce Connect. Exit code 3221225595 signal: null

Our testcafe tests were running fine on 10/09/2021, however when our tests ran on 11/09/2021 (with no changes made at all on our end) we now get a sauce connect error:

ERROR Was unable to open the browser "saucelabs:Chrome@latest:Windows 10" due to error.

Error: Could not start Sauce Connect. Exit code 3221225595 signal: null
    at ChildProcess.<anonymous> (D:\a\1\test-automation-ui\src\node_modules\sauce-connect-launcher\lib\sauce-connect-launcher.js:566:12)
    at ChildProcess.emit (events.js:310:20)
    at ChildProcess.EventEmitter.emit (domain.js:482:12)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

We are passing the following env variables through to our testcafe tests:
SAUCE_API_HOST
SAUCE_CONFIG_PATH
SAUCE_ACCESS_KEY
SAUCE_USERNAME
SAUCE_JOB

These values haven't changed over the course of that time and were working fine all last week. The access key/username is the same as the one on our account too.

Unable to read the saucelabs username and access token which are created in environment variables section manually

Hi All,

I have set it up manually saucelabs username and access token manually in environment varaiables section, but when am running my script with help of below command, I can see variable value is undefined.

console.log('Saucelabs username: '+process.env['SAUCE_USERNAME'])

console.log('Saucelabs username: '+process.env.SAUCE_USERNAME')

Could you please suggest me what mistake am currently doing here

SAUCE_TUNNEL_IDENTIFIER environment variable is ignored

Ideally if this variable is present, that tunnel identifier would be used and a new tunnel would not be created. Currently this variable is ignored.

My use case is running tests against a QA environment inside a VPC, so I use a Sauce Connect Proxy which has its own tunnel identifier that I want my tests to use. Currently there is no way to configure this.

ERROR Unable to establish one or more of the specified browser connections.

Hi,
I set up environment variables SAUCE_USERNAME and SAUCE_ACCESS_KEY, and run the command in Terminal.

testcafe "saucelabs:[email protected]:Windows XP" "tests/features/rewind.js"

But I always get this error

ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

Should I establish the connecting to Sauce labs before I run the test?
I'm quite new to Sauce labs.
Thanks

When using Edge and concurrency no steps are executed on test

I was unable to run a test in Edge on saucelabs with concurrency ON. It gets up to the fixture page , and it doesnt execute even the first action on the webpage.
When running just one file remotely from my mac it works. Its very slow but at least it works.

Tunnel never closes and test never stops running

Hello DevExpress,
So I have been asking your help last week already and it worked great, but here is another issue which I think is related.
When I run a test with testcafe through a saucelabs browser, wether the test is successful or not, the tunnel created by Sauce Connect never closes, even after 30 minutes; and the test never stops running. I have 3 passed (1m 00s) for example in my terminal, but then nothing happens, and I have to hit ctrl + c to kill the test. That means I can't automate the testing.
I'm using Sauce Connector 4.4.5 which I have manually substituted to the old Sauce Connector 4.3.16 in the binary directory of the sauce-tunnel module version 2.5.
This is surprising because the specs of the 4.4.5 version say that from this version on, the tunnel willa automatically close after 5 minutes.
By running the debugger with the test, I could see that the test goes into the SaucelabsConnector.prototype.disconnect function, but then must go into a sort of infinite loop.

This problem is not present when I run testcafe on a local browser or with Browserstack.

Do you have an idea of what I could do?
Thanks a lot

Run tests on SauceLabs without Sauce Connect Proxy

I tried to use this module to run tests from my local machine on SauceLabs and saw that it always uses a Sauce Connect Tunnel. As the website I am testing is publicly available, I don't need the Sauce Connect Proxy and also don't want to use it.
Could you make this configurable so that I can specify that no Sauce Connect Tunnel is used?

Unable To Open Two Saucelabs Connections Concurrently Using This Module

Hi There,

On occasions I need to open two or more tunnels to sauce labs. Out of the box this module sends the following command line arguments to the library 'sauce-connect-launcher'

[
"-u",
"<sauce_user>",
"-k",
"<sauce_key>",
"--tunnel-identifier",
1538299859372,
"--direct-domains",
".google.com,.gstatic.com,*.googleapis.com",
"--readyfile",
"/var/folders/9k/9y01ch7s6h95s9_ky6g_bpc40000gp/T/sc-launcher-readyfile"
]

That module (sauce-connect-launcher) is using this binary to establish a tunnel to sauce labs

https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy#SauceConnectProxy-DownloadSauceConnect

When this executes once the command completes successfully, see below

ACTIONGOLFNOT:bin $ ./sc -i 1538299859372 -u <sauce_user> -k <sauce_key> --direct-domains .google.com,.gstatic.com,.googleapis.com
30 Sep 10:40:45 - Sauce Connect 4.5.1, build 4191 13eede5
30 Sep 10:40:45 - Using CA certificate verify path /etc/ssl/certs.
30 Sep 10:40:45 - *** WARNING: open file limit 256 is too low!
30 Sep 10:40:45 - *** Sauce Labs recommends setting it to at least 8000.
30 Sep 10:40:45 - Starting up; pid 3186
30 Sep 10:40:45 - Command line arguments: ./sc -i 1538299859372 -u <sauce_user> -k **** --direct-domains .google.com,.gstatic.com,
.googleapis.com
30 Sep 10:40:45 - Log file: /var/folders/9k/9y01ch7s6h95s9_ky6g_bpc40000gp/T/sc-1538299859372.log
30 Sep 10:40:45 - Pid file: /tmp/sc_client-1538299859372.pid
30 Sep 10:40:45 - Timezone: IST GMT offset: 1h
30 Sep 10:40:45 - Using no proxy for connecting to Sauce Labs REST API.
30 Sep 10:40:46 - Started scproxy on port 54196.
30 Sep 10:40:46 - Please wait for 'you may start your tests' to start your tests.
30 Sep 10:40:53 - Secure remote tunnel VM provisioned.
30 Sep 10:40:53 - Tunnel ID: 29b6f873149e4df5aa6fc7757dec280f
30 Sep 10:40:53 - Using no proxy for connecting to tunnel VM.
30 Sep 10:40:53 - Starting Selenium listener...
30 Sep 10:40:53 - Establishing secure TLS connection to tunnel...
30 Sep 10:40:54 - Selenium listener started on port 4445.
30 Sep 10:40:56 - Sauce Connect is up, you may start your tests.

However, when I attempt to open another tunnel I get the following output with the exact same parameters

ACTIONGOLFNOT:bin $ ./sc -i 1538300185679 -u <sauce_user> -k <sauce_key> --direct-domains .google.com,.gstatic.com,.googleapis.com
30 Sep 10:42:07 - Sauce Connect 4.5.1, build 4191 13eede5
30 Sep 10:42:07 - Using CA certificate verify path /etc/ssl/certs.
30 Sep 10:42:07 - *** WARNING: open file limit 256 is too low!
30 Sep 10:42:07 - *** Sauce Labs recommends setting it to at least 8000.
30 Sep 10:42:07 - Starting up; pid 3187
30 Sep 10:42:07 - Command line arguments: ./sc -i 1538300185679 -u <sauce_user> -k **** --direct-domains .google.com,.gstatic.com,
.googleapis.com
30 Sep 10:42:07 - Log file: /var/folders/9k/9y01ch7s6h95s9_ky6g_bpc40000gp/T/sc-1538300185679.log
30 Sep 10:42:07 - Pid file: /tmp/sc_client-1538300185679.pid
30 Sep 10:42:07 - Timezone: IST GMT offset: 1h
30 Sep 10:42:07 - Using no proxy for connecting to Sauce Labs REST API.
30 Sep 10:42:07 - Unable to serve metrics on localhost:8888, error was: listen tcp [::1]:8888: bind: address already in use
30 Sep 10:42:08 - Started scproxy on port 54208.
30 Sep 10:42:08 - Please wait for 'you may start your tests' to start your tests.
30 Sep 10:42:19 - Secure remote tunnel VM provisioned.
30 Sep 10:42:19 - Tunnel ID: 902e6921826c44f69416460aa52b69af
30 Sep 10:42:19 - Using no proxy for connecting to tunnel VM.
30 Sep 10:42:19 - Starting Selenium listener...
30 Sep 10:42:19 - Establishing secure TLS connection to tunnel...
30 Sep 10:42:19 - Failed to start Selenium listener. Please make sure there are no other applications using the Selenium port, or specify an alternative port for Sauce Connect via the --se-port option (exit code 2).
30 Sep 10:42:19 - Please check logfile for more information.
30 Sep 10:42:19 - Sauce Connect could not establish a connection.
30 Sep 10:42:19 - Please check your firewall and proxy settings.
30 Sep 10:42:19 - You can also use the sc --doctor to launch Sauce Connect in diagnostic mode.
30 Sep 10:42:19 - Goodbye.

Namely, the first instance is using selenium port 8888, while the second instance tries to connect on that same port 8888 which is why it fails to connect in the second circumstance. The issue I describe above is exactly what I'm seeing when I tunnel to SauceLabs with this module via two processes on the same machine as the second instance is trying to use a port already in use and fails. To fix this the module needs to pass the selenium port down to sauce-connect-launcher so to bypass this problem. Let me know if there are any questions.

Cannot switch between landscape and portrait mode using saucelabs device emulator or simulator

I use device emulators or simulators for running TestCafe automation tests
e.g. command
testcafe "saucelabs:iPad Pro (12.9 inch) [email protected]" tests/Navigation/*.js

I cannot do the following device orientations, which is a real limitation:

1/ Preset configure device simulator to landscape or portrait mode
E.g
With selenium you can set caps
"deviceOrientation": “portrait”
"deviceOrientation": “landscape”

2/ change device simulator orientation
E.g.
With appium you can rotate the device from portrait to landscape in the code

How can we add these abilities to testcafe /saucelabs?
Is there a way of doing this already?

testcafe sauce-connect launcher parallel execution

Hello Team, Use this plugin I notice that sauce-connect launcher opens up tunnel to sauce labs. But when I try to invoke parallel execution

Scenarios

  1. Run the tests from my machine twice at the same time -> They fail
  2. This behavior is also reproducible in Jenkins as Testcafe uses the sauce-connect launcher within the dependency to open tunnel.

Is there a way to overcome this issue to allow running parallel tests?

npm package gives ENOENT error in Linux platform with testcafe/testcafe docker image

Run tests in saucelabs from Concourse testcafe/testcafe docker image with linux platform

Current behavior:
testcafe -b saucelabs returns browser lists. But when tried to trigger execution for browser "browsers": "saucelabs:[email protected]:OS X 10.10" getting below error back

ERROR Was unable to open the browser "saucelabs:[email protected]:OS X 10.10" due to error.

Error: spawn /tmp/build/4ef0e317/automation-repo/node_modules/sauce-connect-launcher/sc/sc-4.5.4-linux/bin/sc ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:81:21)

Using "testcafe-browser-provider-saucelabs": "1.8.0" npm package.
Passing browser string in testcaferc.json

ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

Hello,

What happens

After starting test with command line above (or a different browser/OS combination), then the test shows a running icon for 6 minutes, and then I get the message:
ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
Nothing more.

This is a similar problem described in another ticket, which is closed:
#10
ERROR Unable to establish one or more of the specified browser connections.

I read everything, but I do not get it done. In this other ticket are also advises how to start tunnel-logging. But files in node_modules/* have changes. Not only line count, also content. I don't get a tunnel-Log active or do not find logging content.

My setup

  • I am in a linux VM (Mint) on a Windows 10 host, behind a router (as most people today will be)
  • Node-js Project of course
  • "testcafe-browser-provider-saucelabs": installed this week, should be latest version
  • tried start very small test example with
    "testcafe "saucelabs:Chrome" src/test/client/js/e2e/sctest.ts" , but tried also other starts.
  • I tried to start a tunnel manually with the saucelabs tunnels for linux, and it works fine:
    bin/sc -u <SAUCE_USERNAME> -k <SAUCE_ACCESS_KEY> -x https://eu-central-1.saucelabs.com/rest/v1
    shows me
    Started scproxy on port 45829. 27 May 09:54:12 - Please wait for 'you may start your tests' to start your tests. 27 May 09:54:28 - Secure remote tunnel VM provisioned. 27 May 09:54:28 - Tunnel ID: <ID> 27 May 09:54:28 - Using no proxy for connecting to tunnel VM. 27 May 09:54:28 - Starting Selenium listener... 27 May 09:54:28 - Establishing secure TLS connection to tunnel... 27 May 09:54:28 - Selenium listener started on port 4445. **27 May 09:54:29 - Sauce Connect is up, you may start your test**s. This tells me (I hope) that there are no Internet or Firewall problems. Because manual tunnel could be opened fine. And also my SAUCE_USERNAME and SAUCE_ACCESS_KEY must be correct. When I open this tunnel, I also see the tunnel active on my Saucelabs online dashboard.
    But as I understand, this manual start of a tunnel is not needed and "testcafe-browser-provider-saucelabs" start it's own tunnel.
  • Of course USERNAME and SAUCE_ACCESS_KEY are exported as linux env variables.
  • test runs fine locally without saucelabs, it's a simple test, nothing wired.

need help

I read and tried much, but I don't get a solution.
I am new to nodejs, saucelabs, etc.
Would be very kind, when someone can help, perhaps by starting to get more logfile.

thanks a lot
Sebastian

The environment you requested was unavailable. for saucelabs:internet [email protected]:Windows 10

When I run the following npm command:

NODE_ENV=production INTERCOM_APP_ID=none npm run build && testcafe \"saucelabs:internet [email protected]:Windows 10\" ./src/__e2e__/tests/**/*.test.js -c 4 --app=\"npm run start\" --app-init-delay 2000"

with testcafe-browser-provider-saucelabs 1.6.1 I get:

Error: [init({"tunnelIdentifier":1553099764562,"idleTimeout":1000,"browserName":"internet explorer","version":"11.285","platform":"windows 10","prerun":"sauce-storage:disable-intranet-compatibility-mode-in-ie.bat"})] The environment you requested was unavailable.
Sauce could not start your job. For more information on what happened, please visit https://app.saucelabs.com/tests/eb0aebcca74d4d6e9fc0b8feab7844d1
    at /home/travis/build/crucible-risk/front-end/node_modules/wd/lib/webdriver.js:138:15
    at Request._callback (/home/travis/build/crucible-risk/front-end/node_modules/wd/lib/http-utils.js:89:7)
    at Request.self.callback (/home/travis/build/crucible-risk/front-end/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/home/travis/build/crucible-risk/front-end/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/home/travis/build/crucible-risk/front-end/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)

This same command had worked a few months ago, any idea on root cause?

Error connecting Saucelabs

Using this example (https://github.com/vogloblinsky/testcafe-saucelabs) & starting from this one too (https://github.com/DevExpress/testcafe/tree/master/examples/running-tests-using-travis-and-saucelabs) i got this error :

ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

https://travis-ci.org/vogloblinsky/testcafe-saucelabs/builds/435371165

Just for information, i can see the tunnel created by testcafe in my Saucelabs dahsboard during the test.

I am using latest version of testcafe and testcafe-browser-provider-saucelabs.

Ability to specify port to the saucelabs connection

For whatever reason on all of my machines port 4445 (which is the default for the selenium listener) is blocked or in use, (this is a corporate machine so it could be anything). This is easily fixed through sauce-connect by just specifying a different port number, currently there is no option to specify a port number, neither is there one in the saucelabs-connector, but we can specify port number in sauce-connect-launcher. Is there anyway we can bubble that up to the browser provider either through an ENV Variable or through a config option (command line or config file either way)?

Allow consumers of this package to pass in overrides for Sauce Connect Proxy

There are many scenarios where these options, especially directDomains or noSslBumpDomains, would be really useful for the consumer of this package to specify. At the moment, these are hard-coded: https://github.com/DevExpress/testcafe-browser-provider-saucelabs/blob/master/src/index.js#L187-L189 , which makes it impossible for me to test web socket functionality due to the inability to specify noSslBumpDomains.

My proposal is that we use a similar mechanism that this package already does for SAUCE_CAPABILITIES_OVERRIDES_PATH, perhaps called SAUCE_CONNECT_OVERRIDES_PATH, where consumers can specify their overrides.

Happy to open a pr for the approach outlined above or an alternative that the maintainers think is better.

Support specifying "latest" as a browser versions of Chrome

According to the SauceLabs documentation, you can specify "latest", "latest-1", "latest-2", etc. to get the latest stable releases of Chrome or Firefox. For example, if Chrome 73 is the latest stable release, "latest" will point to 73, "latest-1" will point to 72, etc.

When I try specifying a "latest" version in TestCafe, I get the following error message:

ERROR Unable to find the browser. "saucelabs:Chrome@latest-1:Windows 10" is not a browser alias or path to an executable file.

Since my project is open source, I can point you to the exact commit and the Travis CI build which contains this error message:

Is this the correct library for making this change? It's hard for me to tell exactly which library is responsible for the error.

Add retry option

Saucelabs tests often fail with an error like this:

ERROR Error: 18 Jul 10:56:47 - Sauce Connect could not establish a connection.
    at handleError (/home/circleci/app/Packages/Application/Neos.Neos.Ui/node_modules/sauce-connect-launcher/lib/sauce-connect-launcher.js:410:17)

Would be nice to add an auto retry option for such connection failures.
Wdyt?

edit: oh, there's MAX_TUNNEL_CONNECT_RETRY_COUNT. Maybe make it configurable in that case?

Does MAC_OS_MAP need to be updated?

Looking at the values of this array, I see this would not pick up any of the newer Mac OS versions such as MacOS / [Hight] Sierra strings.

Screenshots are crashing testcafe

What is your Test Scenario?

When using the screenshot option running on a jenkins pipeline with saucelabs provider the following occurs.
When a test fails the following message is displayed multiple times and the test finally crashes. Testcafe exits with an error.

Error: [saveScreenshot("/OURJENKINSDOCKERDIR/screenshots/2019-10-22_17-03-12/test-1/Chrome_75.0.3770_Windows_10.0.0/errors/1.png")] ENOENT: no such file or directory, open '/OURJENKINSDOCKERDIR/screenshots/2019-10-22_17-03-12/test-1/Chrome_75.0.3770_Windows_10.0.0/errors/1.png'

This started happening without any change to our running instance and everything worked fine before. It even included the screenshot it took on our allure report.

Your Environment details:

  • testcafe version: 1.6.0
  • node.js version: v10.16.3
  • command-line arguments:
  • browser name and version: Chrome 76 @ Saucelabs
  • platform and version: Win 7
  • other: We are using the saucelabs browser provider

Plugin is not returning Saucelabs test build link of all concurrent sessions to Jenkins pipeline job

Hi Team,

we are using testcafe-browser-provider-saucelabs plugin and this is the command we are using to run the Integration tests
testcafe \"saucelabs:[email protected]:macOS 10.14\" -c 3 --disable-page-caching --skip-js-errors

Problem:
As you can see in the command, we are running the tests concurrently in 3 instances of provided browser.
When executing that command, it returns only one Saucelabs session's test build link of each browser to Jenkins Job and the rest 2 sessions link are not available to user to debug/check.

In some projects, we are running the tests with multiple browser and multiple concurrency. Facing the same problem

Screenshot of Saucelabs dashboard:
Screenshot 2022-04-18 at 3 58 22 PM

Screenshot of Jenkins Pipeline Job:
Screenshot 2022-04-18 at 3 57 58 PM

Workaround:
Currently we have to navigate to Sauce Labs dashboard to access all the 3 instances of test builds.
 
Expected:
Plugin should provide Saucelabs test build links for all the concurrent sessions in Pipeline Job

Safari Issues - The environment you requested was unavailable

Hello,

we face issues on using safari. We are in parallel in contact with saucelabs, but I also wanted to ask here, because the error message itself is produced by the testcafe-browser-provider-saucelabs plugins (dependency):

We execute fine tests on Chrome, Firefox, Edge on Windows 10.
All are working without problems.

But switching to "saucelabs:Safari@latest:macOS 10.14" or "saucelabs:Safari@latest:macOS Catalina"
gives us the message: “The environment you requested was unavailable.

I also check saucelabs env by using "testcafe -b saucelabs | grep -i safari" and it is listing me exactly the environments I am using. So all seems fine for me.

After contacting saucelabs support they advice me to switch to another resolution (because "full HD 1920x1080" is not supported on macos/Safari). Here you can find what resolution is supported:
https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
I switched to 1600x1200 as it is supported. But still, the same error.

Complete Error messsage
Error: [init({"name":"[NAME]","tunnelIdentifier":[TUNNELID],"idleTimeout":1000,"browserName":"safari","version":"latest","platform":"macos catalina","screenResolution":"1600x1200"})]
The environment you requested was unavailable.

Of course I checked tons of times if enough slots/licenses are free.

--> Someone has an idea why Safari is not working for us?
--> Or any advice how to get a error message about the real problem what is happening? Perhaps you can lead me, where to find the response of saucelabs to check the message-body what saucelabs is answering on requesting the environment.

Thanks a lot!
Sebastian

Running tests sequentially

I want to run our testsuite across multiple browsers version (e.g. "saucelabs:safari,saucelabs:chrome"), but I need all tests to run sequentially, in order to not abuse our backend.
Is it possible to do so in one command, or I'd have to split it into multiple testcafe launches?

error trying to use this browser provider with travis

i'm having trouble setting up this browser provider for use with travis. we used the instructions from the docs, though we're using make to kick off the tests instead of from the package.json test link.

i am able to use the same command with the same creds locally and i can set up a sauce connect tunnel using travis's sauce connect addon with the same creds. here are the logs from the travis attempt:

2018-10-31 21:09:23.690 [5055] Sauce Connect 4.5.1, build 4191 13eede5 -dirty
2018-10-31 21:09:23.690 [5055] Using CA certificate bundle /etc/ssl/certs/ca-certificates.crt.
2018-10-31 21:09:23.690 [5055] Using CA certificate verify path /etc/ssl/certs.
2018-10-31 21:09:23.690 [5055] Trying to autodetect proxy settings
2018-10-31 21:09:23.691 [5055] Starting up; pid 5055
2018-10-31 21:09:23.691 [5055] Command line arguments: /home/travis/build/LuminalHQ/risk-manager/tests/e2e/node_modules/sauce-connect-launcher/sc/sc-4.5.1-linux/bin/sc -u luminal_web -k **** --tunnel-identifier 1541020160197 --direct-domains *.google.com,*.gstatic.com,*.googleapis.com --logfile sc_1541020160197.log --readyfile /tmp/sc-launcher-readyfile 
2018-10-31 21:09:23.692 [5055] Log file: sc_1541020160197.log
2018-10-31 21:09:23.692 [5055] Pid file: /tmp/sc_client-1541020160197.pid
2018-10-31 21:09:23.692 [5055] Timezone: UTC GMT offset: 0h
2018-10-31 21:09:23.692 [5055] Using no proxy for connecting to Sauce Labs REST API.
2018-10-31 21:09:24.257 [5055] PROXY *** scproxy started ***
2018-10-31 21:09:24.258 [5055] PROXY found DNS server 169.254.169.254
2018-10-31 21:09:24.307 [5055] Started scproxy on port 44414.
2018-10-31 21:09:24.307 [5055] Please wait for 'you may start your tests' to start your tests.
2018-10-31 21:09:24.642 [5055] error querying from https://saucelabs.com/rest/v1/luminal_web/tunnels?full=1, error was: {"message": "Not authorized"}. HTTP status: 401 Unauthorized
2018-10-31 21:09:24.642 [5055] Sauce Connect could not establish a connection.
2018-10-31 21:09:24.642 [5055] Please check your firewall and proxy settings.
2018-10-31 21:09:24.642 [5055] You can also use the sc --doctor to launch Sauce Connect in diagnostic mode.
2018-10-31 21:09:24.642 [5055] Goodbye.

the command we're using to kick off the build: testcafe "saucelabs:[email protected]:Windows 10" --selector-timeout 30000 --assertion-timeout 30000 --page-load-timeout 30000 suites/**/*.js, which works as expected locally.

Error: Failed to reach the Sauce Labs API.

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:[email protected]: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:[email protected]: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

Mobile Instructions

Hey, first of all thanks for this library

I was trying to run my tests against mobile supported browsers on saucelabs but no dice.
I can run against any desktop environment available there, however none of the configs against mobile browsers worked

Is there some example or a simple command line example on how to build the capability for a mobile browser, say iphone 6 iOS ?

Unable to run testcafe test on Saucelabs

Trying to run the following on saucelabs with testcafe. All my test are failing, but wanted to isolate the issue here:

test.js

fixture`Test`.page("https://www.google.com");

test("Just Wait", async t => {
  await t.wait(100000);
});

command I ran after configuring the correct values for SAUCE_ACCESS_KEY and SAUCE_USERNAME.

testcafe "saucelabs:[email protected]:Windows 10" test.js

This use to work about 2 weeks ago. Test just hangs forever and I see the following on Saucelabs:

image

See the following browser error:

Unable to forward this request at this time

client error (ERR_CANNOT_FORWARD)

This request could not be forwarded to the origin server or to any parent caches.

Works when running test locally.

Both of these are installed globally:
[email protected]
[email protected]

Simplify test identification in the SauceLabs dashboard when concurrency mode is enabled

We are trying to run our test suite (2 tests) concurrently on Saucelabs. However, when they finish, testcafe does not report to Saucelabs correctly if the test passed/failed, resulting in Saucelabs timing out and marking each test as failed.

Since the naming of the tests are done through a single environment variable, all of our tests that run will have the same name, making it impossible to differentiate between tests on Saucelabs. Without having some unique identifier that we provide the Saucelabs metadata, we cannot use any of their APIs to update the tests in an after/afterEach hook.

Is it possible (whether in the Runner class or test) to provide users with the Job IDs or to make it so the naming of tests in done by an environment variable and (if not provided) fallback to the test name?

ERROR Error: Could not start Sauce Connect. Exit code 2 signal: null

Test won't start due to this error appearing during testcafe startup.
I have SAUCE_USERNAME and SAUCE_ACCESS_KEY set up correctly and
testcafe -b saucelabs when I run it but running any normal test always give the same error.

Here's the command I used to run the test:
testcafe "saucelabs:Chrome@beta:Windows 10" test.js -S --selector-timeout 2000 --assertion-timeout 2000

Here's the entire error output:
ERROR Error: Could not start Sauce Connect. Exit code 2 signal: null at ChildProcess.<anonymous> (/usr/lib/node_modules/testcafe-browser-provider-saucelabs/node_modules/sauce-connect-launcher/lib/sauce-connect-launcher.js:561:12) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

New release?

Hello all,

I appreciate your review and acceptance of my contribution in #75 .

I'm curious to know if it would be possible to publish a new release that incorporates this change? The company I work for is eager to take advantage of this new capability.

Sauce connect cannot established for mulitiple builds when concurrent sessions reach limit

What is your Test Scenario?
We have the integration tests triggered on each build. Running tests through testcafe-browser-provider-saucelabs with 2 concurrent test configuration from Saucelabs.
Each commit triggers 2 identical test suites running same time and show up on saucelabs as 2 concurrent tests.

This is workingWith long enough interval to finish the ongoing tests on saucelabs to triggere the next build the sauce-connection is able to set properly and pass all the tests.
This is not workingOn the other side, 2 separated builds triggered similar time since one build takes up all the concurrent sessions the other build won't be able to set up sauce connection and will fail from the build.

What is the Current behavior?
When 2 builds are made one after the other (short time period), the test from one build would fail due to this error from console ERROR Error: 7 Oct 19:17:01 - Sauce Connect could not establish a connection.

What is the Expected behavior?
Saucalebs should be able to queue the tests and consume the tests in queue after finish the on-going ones. So even two tests (each has two concurrent sessions) are trying to run, the sauce tunnels
What is your web application and your TestCafe test code?
simply installed testcafe-browser-provider-saucelabs, running via codefresh.yml with docker images.
from yml the code related to run the test:
command: bash -c "sleep 60 && testcafe --app-init-delay 70000 \"saucelabs:[email protected]:macOS 10.14,saucelabs:[email protected]:Windows 10\" integration/specs/*/*spec.{js,jsx}"

Steps to Reproduce:
Prepare some tests written in testcafe, link the dependency of testcafe-browser-provider-saucelabs to this updated repo.
Prepare a test account in saucelabs
Run some tests and make sure it browserstack reaches its subscription limitation.
Start a new test, for example
The new test cannot have sauce connect connection set

Allow the option to pass 'maxDuration' timeout value.

By default, Sauce limits the duration of test execution to 30 minutes. This limit can be adjusted on per-job basis and the maximum value is 10800 seconds. See for more details here - https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-MaximumTestDuration

Our entire TestCafe test suite (300+ tests) takes about an 1hr:15mins to run the tests and currently our test execution timeouts after 30mins(1800secs) on Sauce. (screenshot attached below).

We would like to pass the 'maxDuration' timeout option so that our test execution won't timeout and set required execution time. Could you please provide the option to pass this parameter? Thanks.

screen shot 2018-05-14 at 1 27 24 pm

Can't run Saucelabs test on Sierra or High Sierra

When attempting to run the command:

testcafe "saucelabs:[email protected]:macOS Sierra" test.js

I receive the error:

Error: [init({"name":"Testcafe tests","build":"123","tunnelIdentifier":1528924592581,"idleTimeout":1000,"browserName":"chrome","version":"57.0","platform":"macos sierra"})] The environment you requested was unavailable

When looking at the Saucelabs metadata I see this:
screen shot 2018-06-13 at 2 27 37 pm

When creating this environment with manual tests the metadata shows this:
screen shot 2018-06-13 at 2 32 54 pm

It seems like all you need to change is the command from what was above to:

testcafe "saucelabs:[email protected]:mac 10.12" test.js

TestCafe to SauceLabs Test Ratio and Configuration File Questions

Thanks for the work on this Plugin! While SauceLabs has now released support for TestCafe, I had the following questions around this library:

  • Will it be continued to be maintained?
  • Currently SauceLabs states it can have a 1:1 test ratio, this library only offers 1 SauceLabs tests for a testcafe execution. Will that change anytime soon?
  • Can we specify the SauceLabs Configuration File as a flag rather than an environment variable?

Imported Role instances not working as intended.

My code works perfectly in all local browsers but fails consistently with Sauce Labs remote browsers. I create an instance of a Role in a module and then import it to be a parameter in a useRole call. When run locally, everything functions correctly. When run remotely, it walks through the login process but gets kicked back to the login screen as though the session data hasn't been retained.

Module

let admin, instance;

class Helper {
  constructor() {
    if (!instance) {
      instance = this;
    }
    return instance;
  }

  get admin() {
    if (!admin) {
      admin = roleFactory('https://www.example.com', {email: '[email protected]', password: 'abc123'});
    }
    return admin;
  }

  roleFactory(url, def) {
    let role = Role(url, async t => {
      // Interact with page
    }, { preserveUrl: true });
    return Object.assign(role, {def});
  }
}

export default Helper;

Test file snippet

const helper = new Helper();
fixture `smoke tests`
  .page(url)
  .beforeEach(async () => await t.useRole(helper.admin));

In my investigation, I moved pieces of the Helper code into the test code file and everything worked, such as

  .beforeEach(async () => await t.useRole(helper.roleFactory(url, helper.admin.def)));

In this case, helper.admin is still the same role instance with a def attribute attached to it as before. Somehow though, passing helper.admin to useRole impacts test runs on Sauce Labs in ways that it doesn't for local runs.

Allow customizing Sauce job name and build name

I use SauceLabs with CircleCI, and it would help a lot if I could set the job name and build name in particular. I can't kill tunnels because CircleCI lacks a hook to cleanup tunnels for cancelled builds, so I run a job at the beginning of each build that closes unused builds, but it does so via the job and build name.

Perhaps via custom ENV vars?

Unable to run in an Alpine Docker image

When trying to run TestCafe in an Alpine image against Sauce Labs I noticed that the SauceConnect binary supplied by the node package saucelabs-connector is unrecognized (ENOENT error).

Using the following setup: Testcafe w/ SauceLabs in Alpine Docker container

I get this error when running the commands:

$ docker build -t test:latest .
$ docker run -it --rm --name test -e SAUCE_USERNAME=xxx -e SAUCE_ACCESS_KEY=xxx test 'saucelabs:Chrome' tests
ERROR Was unable to open the browser "saucelabs:Chrome" due to error.

Error: spawn /app/node_modules/sauce-connect-launcher/sc/sc-4.4.11-linux/bin/sc ENOENT
    at _errnoException (util.js:999:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
    at onErrorNT (internal/child_process.js:389:16)
    at process._tickCallback (internal/process/next_tick.js:152:19)

Type "testcafe -h" for help.

The official TestCafe documentation builds an Alpine docker image, so I'd imagine this is something unexpected. When looking at the filesystem in the container, the sauce connect binary exists on disk but is not executable.

Question: Outputting SauceOnDemandSessionID

Following the saucelabs guide on integrating with jenkins and curious what the best approach would be for outputting the SauceOnDemandSessionID with TestCafe.

This value is used in the Outputting the Jenkins Session ID to stdout step shown below.

Java Example from docs:

private void printSessionId() {
 
    String message = String.format("SauceOnDemandSessionID=%1$s job-name=%2$s",
    (((RemoteWebDriver) driver).getSessionId()).toString(), "some job name");
    System.out.println(message);
} 

Thanks!

Chrome Latest + Mac 10.15 is not available in browserlist

Sauce Labs - Chrome Latest with Mac 10.15 Combination is available in Sauce Labs Cross Browser List, but testcafe-browser API don't have it

saucelabs:Chrome@latest:macOS 10.15

Error:
ERROR Unable to find the browser. "saucelabs:Chrome@latest:macOS 10.15" is not a browser alias or path to an executable file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.