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

Change rails server with test environment #173

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,12 @@ If you are not using `factory_bot` look at `e2e/cypress/app_commands/factory_bot

Now you can create scenarios and commands that are plain Ruby files that get loaded through middleware, the ruby sky is your limit.

### Update your database.yml

When writing and running tests on your local computer, it's recommended to start your server in development mode so that changes you
make are picked up without having to restart your local server.

It's recommended you update your `database.yml` to check if the `CYPRESS` environment variable is set and switch it to the test database
otherwise, cypress will keep clearing your development database.

For example:
```yaml
development:
<<: *default
database: <%= ENV['CYPRESS'] ? 'my_db_test' : 'my_db_development' %>
test:
<<: *default
database: my_db_test
## If you want to use live reload from rails

Change the below setting in test.rb

```ruby
config.enable_reloading = ENV['CYPRESS'].present?
```

### WARNING
Expand All @@ -144,8 +134,8 @@ Please use with extra caution if starting your local server on 0.0.0.0 or runnin
Getting started on your local environment

```shell
# start rails
CYPRESS=1 bin/rails server -p 5017
# start rails with test environment
CYPRESS=1 RAILS_ENV=test bin/rails server -p 5017

# in separate window start cypress
yarn cypress open --project ./e2e
Expand Down