Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 16 12:47
    Tyoneb synchronize #201
  • Sep 14 14:33
    Tyoneb edited #201
  • Sep 13 08:54
    Tyoneb opened #201
  • Sep 03 07:35
    ready-research opened #1184
  • Aug 30 12:09

    jason0x43 on 2.6.1

    (compare)

  • Aug 30 12:09

    jason0x43 on master

    Bump version number (compare)

  • Aug 30 12:07

    jason0x43 on master

    Update Sauce Connect version (compare)

  • Aug 30 12:05

    jason0x43 on master

    Update ghpages script [ci skip] (compare)

  • Aug 30 12:05

    jason0x43 on gh-pages

    Update assets (compare)

  • Aug 30 12:04

    jason0x43 on master

    Update webdriver versions [ci … (compare)

  • Aug 03 19:38
    dstaley edited #1183
  • Jul 29 20:12
    dstaley opened #1183
  • Jul 28 21:25
    dstaley commented #959
  • Jul 28 21:23
    dstaley commented #959
  • Jul 12 19:21

    jason0x43 on master

    Update dependencies, bump versi… (compare)

  • Jul 12 18:29
    JamieSlome commented #1181
  • Jul 12 18:15

    jason0x43 on 1.0.0-beta.3

    Update dependencies, bump versi… (compare)

  • Jul 12 18:15

    jason0x43 on 2.4.0

    (compare)

  • Jul 12 18:15

    jason0x43 on 2.6.0

    (compare)

  • Jul 12 18:15

    jason0x43 on 4.10.0

    (compare)

Slobodan Mišković
@slobo
Or are commands queued up and DOM mutations "serialized" in such a way that as long as #progressbar appears in DOM after the click, even for a blip, findwill succeed?
And, does this code then differ in functionality / reduce the chance of missing the progress bar?
await this.remote
        .findById("some-button")
          .click()
        .end()
        .findById("progressbar") 
        .waitForDeletedById("progressbar");
Jason Cheatham
@jason0x43

Find commands will only find elements that are present when the find call hits the browser, or within a short time after (the find timeout). As far as timing goes, the first and second examples are the same. One possibility for catching something like a transient progress bar would be to issue the find for that first, like

await Promise.all([
  this.remote.findById('progressbar'),
  this.remote.findById('some-button').click()
]);
await this.remote.waitForDeletedById('progressbar');

This should work as long as the find and click for the button happen before the find timeout. Even this isn't guaranteed to see the progress bar, though. When a find is issued, the webdriver driving the browser will periodically check for the element until the find timeout expires. If the progress bar appeared and disappeared between two of those checks, it could be missed.

Slobodan Mišković
@slobo

Thanks for the clear description, this helps explain some intermittent failures we've been seeing. I think our best way to avoid any flakiness is to do something like this:

await this.remote
  .findById("some-button")
  .click()
  .sleep(500); // some breathing room to make sure progressbar is added to DOM
await this.remote
  .waitForDeletedById('progressbar');

I'm not a big fan of sleeps, but probably best we can do, eh?

1 reply
Carson
@carsnwd

hello. anyone know with intern plugins, how I could/should load a node module to use within the plugin code? I have some plugin code where I am trying to load a JSON file prior to the tests running such like...

// Intern plugin to load t9n json before tests load
var fs = require("fs");
var path = require("path");
intern.registerPlugin("t9nLoader", () => {
  var jsonPath = path.join(
    __dirname,
    "..",
    "..",
    "src",
    "app",
    "assets",
    "t9n",
    "en.json"
  );
  global.t9n = JSON.parse(fs.readFileSync(jsonPath, "utf-8"));
});

and a few other variations....but I can't seem to workout how to get the node modules I need for the plugin. Any help would be appreciated.

Error I get is just require is not defined on that code. Though I've been running a bit in circles trying a bunch of methods.
Jason Cheatham
@jason0x43
Using require like that should be fine, as long as the plugin is only running in Node (it won't work in a browser).
Carson
@carsnwd
ahh doesnt seem to work still, but idk maybe a different question be how would you load a JSON like this? I'm trying to load it and attach it to the dojoConfig file on this project and it loads believe through an intern loader like this. Been stuck trying to work with the intern loader/plugins and configuration and general for this
("use strict");
intern.registerLoader(function(options) {
  var globalObj = typeof window !== "undefined" ? window : global;
  options.baseUrl = options.baseUrl || intern.config.basePath;
  if (!("async" in options)) {
    options.async = true;
  }
  intern.log("Configuring Dojo loader with:", options);
  globalObj.dojoConfig = options;
  return intern.loadScript("node_modules/dojo/dojo.js").then(function() {
    var require = globalObj.require;
    intern.log("Using Dojo loader");
    return function(modules) {
      var handle;
      return new Promise(function(resolve, reject) {
        handle = require.on("error", function(error) {
          intern.emit("error", error);
          reject(new Error("Dojo loader error: " + error.message));
        });
        intern.log("Loading modules:", modules);
        require(modules, function() {
          resolve();
        });
      }).then(
        function() {
          handle.remove();
        },
        function(error) {
          handle && handle.remove();
          throw error;
        }
      );
    };
  });
});
//# sourceMappingURL=dojo.js.map
Jason Cheatham
@jason0x43
If your tests are only running in Node, you can require the JSON using Node's require and use it to modify the dojo config (intern.config.loader.options). If your tests need to run in a browser, then the plugin would need to fetch the JSON and add it to the dojo config. The two environments could be handled with two plugins, or with a single plugin that checked whether it was in a browser or node (possibly with intern.environment) and loaded the appropriate way.
Dylan Staley
@dstaley:matrix.org
[m]
Just wanted to chime in and say I'm running into theintern/intern#959
This is with npm v7's new workspace support, with intern installed at the root level
Nathan
@nspaeth

Hi. I'm trying to use intern with a typescript project where I have

{
  "compilerOptions": {
    "baseUrl": "src",
    "paths": {
      "@root/*": [ "*" ]
    },
   ...
  }
}

My editor finds the @root/module imports fine, but when running npx intern the imports can't be found. Is there some configuration in intern.json for that? I couldn't find one.

Nathan
@nspaeth
Hah, turns out I asked this question some time ago and the solution is still there.
Dylan Staley
@dstaley:matrix.org
[m]
@jason0x43: does intern not have CI tests on GitHub anymore?
rogerrabbitz
@rogerrabbitz
@jason0x43 is there a way to deal with file upload boxes on apple devices? For now, I've been testing on Windows, where a location path can be sent.
Apple has a spotlight search, but I don't think typing will do anything.
On windows, typing will go into the file location input on the native popup, IIRC. I went through this a few weeks ago.
rogerrabbitz
@rogerrabbitz
For reference, it appears the way this is done in selenium is this -> driver.setFileDetector(new LocalFileDetector());
rogerrabbitz
@rogerrabbitz
Apologies, please ignore this question for now. Windows is failing too and I know why.
Jason Cheatham
@jason0x43
@dstaley Intern's CI tests still run on Travis
Dylan Staley
@dstaley:matrix.org
[m]
Ah okay, so it's just not reporting back to GitHub?
Sorry, I should specify I meant for PRs
Looks like the last PR that Travis ran was two months ago
Jason Cheatham
@jason0x43
Ah, I think Intern hasn't been transitioned to travis-ci.com (it was using travis-ci.org, which stopped building on June 15). It will probably be transitioned to GH Actions.
Slobodan Mišković
@slobo

When running intern, I'd like to override one of the parameters for browser config to come from OS environment. Example, something like

intern config=@sauce-ie11 environments.build=$BUILD_ID

Is there some special incantation to merge arguments like that, or is the only choice to supply the entire environments on the command line?

Or alternatively, is there a way to specify that value should be sourced from env in intern.json? Ex

configs: { sauce-ie11: {environments: { build: '$BUILD_ID' ...}}
Jason Cheatham
@jason0x43
Config files have very limited support for variable expansion (just pwd). The most flexible solution is probably to write a simple plugin that updates the config at runtime.
Deno Vichas
@denov
how does one troubleshoot suite error occurred? i'm seeing this when my suites are finished - TOTAL: tested 2 platforms, 129 passed, 28 failed, 15 not run; suite error occurred
Jason Cheatham
@jason0x43
That often means that an error occurred in a setup / before function, causing the suite not to run. Usually there will be some error in the reporter output to that effect, but if some tests were skipped that shouldn't have been, that may be related.
Dylan Staley
@dstaley:matrix.org
[m]
@jason0x43: have you had a chance to look at this PR? At first glance it looks like it's a fairly trivial change, but I can definitely understand if this is one of those "could break all the things" kind of changes! theintern/intern#1183
Deno Vichas
@denov
what is included in the 'not run' count? are these all the tests are in a suite where the before / beforeEach fail?
Jason Cheatham
@jason0x43
It should include tests not run due to errors as well as explicitly skipped tests.
rogerrabbitz
@rogerrabbitz
Reporting a bug: I have the newest npm for intern, and scVersion of 4.5.3 threw an error from SauceLabs (version needs to be at least 4.5.4). I changed the config in the SauceLabsTunnel.ts file within the didug module to 4.6.5, and that definitely solved the issue for me.
If you would like me to file an issue on Github, please let me know.
Jason Cheatham
@jason0x43
Thanks for the report! This has been updated in digdug 2.6.1.
rogerrabbitz
@rogerrabbitz
Yw!
Tyoneb
@Tyoneb

Hi, I'm having a bit of trouble while trying to automate Safari (14.1.2) on a Mac (BigSur 11.5.2). I'm using Leadfoot 2.3.0 as a standalone binding without Intern. My problem is that when I create a session, I get an error saying

[POST http://localhost:53153/session / {"desiredCapabilities":{"browserName":"safari"}}] Request body does not contain required parameter 'capabilities'.

My code basically does the following:

const capabilities = { browserName: 'safari', fixSessionCapabilities: true };
Server.createSession(capabilities);

I took a look at the implementation of Server#createSession() and it seems that it takes the input capabilities and sends them to the REST API as "desiredCapabilities" which would explain why there is no "capabilities" parameter. But if it's a bug, I'm surprised that nobody faced it before...

Am I doing something wrong here?

Jason Cheatham
@jason0x43
What version of Selenium are you using?
Tyoneb
@Tyoneb
I'm not going through Selenium, I'm launching directly the driver and setting up the server and session using Leadfoot APIs
Jason Cheatham
@jason0x43
Ah. I don't believe that use case has been tested. Leadfoot is developed against Selenium, which still uses desiredCapabilities and requiredCapabilities vs the newer capabilities format used by WebDriver.
Tyoneb
@Tyoneb

Arg, would it be an acceptable feature request? And if so, in which timeframe?

On the other hand, what's the value of having Selenium in the stack (apart from the grid features)? Up until now, I've been running all my automation on Windows for Chrome, Firefox and Edge without any problem...

Jason Cheatham
@jason0x43
It's a reasonable feature request, and shouldn't be too difficult to implement. I'm not going to have much time for feature development in the near future, but I could give you pointers if you wanted to create a PR.
Tyoneb
@Tyoneb
Sure! I'll look into it next week. I need to setup the Selenium server to understand what it expects and for non-regression with your own stack. You don't happen to have the doc of their REST API by any chance? I can't seem to find it anywhere... :(
Tyoneb
@Tyoneb
Hi @jason0x43, I just created a pull request for you to review on the Leadfoot repo. I validated the change on my end with and without Selenium server but only on Mac/Safari. I also ran the package test command but I don't know if this is enough to check for non-regression.
FYI, I had to deactivate my prettier plugin because the Server.ts wasn't compliant with the provided prettier config and many commas were added everywhere. I didn't want to modify the file more than my intended modifications and I didn't want to change anything in the existing prettier config which comes from the intern repo I believe.
Jason Cheatham
@jason0x43
👍
Tyoneb
@Tyoneb
Oops... I ran some additional tests and it seems that the other drivers don't behave the same way. Unknown capabilities seem to trigger exceptions on Firefox, so passing Leadfoot specific capabilities results in an error when Selenium server is not in between. I will filter them out and update my pull request once I've completed some more thorough tests!
Dylan Staley
@dstaley:matrix.org
[m]
@jason0x43: What are your thoughts on this PR? I'm thinking of using patch-package to apply this change just in our monorepo since I can imagine it might break other configs. theintern/intern#1183
Jason Cheatham
@jason0x43
Hmmm...I'd have to look at that more. The current value satisfies a number of use cases.
Tyoneb
@Tyoneb

Hey @jason0x43, after running tests on Chrome, FF and Safari, I updated my initial PR on the Leadfoot repo theintern/leadfoot#201. It's not as concise and elegant as the first try because each browser/driver behaves differently (nothing new here... :sob:). Also, the W3C spec differs slightly from the original implementation (W3C WebDriver Spec).

Here are the 2 items on which I request your specific review:

  1. Capabilities must be filtered to send only capabilities recognized by the remote. I've had to declare the list of W3C official capabilities as an enum in the interfaces. I think it's not the best design and it would be more relevant to filter out all the Leadfoot specific capabilities instead. We could imagine some specific capabilities to an intermediate WebDriver node (such as Selenium server) that would get filtered. Also, I'm not sure about the location of the method _filterNonW3cCompliantCapabilities.
  2. When receiving "w3c-styled" capabilities, Chrome activates a strict w3c mode which prevents the usage of some endpoints such as /moveto. As a consequence, I added a check on the capability browserName but maybe this could be handled at Session level...?

PS: sorry about the amount of modifications, I forgot to deactivate prettier this time :S

ewang-cob
@ewang-cob

Hello, our intern tests have been running fine and then it stopped working suddenly. It looks like it fails to create sessions. Oddly I can run the tests fine on command line, but it fails running as a scheduled task. Here is the log (and I turned on debug). The tests are on a Windows server. Any pointer would be appreciated. D:\AAInternAutomatedAppTesting\repo>..\node\node.exe .\node_modules\intern\bin\intern.js
DEBUG: Using default loader
DEBUG: Listening for WebSocket connections on port 9001
Listening on localhost:9000 (ws 9001)
Ready
Tunnel started
DEBUG: Loaded functional suites: ["tests/intern/functional/COB.js","tests/intern/functional/COBGIS.js"]
DEBUG: Running 1 suites with maxConcurrency null
DEBUG: Queueing suite chrome on any platform
DEBUG: Running suite chrome on any platform
DEBUG: Creating session for {"name":"intern","idle-timeout":60,"browserName":"chrome"}
DEBUG: Suite errored with non-skip error {"name":"TypeError","message":"Cannot read property 'value' of undefined","stack":"TypeError: Cannot read property 'value' of undefined\n at D:\AAInternAutomatedAppTesting\repo\node_modules\@theintern\leadfoot\Server.js:332:26\n at D:\AAInternAutomatedAppTesting\repo\node_modules\@theintern\common\index.js:16:7174\n at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
BUG: suiteEnd was received for invalid session 
DEBUG: Emitting functional coverage
(ノಠ益ಠ)ノ彡┻━┻
TypeError: Cannot read property 'value' of undefined
@ node_modules\src\Server.ts:413:19
@ node_modules\@theintern\common\index.js:16:7174
at processTicksAndRejections @ internal\process\task_queues.js:93:5

{
accepted: [ 'redacted@bellevuewa.gov' ],
rejected: [],
envelopeTime: 9,
messageTime: 139,
messageSize: 1052,
response: '250 2.6.0 93dab3e1-9c81-eb2d-221c-14a4fc1966c3@bellevuewa.gov [InternalId=96684008800351, Hostname=BSCEXCLB.ci.bellevue.wa.us] 2500 bytes in 0.126, 19.358 KB/sec Queued mail for delivery',
envelope: { from: 'noreply@bellevuewa.gov', to: [ 'redacted@bellevuewa.gov' ] },
messageId: '93dab3e1-9c81-eb2d-221c-14a4fc1966c3@bellevuewa.gov'
}
Sent email
TOTAL: tested 0 platforms, 0 passed, 0 failed; fatal error occurred
DEBUG: Stopping server...
Stopping
DEBUG: Stopped http server
DEBUG: Stopped ws server
Stopped