-
Notifications
You must be signed in to change notification settings - Fork 5
Ensure a valid target when this.only is not available #60
Conversation
I wonder if this is a difference in the way the |
Strange 🤔 That interactor/src/utils/parent-chainable.js Lines 115 to 116 in b228141
So if it's hitting Regardless, the logic in this file is going to change slightly in an upcoming release so hopefully that will fix it. If you can reproduce it and add some tests, I'll make sure those tests are covered with the new changes before those get released. |
Oh, and an aside: you don't need https://www.bigtestjs.io/guides/interactors/available-interactions/#default-interactions |
Same result - doesn't work in the same way.
The dist files for
I don't think it's related because @bigtest/interactor is not compiled by TypeScript.
This is blocking us on being able to use |
If this is specific to angular and can't be reproduced in vanilla JS, then is it an interactor issue or an angular issue? We might be able to work around it if we can reproduce it. If angular is changing the context of methods for some reason, then I'd expect more bugs besides this one. I'm not sure checking for the existence of |
Are you guys using the latest decorator stage-2 proposal? The old stage-1 proposal changed drastically so using the decorator as a function is no longer supported. Support is still in the current version of interactor for migrating from the old syntax but will be deprecated and eventually removed in the 1.0 release. |
Maybe as a workaround try using |
I'm trying to figure out how to verify this, but it seems that TypeScript only supports legacy decorators. Support for ES decorators is on the roadmap for the future. For TypeScript, we might need a special work around. |
Ok, I found something weird that might give us a hit about what's going on. It looks like this problem happens when |
I could see how that might cause some weird behavior. Again though, nothing should be getting wrapped at all unless there is also a The logic around the root element is one of the things being changed in the upcoming release, so hopefully that will solve this issue if it is the problem. In the meantime you could add interactor/src/utils/parent-chainable.js Lines 94 to 96 in b228141
And now that I'm looking at that line does Angular / TS do anything that would default to |
There is definitely some funkiness in TypeScript world around I haven't been able to find the connection with our $root but it's definitely |
Wow. Opened 3 years ago and still not fixed. Looks like targeting es6 instead of es5 might make it default correctly? |
I can't seem to figure out what causes |
@wwilsman do you have objections to merging this as is? |
I'd like to somehow get some tests around this since I just recently got another branch to 100% coverage. But seeing as it's a bug in typescript, idk how we'd test it |
@cowboyd any idea how we could test this scenario? |
It's similar enough to another change being made, so it probably isn't necessary to test since it will change anyway. Just add something to the changelog so the bot is happy and I'll approve 👍 |
Cool, I'll do it later today. |
I added it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
Last thing, if you wanna release this immediately just increment the version number and update the changelog again. That way we don't have to open another PR for release (everything should be tagged automatically for us after merging)
It should be good to go. |
Released! |
Whoop whoop - BigTest in Angular time! |
Purpose
This PR addresses an issue discovered while getting BigTest to work with Angular. At this point, it's not clear if it's Angular/Webpack specific or a bug in Interactor. The problem occurs when you have interactor:
Trying to access
app.message.isPresent
orapp.message.text
causes an exception saying thatthis.only
is not a function.Method
I'm only calling
this.only
isthis.only
is present, otherwise usethis
as target for the interactor invocation.TODO
Figure out how reproduce it in tests(it'll require typescript setup)