-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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 for E2E tests using playwright #22754
Conversation
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.
This is a great proof of concept. I left some thoughts. Happy to pick this up and run with it on our side though at any point.
packages/react-devtools-inline/__tests__/End-to-End/todoList.test.js
Outdated
Show resolved
Hide resolved
await expect(text).toEqual(listItemsProps[i]); | ||
} | ||
}); | ||
}); |
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.
Love how simple these tests are.
Slightly uncomfortable about how coupled they are with the test shell harness.
Seems like it would be ideal if the e2e tests setup their own test apps (kind of like our unit tests do) and then tested how DevTools interacted with those. That way, changes to the test shell wouldn't accidentally break tests– and we could add new e2e tests without needing to change the test shell in ways that may make it more cumbersome to work for its primary use case (locally iterating).
e8a8c7a
to
5bdcd71
Compare
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.
This is a great initial proof of concept to get things started. Thank you! <3
Oh interesting. When trying to run the new test target locally I see an error:
Any suggestions, @akgupta0777? In case it's relevant:
|
@bvaughn can you give me more context about what you are trying to do For some reason if you use ES6 syntax with playwright you get an error. Will investigate further into this. I also got this kind of issue when I tried to import clipboardy(npm package) for testing clipboard functionality of devtools. |
Nothing. Literally just tried to run the new test target you added: |
You have to build the inline package and start the shell Webpack dev server by running Then run |
I was running both inline and shell watch processes, so localhost:8080 was serving the test app. This is a syntax error coming from the |
Just to be clear, here's what I've done: yarn install
scripts/release/download-experimental-build.js --commit=main
cd packages/react-devtools-inline
yarn start
# In another shell
cd packages/react-devtools-shell
yarn start After verifying that localhost:8080 loads okay:
This doesn't seem like it has anything to do with the test shell. It's seems to be a syntax error coming from Playwright trying to load uncompiled code. Can you confirm that you're able to do a fresh checkout of this repository and the above steps work for you, @akgupta0777 ? |
I can't reproduce the error on my laptop. I want to know why react-is package is interfering Will confirm you after I make a fresh react clone and running test in some hours. |
@bvaughn I can now confirm that the tests are not working on the latest version of playwright. I did Now I am working on a fix for that. It's an issue with playwright recent changes to the library I guess. |
Thanks @akgupta0777! 🙇🏼 Keep me posted :) |
Excellent. Thank you |
If an older version of Playwright works for this, we could also just use the Doesn't seem ideal but I thought it would be worth mentioning. |
It seems like its the issue with playwright but it isn't. Because it worked magically once when I tried on a fresh react clone on the latest version of playwright. |
@bvaughn What I did: Why I did this Conclusion |
That's an interesting observation. :)
Unfortunately this doesn't really work as a solution in this repo, because we can't ask people to We'll have to get the dependencies setup correctly so this works for everyone (including CI) without extra manual steps. |
Tests are runnable with #22790. |
Yeah I agree. This is a workaround not a complete solution. |
That's some great news. |
Summary
Detailed discussion here : #22646
This PR is just a starting point for writing E2E tests for inline package with playwright.
What does the test do ?
It checks the components(ToDo List) and emulates it in the devtools by clicking and inspecting.
Then it matches the props with component props.
How did you test this change?
run
yarn test
inreact-devtools-inline
package.Quick Demo 👀
POC.mp4
Description of some other changes
Removed hashing on CSS styles to write tests easily. This has no impact on the Styling or any visual changes on test apps in
react-devtools-shell
.