Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 30 17:45
    dependabot[bot] labeled #195
  • Mar 30 17:45
    dependabot[bot] opened #195
  • Mar 30 17:45

    dependabot[bot] on npm_and_yarn

    Bump y18n from 4.0.0 to 4.0.1 … (compare)

  • Mar 30 17:40
    dependabot[bot] labeled #90
  • Mar 30 17:40
    dependabot[bot] opened #90
  • Mar 30 17:40

    dependabot[bot] on npm_and_yarn

    Bump y18n from 4.0.0 to 4.0.1 … (compare)

  • Mar 18 07:44
    Biboba commented #1179
  • Mar 17 01:05
    jason0x43 commented #1179
  • Mar 17 00:59

    jason0x43 on 4.9

    Update dependencies to fix vuln… (compare)

  • Mar 17 00:54

    jason0x43 on master

    fix(leadfoot): handle WD respon… (compare)

  • Mar 14 16:42
    github-actions[bot] labeled #1179
  • Mar 14 16:41
    Biboba opened #1179
  • Mar 10 01:10
    vladikoff closed #864
  • Feb 12 15:48
    jason0x43 commented #1178
  • Feb 12 15:43
    kgibb commented #1178
  • Feb 12 14:35
    jason0x43 commented #1178
  • Feb 12 13:59
    kgibb commented #1178
  • Feb 11 14:01
    jason0x43 commented #1178
  • Feb 11 13:07

    jason0x43 on master

    chore: update webdriver versions Update webdriver versions (compare)

  • Feb 11 13:07

    jason0x43 on gh-pages

    Update assets (compare)

