-
Notifications
You must be signed in to change notification settings - Fork 325
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
feat: add E2E tests for chromium and firefox #1121
Conversation
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within seven business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
08b2bd5
to
8418e31
Compare
8418e31
to
bf8646e
Compare
abef7c7
to
5a933cd
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.
Thanks for creating this PR @galargh, excellent work! I have some concerns regarding the use of selenium vs playwright and some ideas for improvements (marked as [opt]) those can be looked into later if you'd like!
Cheers :)
ci/access-control-allow-all.sh
Outdated
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["*"]' |
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.
[opt] Question: won't this be detrimental to the e2e spirit of testing companion? If we're configuring the API to work for all origins, we might not catch a few issues.
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.
Anything in particular we're concerned with? The reason why this is needed is because in the "everything in docker" setup, the browsers run in different containers than kubo. There might be another way to do it. This was just the one that required the least thought.
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.
yes, kubo has support for specific user agents, which includes ipfs-companion since ipfs/kubo#8690
This is not normal user behaviour, which means we can have cases where tests pass but the users don't see this behaviour. That'll defeat the purpose of e2e testing.
I would also like to voice my preference of playwright over selenium.
|
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.
Thanks! I would like @lidel to weigh in on selenium vs playwright, everything else LGTM! 🚀
ci/access-control-allow-all.sh
Outdated
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["*"]' |
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.
yes, kubo has support for specific user agents, which includes ipfs-companion since ipfs/kubo#8690
This is not normal user behaviour, which means we can have cases where tests pass but the users don't see this behaviour. That'll defeat the purpose of e2e testing.
Personally, I don't know enough about either to prefer one over the other BUT it seems we cannot accomplish the task at all in playwright at the moment because of lack of support for Firefox extensions (microsoft/playwright#7297). |
ACK. makes complete sense. |
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.
Approving with comments.. thanks a ton for putting this together @galargh
test/e2e/ipfs-companion.test.js
Outdated
|
||
const peers = await getNumberOfConnectedPeers(browser, url) | ||
|
||
expect(peers).not.to.equal(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.
I feel like this will be flaky unless we have a guaranteed peer running in CI as well.
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.
We can add one if that becomes a problem.
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.
I created #1131 for this
@galargh , the only thing I would really like to see before merge is an update to README.md or docs/DEVELOPER-NOTES.md informing users how to run this locally, how to debug, etc. |
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.
When attempting to run locally, I ran into some issues:
npm run clean
npm i
npm run release-build # Error when running this
Error output
=> [3/9] RUN mkdir -p /home/node/app 0.2s
=> ERROR [4/9] RUN if [ 501 -ne 0 ] && [ 20 -ne 0 ]; then userdel -f node && if getent group node ; then groupdel node; fi && g 0.3s
------
> [4/9] RUN if [ 501 -ne 0 ] && [ 20 -ne 0 ]; then userdel -f node && if getent group node ; then groupdel node; fi && groupadd -g 20 node && useradd -l -u 501 -g node node && chown -fhR 501:20 /home/node; fi:
#8 0.255 groupadd: GID '20' already exists
------
executor failed running [/bin/sh -c if [ ${USER_ID:-0} -ne 0 ] && [ ${GROUP_ID:-0} -ne 0 ]; then userdel -f node && if getent group node ; then groupdel node; fi && groupadd -g ${GROUP_ID} node && useradd -l -u ${USER_ID} -g node node && chown -fhR ${USER_ID}:${GROUP_ID} /home/node; fi]: exit code: 4
commenting out all the user modifications allows it to work. What is that code supposed to be doing? can we make it smarter?
IPFS_COMPANION_VERSION: ${{ inputs.ipfs-companion-version }} | ||
- name: Build ipfs-companion | ||
if: inputs.ipfs-companion-version == '' | ||
run: npm run release-build |
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.
we should eventually upload the built docker image (ipfs-companion-release-build
) and reuse that if possible.. (hash of source or non-docker build artifacts to determine if we want to use the same image?)
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.
I did a write-up recently on docker publishing/caching in CI for build speed-up. See https://filecoinproject.slack.com/archives/C03KLC57LKB/p1673517809976679?thread_ts=1673468796.401379&cid=C03KLC57LKB
I'd say it's a little bit beyond the scope of this PR though.
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.
I created #1132 for this
- replace fixed delays with exponential backoff - make download-release-artifacts.sh work even if build dir already exists - document how to run e2e tests locally - delete user/group if it already exists during release build in docker - make it easier to add new e2e test cases in the future
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.
@galargh , the only thing I would really like to see before merge is an update to README.md or docs/DEVELOPER-NOTES.md informing users how to run this locally, how to debug, etc.
Docs added to docs/DEVELOPER-NOTES.md.
When attempting to run locally, I ran into some issues.
I added deleting user/group if it already exists to the Dockerfile
which should fix the issue. I suspect it's there to maintain correct ownership of built files after we get them out of the docker container.
IPFS_COMPANION_VERSION: ${{ inputs.ipfs-companion-version }} | ||
- name: Build ipfs-companion | ||
if: inputs.ipfs-companion-version == '' | ||
run: npm run release-build |
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.
I did a write-up recently on docker publishing/caching in CI for build speed-up. See https://filecoinproject.slack.com/archives/C03KLC57LKB/p1673517809976679?thread_ts=1673468796.401379&cid=C03KLC57LKB
I'd say it's a little bit beyond the scope of this PR though.
@@ -0,0 +1,40 @@ | |||
version: "3.9" |
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.
I'm not sure how exactly setting hostname
and domainname
works. Could you elaborate on how they could affect the setup?
test/e2e/ipfs-companion.test.js
Outdated
|
||
const peers = await getNumberOfConnectedPeers(browser, url) | ||
|
||
expect(peers).not.to.equal(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.
We can add one if that becomes a problem.
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.
lgtm.. a few comments unaddressed, but a significant improvement. Thanks @galargh !
Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com>
Description
This PR adds a setup for E2E testing to
ipfs-companion
.The environment setup is automated using docker compose. The environment consists of:
The tests check the following for firefox and chromium:
The tests follow the proposed testing procedure from https://github.com/ipfs/kubo/blob/master/docs/RELEASE_ISSUE_TEMPLATE.md.
The newly added tests can be executed through GitHub Actions.
Testing
TODO