Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert.dom(Element).exists() throws even if it exists #245

Closed
dwilhelmi opened this issue Jan 14, 2019 · 12 comments · Fixed by #246
Closed

assert.dom(Element).exists() throws even if it exists #245

dwilhelmi opened this issue Jan 14, 2019 · 12 comments · Fixed by #246

Comments

@dwilhelmi
Copy link
Contributor

Even though officially the dom method accepts the Element type, when using it that way the exists method ends up throwing an error, even if the element exists. At root, this is because exists calls findElements, which is not currently set up to check for this.target being anything other than a string.

I have a PR inbound shortly to add support to findElements for having Element targets, but wanted to track it here also.

@Turbo87
Copy link
Collaborator

Turbo87 commented Jan 14, 2019

hmm, interesting, I was pretty sure I implemented it that way at first. Has this possibly changed lately?

@dwilhelmi
Copy link
Contributor Author

Not sure - findElement currently supports Element targets, but findElements does not. As promised, I have pushed up a PR with a possible fix - #246

@Turbo87
Copy link
Collaborator

Turbo87 commented Jan 15, 2019

thinking some more about it, why do you use assert.dom(element).exists() instead of just assert.ok(element)? wouldn't the latter be easier?

Even though officially the dom method accepts the Element type

it does, but not all assertions support it. just like with e.g. chai when you expect(5) you can't use something like .to.contain(4).

@patocallaghan
Copy link
Contributor

patocallaghan commented Feb 15, 2019

I just came up against this issue using assert.dom(element).isNotVisible(), findElements doesn't allow using an HTMLElement

@step2yeung
Copy link
Contributor

Bumping this... We see the error with assert.dom(element).isVisible()
@dwilhelmi will you have time to wrap up the PR? If not, would you care if I take it over?

@monovertex
Copy link

I also encountered this with isNotVisible(). Could the proposed PR be merged or is there any other work left to be done on it?

@scalvert
Copy link
Collaborator

scalvert commented Oct 9, 2019

Just to clarify, are folks encountering this issue using Typescript in their projects, and they're getting a type mismatch?

@monovertex
Copy link

I’m getting this in an Ember project, not using Typescript.

@patocallaghan
Copy link
Contributor

@scalvert it's been a while since I've commented but we don't use TypeScript

@scalvert
Copy link
Collaborator

Let me take a peek again and see if there's anything outstanding we need on that PR.

@scalvert
Copy link
Collaborator

Sorry that everyone's been encountering this issue. I'm working on it now, and just adding a number of test cases to ensure that our fix is working.

@scalvert
Copy link
Collaborator

Ready to go! Just waiting for a merge/release. Thanks for your patience, everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants