theintern / intern

A next-generation code testing stack for JavaScript.
https://theintern.io/
Other
4.36k stars 309 forks source link

SauceLabs tunnel fails on EU region #979

Open lethevimlet opened 5 years ago

lethevimlet commented 5 years ago

Expected behavior

When using tunnel: "saucelabs", tunnelOptions should work with both US and EU server.

Current behavior

The tunnel fails to connect when targeting an EU region account since by default it uses the US endpoint.

Possible solution

In order to target a different endpoint than default the SC binary must specify a "-x" argument sc -u [username] -k [accessKey] -x https://eu-central-1.saucelabs.com/rest/v1 This could be easily solved by providing a new "tunnelOptions.endpoint" property to be used internally by SC binary.

Steps to reproduce (for bugs)

1) Register an EU region account trial on saucelabs.com 2) Use the default configuration as currently specified on Intern docs.

Environment

Intern version: 4.4.2 Node version: v8.9.4

Additional information

It will also be nice to update the SC binary downloaded by Intern, since its a bit out of date.


UPDATED: Using EU server is supported through tunnelOptions.restUrl, thou there are some issues with different results between US and EU server.

lethevimlet commented 5 years ago

My bad, this is already supported 🤦‍♂️ tunnelOptions.restUrl

This link https://theintern.io/digdug/module-digdug_SauceLabsTunnel.html should be added to the Intern doc section explaining tunnel config.

Unexpected output difference between US and EU servers I must be missing something or there's must be an issue using restUrl property, since using US account works like a charm whereas adding restUrl and using the EU account yields the following error

US account (Everything OK!): image

The same config, just changing auth data to an EU account and adding restURL pointing to the EU rest API (Throws ERROR!): image

Here is the actual test:

index.html

<script>
  var greet = function (name) {
    if (!name) {
      name = "world";
    }
    return "Hello, " + name + "!";
  };

  function internTest(callback) {
    setTimeout(function () {
      callback(greet("Murray"));
    }, 1000);
  }
</script>

test.js

const { suite, test } = intern.getInterface("tdd");
const { assert } = intern.getPlugin("chai");

suite("hello", () => {
    test("greet", ({ remote }) => {
        return remote.get(intern.config.remoteUrl + "/index.html").sleep(1000).executeAsync(function (callback) {
            internTest(callback);
        }).then(function (value) {
            assert.strictEqual(value, "Hello, Murray!", "greet should return a greeting for the person named in the first argument");
        });

    });
});

So, unfortunately, in a way or another, the issue title still applies : (