Skip to content
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

System tests #303

Merged
merged 13 commits into from
Mar 17, 2020
Merged

System tests #303

merged 13 commits into from
Mar 17, 2020

Conversation

tsubik
Copy link
Collaborator

@tsubik tsubik commented Mar 16, 2020

Introducing a couple of simple system tests for public pages. I was thinking if to use Cypress or just capybara for it and for now I decided to go with Capybara.

The tests are run against the database restored from development database dump. To recreate the development database dump just invoke command bin/rake test:db_dump. That will clear the test database, load the seeds and then dump the whole database into the file and clear it again. I'm wondering if not just use factory bot for this, but I was lazy and tested against development data.

The problem here is that development data is not great, and it needs to be improved as there are some missing relations between models and not every part of the system have any example data (maybe by seed_dump of part of production data).

I set the version of rspec-rail to 4.0.rc version as this one seems to fully support Rails6. On the previous version failed test screenshots were blank.

I also fixed some links here and there to use slugs and not id. LawsSector needs slug too as climate targets per LawsSector url should be improved, but that could be done in separate PR.

Copy link
Contributor

@simaob simaob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, it's nice to have more broader tests! Although the development dump is not the best, I think it's OK for now!


it 'loads the page' do
expect(page).to have_text('All Climate Targets')
expect(page).to have_text('Showing 1993 results')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests would need to be updated if we change the test dump, right? Not sure if I'm understanding correctly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's why it's not that great. Although, seeds were not changed for a quite a while

@simaob simaob merged commit 67dad5a into develop Mar 17, 2020
@simaob simaob deleted the system-tests branch March 17, 2020 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants