-
Notifications
You must be signed in to change notification settings - Fork 10
Switch e2e tests over to cypress #183
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
base: master
Are you sure you want to change the base?
Conversation
…w seeder in e2e tests
Added very basic first test. Updated README to reflect new usage.
…er-compose config
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 this PR, I'm excited to get it in master!
There are a few things I'd like to see done differently before merging, mostly to do with Docker things and scripting things and how we kind of orchestrate tasks locally.
See my comments below for details, and let me know if anything I said doesn't make sense :)
backend/bin/e2e-seed-new.js
Outdated
|
|
||
| const createDefaultBranch = () => { | ||
| console.log('Creating default branch.'); | ||
| const req = { body: { id: branchId, name: 'A branch' } }; |
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.
Looking at the branchesController, I'm pretty sure that the id you pass in here is going to be ignored - the controller generates an ID for you, so you don't need to pass one in. That means you can delete lines 16 & 17 too.
backend/bin/e2e-seed-new.js
Outdated
| .catch(error => { | ||
| console.error('Seed failed:', error); | ||
| process.exit(1); | ||
| }); |
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.
The diff between this file and seed.js is tiny, so we've got a lot of copy-paste here. I think that's fine for a first cut while we're still working all this stuff out, but at some point it might be good for the two files to either: 1) converge and be parameterised somehow, or 2) have common stuff pulled out into a seed-utils.js or something. I wouldn't do it yet but just something to think about.
Also I think we can go ahead and just call this file e2e-seed.js, rather than -new. The old file contents are obsolete anyway, so no need to keep them around!
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.
In short: Yes to all your points. We should really take this out of the merge request. But in order to first test the e2e tests setup with cyprus to run a hello world in CI we need them to compile. Hence we raised this request early against the branch.
e2e-see-new.js is a pure copy and paste as it is very early stages of work in progress. We are using the seed as a reference and adopt from there. Refactoring needed for sure once we can add the e2e dependencies.
| "seed": "node bin/seed.js && node bin/test-seed.js", | ||
| "start": "node index.js" | ||
| "start": "node index.js", | ||
| "start-test": "NODE_ENV=test node index.js" |
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 hesitant to add more scripts to the package.json, as it's already a bit out of control. Can we just do NODE_ENV=test yarn start anywhere we need this?
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.
Personal preference - I see what you mean, but, this one feels like a useful shorthand that would be used relatively commonly, and also serves as documentation for future devs.
docker-compose.yml
Outdated
| build: | ||
| context: docker/ | ||
| dockerfile: Dockerfile.dev | ||
| dockerfile: Dockerfile.prod |
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.
What was the reason for renaming this file? We only use this particular Dockerfile in development, not for building production images.
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 may have misunderstood the way that the script in bin/docker-build-and-deploy.sh works, then - I had thought that it recreated the rabblerouser/core image from the local image. I may have gotten a bit lost in the architecture, though.
| TEST_STREAM_NAME: test_rabblerouser_stream | ||
| command: sleep 2147483647 # Sleep forever, we'll shell into the container later | ||
| stdin_open: true | ||
| user: $UID |
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.
Is there a reason you removed this? IIRC, we need this to make it run properly on a Linux host, as discovered by @akjones.
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.
Ah, interesting.
I found that it threw potentially confusing warnings (as $UID is not an env variable on OSX), and was apparently redundant given the user creation in the dockerfile itself.
(If only docker was as portable as it claimed to be). Can re-add since there's a need.
e2e/cypress/fixtures/profile.json
Outdated
| "id": 8739, | ||
| "name": "Jane", | ||
| "email": "jane@example.com" | ||
| } No newline at end of file |
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.
Do we need this file or can we delete it?
e2e/cypress/fixtures/users.json
Outdated
| "bs": "target end-to-end models" | ||
| } | ||
| } | ||
| ] No newline at end of file |
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.
Do we need this file or can we delete it?
.travis.yml
Outdated
| script: ./go.sh yarn test | ||
| script: | ||
| - ./go.sh yarn test | ||
| - ./go.sh e2e |
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.
See comment right at the end, but I think it might be better to just directly do ./bin/e2e.sh as the second command here.
go.sh
Outdated
| then | ||
| ./bin/e2e.sh | ||
| exit | ||
| fi |
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.
Your comment above is correct that this is quite a different path/use case than the other things that we use go.sh for. With that in mind, I think it might better for it to just stay as a separate thing that can be run on its own, rather than making it a 'special case' of the go script.
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.
Keen to revert this change, then.
go.sh
Outdated
| if [[ -z $1 ]]; | ||
| then | ||
| docker-compose exec core /bin/sh | ||
| docker-compose exec core /bin/bash |
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.
Did you test this change? I think you'll find that bash is not present in Alpine linux, which is what the core image is built from. So it needs to be sh.
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 checked this change against the alpine image and it seemed fine - I suppose I can revert it.
edit My environment was unclean! Good catch.
|
Hey @tw-paraxial I'm going to take another look at this one. Just wanted to check where it's at from your point of view? I.e., the original PR was kind of just a starting point, right? Is this still a work in progress, or is it ready to be merged as far as you're concerned? |
This reverts commit 07e0795.
E2E tests now use a new seeder, and run in a dedicated container running cypress.
E2E test coverage to be improved later - this is initial set up.