Deno Vichas
@denov
i am using a custom loader. i'm not sure if this custom loaded is actually needed. it was put in place by somebody else
Jason Cheatham
@jason0x43
Ah, if you're using an external loader (like requireJS or the Dojo loader), you'll need to tell Intern to use that when loading the plugin:
{
  "plugins": [
    { script: "../support/util.js", useLoader: true }
  ]
}
Deno Vichas
@denov
is that for when the whole plugin is wrapped in a define ? that require was the first line of a plain js file
Jason Cheatham
@jason0x43
It just means that the plugin will be loaded using the external loader, so it should follow whatever semantics the external loader understands. If ../support/util.js is an AMD module, you'll need to load the plugin using an AMD loader for it to be able to require util.js since the Node loader doesn't understand AMD modules (there's no define in the global scope in Node by default).
Deno Vichas
@denov
i need a way for my tests to know there's no data (content) and to create something to start running test in before the first suite runs.
Jason Cheatham
@jason0x43
If ../support/util.js is an AMD module, you'll need to set the useLoader: true when loading the plugin.
Deno Vichas
@denov
it's an AMD mod that i'm using as a page object. i want to be able to use that from a plugin
my plugin is the gist
Jason Cheatham
@jason0x43
Sure. Is this not working?
{
  "plugins": [
    { script: "your_plugin.js", useLoader: true }
  ]
}
Deno Vichas
@denov
no. the plugin isn't AMD
does it need to be in order for it to import AMD modules?
Jason Cheatham
@jason0x43
The plugin has to be AMD, or at least loaded through an AMD loader, for it to be able to load an AMD module.
Deno Vichas
@denov
ah. that's what was starting to think. thx. off to do some shuffling....
Deno Vichas
@denov
yes!! things seems to be working as i expect now
Deno Vichas
@denov
from a page object how does one call this.parent.setSessionStorageItem ?
Deno Vichas
@denov
i'm getting setSessionStorageItem is not a function
Jason Cheatham
@jason0x43
@denov Try this.parent.session.setSessionStorageItem
Dylan Staley
@dstaley:matrix.org
[m]
Is it possible to generate coverage for TypeScript code that's executed in the browser? I have testing working by creating a rollup bundle with sourcemaps, but the reported coverage is always 0%.
Slobodan Mišković
@slobo
Is there a way to keep SauceLabs tunnel active / have intern use the existing tunnel?
Jason Cheatham
@jason0x43
You should be able to use the 'null' tunnel, assuming you already have an active SauceLabs tunnel. The 'null' tunnel just speaks webdriver to an endpoint (http://localhost:4444/wd/hub by default) without attempting to start up a tunnel executable.
Slobodan Mišković
@slobo
Thanks @jason0x43. Now it seems it's using the tunnel to connect, but seems it would still need to authenticate itself somehow ...
UnknownError: [POST http://localhost:4444/wd/hub/session / {"desiredCapabilities":...] Misconfigured -- Sauce Labs Authentication Error.
You used username 'None' and access key 'None' to authenticate, which are not valid Sauce Labs credentials.
I'll look to see if there is some option in environments for this...
Slobodan Mišković
@slobo
Ok, adding username: '...', accesskey: '...', tunnelIdentifier: '...' to the object in environments worked. It makes sense that this is needed, I was hoping that the sauce-connect selenium listener would have magically injected these into requests going through it :)
Slobodan Mišković
@slobo

I'm surprised that there isn't a waitFor command, and only waitForDelete. In theintern source, in Session.ts, I see this comment

  // TODO: Timeouts are held so that we can fiddle with the implicit wait
  // timeout to add efficient `waitFor` and `waitForDeleted` convenience
  // methods. Technically only the implicit timeout is necessary.

I'm assuming this means that waitFor is indeed not yet implemented. Is there a different method that I'm overlooking that would wait for an element to show up with timeout?

Slobodan Mišković
@slobo
On the same tangent, looking at waitForDelete, it doesn't seem complicated to derive waitForimplementation. If I was to do that, what is the way to register it so it's available as one of the regular commands? That is, so I could do something like this.remote.waitFor() in my suites?
Slobodan Mišković
@slobo
I see there is Command.addSessionMethod, but unclear how best to register it so it's available to all suites automatically
rhpijnacker
@rhpijnacker
Can I do asynchronous cleanup in afterEach?
We are doing this in browser-based unit tests, which seems to be working fine. However, if I try the same in the node-environment, Intern stops without any reports after the first execution of such afterEach.
dave-hart
@dave-hart
Hi, is there a configuration option that allows me to change the locale of the browser?
rhpijnacker
@rhpijnacker
@dave-hart We are setting this via the intern config like this:
{ "loader": { "options": { "locale": "nl-nl" } } }
dave-hart
@dave-hart
@rhpijnacker Thank you. When I try that I get an error about a missing script property, is that all of your loader config?
rhpijnacker
@rhpijnacker
No that was just a fragment of it. You could try to take the options property to the top-level instead
Jason Cheatham
@jason0x43
@slobo Regarding waitFor, any of the findBy commands implicitly wait for matching elements to become available. There's also the pollUntil helper for adding more freeform wait conditions.
@rhpijnacker Returning a promise in afterEach should work. It's possible that if the afterEach is synchronously throwing an exception (say, because it's using unavailable browser APIs in Node) it might be failing (which would be bad).
rhpijnacker
@rhpijnacker
I've tried to debug it and did not see any exception being thrown. Somehow it just exits the run loop.
Slobodan Mišković
@slobo
@jason0x43 - thanks, that's great, not sure how I missed that.
I do notice that waitForDeleted seems to have default timeout of 0, meaning it fails right away even if element is not present on page. Is this by design, or something wrong in my env?
Jason Cheatham
@jason0x43
waitForDeleted waits for an element to not be present. It internally sets the find timeout to 0 for that to work (otherwise the internal find call would wait for the full timeout before deciding that an element wasn't present). If the element isn't present to begin with, waitForDeleted should succeed.
Slobodan Mišković
@slobo
sorry, should have been more clear - it seems that the implicit timeout defaults to 0 already in my env.
And I don't think I adjusted it anywhere. So if it's intern's default, then without manually calling setTimeout('implicit', 1000) before waitForDelete, it always bails before it even checks if element is present as originalTimeout is 0
https://github.com/theintern/leadfoot/blob/master/src/lib/waitForDeleted.ts#L44
Jason Cheatham
@jason0x43
The default implicit timeout is typically 0, although it's technically driver-dependent. That's not relevant for waitForDeleted, though -- waitForDeleted always sets the implicit timeout to 0 when it's running, then restores it when the call is finished. If you're seeing an error specifically in the waitForDeleted call, the issue may be that the code is seeing an unexpected error. It expects to see a NoSuchElement error -- that's how it knows when to complete. If the find call throws some other error when an element isn't, that would be an issue.
Slobodan Mišković
@slobo

What I was getting hung up on is that waitForDeleted looks at the existing implicit timeout to know for how long it should run for before throwing an error, right?

if that's 0 by default, and your computer is a bit slow/there is a bit of a hiccup between startTime = Date.now(); and if (Date.now() - startTime > originalTimeout), it means waitForDeleted will throw a timeout right away without even calling find once. This happens intermittently for me if i don't setTimeout('implicit') explicitly to something > 0 :)

So, the last question being, is there a good place to set implicit timeout "globally", or do we just need to remember to set it in every suite?

Jason Cheatham
@jason0x43
Oh, yes, I see what you mean. :smile: You can set a global timeout using the functionalTimeouts config property. It's an object with 3 optional properties: find, executeAsync, and pageLoad, each one a value in ms.
Slobodan Mišković
@slobo
Awesome, thanks!
Slobodan Mišković
@slobo
Is there an equivalent of findByLinkText that works on any element? A lot of modern toolkits seem to be built using <div>s etc, it would be helpful to locate them using their text content...
Jason Cheatham
@jason0x43
You could use findByXpath, or use custom code in an exec or execAsync block and return the found element.
Slobodan Mišković
@slobo
I'll give that a try. Any guides how to extend Intern to add more Commands, so if I say come up with findByTagAndText, I can just do this.remote.findByTagAndText('div', 'Blah') ?
Slobodan Mišković
@slobo
(that is, how do I add custom chainable commands)
Jason Cheatham
@jason0x43
Intern (technically Leadfoot) doesn't directly support customizing the remote API in that way. The typical approach is to write helpers that can be run in a remote then callback, like https://www.sitepen.com/blog/command-helpers.
Slobodan Mišković
@slobo
Ah, too bad, but I suppose it's not too verbose this way either. Thanks @jason0x43