-
Notifications
You must be signed in to change notification settings - Fork 3
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
Proof of concept: calling remote interactors #178
base: main
Are you sure you want to change the base?
Conversation
|
✅ Deploy Preview for interactors canceled.
|
@wKich Interesting! I think we would also need to check the arity of the action functions too, right? |
This is relevant to support Playwright #191 which has its own protocol for referencing and interacting with objects in a remote page. Maybe some abstraction could be made? |
Yeah, I already thought about that. But actually for the playwright we can have another solution. We can add function |
We would need a similar mechanism for matchers |
@cowboyd, yeah, we missed that point |
@@ -48,6 +49,7 @@ | |||
"resolutions": { | |||
"@definitelytyped/typescript-versions": "^0.0.40", | |||
"@typescript-eslint/eslint-plugin": "^4.12.0", | |||
"@effection/core": "^2.2.0", |
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.
Unfortunately we get a version mismatch for @effection/core here unless we provide this explicit resolution. I think this might be a deeper problem in how the semver constraints in effection are set up, but I'm not sure.
Since the effection branch was merged (yay!), I've rebased and updated this PR. I've also extracted #197 out of this as a generally sensible thing to do, which shows how remote interactors can really be implemented on top of our existing interactors. |
Depends on #166
I've been unable to knock this idea out of my head. So my weekend hack was to try and see if I could actually make it work. And it kinda sorta works, with a lot of caveats! But I think it proves that the idea itself is fundamentally interesting.
Background
One of the big missing pieces of BigTest and Interactors is that Interactors currently need to be running in the same process as the test runner. This limits us a lot in terms of how interactors can be used. For example we can never have the test runner and the page under test be on different origins, which is very limiting. In many cases, calling interactor directly is good, but in some cases, it would be better to have a request/response cycle for this.
Implementation
This uses the
addInteractionWrapper
API to make it possible to call interactors running in a different process. Basically when writing your test, you would use interactors as you normally would, but instead of running them in the current process, the interaction is serialized and sent over a websocket connection running in another process (could be a browser!).Try it out!
Start the server:
Then run the client:
You should see output like this:
Note that "Some Link" is rendered in a JSDOM context running in the server!!!
Limitations