Skip to content

Commit

Permalink
No selenium when skipping system test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewn617 committed Jan 29, 2024
1 parent de1c069 commit e18de91
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
},

"containerEnv": {
<%- if depends_on_system_test? -%>
"CAPYBARA_SERVER_PORT": "45678",
<%- end -%>
<%- unless options.skip_active_job? -%>
"JOBS_REDIS_URL": "redis://redis:6379/1",
<%- end -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ services:
ports:
- 45678:45678
depends_on:
<%- if depends_on_system_test? -%>
- selenium
<%- end -%>
<%- unless options.skip_active_job? && options.skip_action_cable? -%>
- redis
<%- end -%>
<%- if options.database == "postgresql" -%>
- postgres
<%- end -%>
Expand All @@ -32,10 +37,12 @@ services:
- mariadb
<%- end -%>

<%- if depends_on_system_test? -%>
selenium:
image: seleniarm/standalone-chromium
networks:
- default
<%- end -%>

<%- unless options.skip_active_job? && options.skip_action_cable? -%>
redis:
Expand Down
15 changes: 15 additions & 0 deletions railties/test/generators/app_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,10 @@ def test_devcontainer
end
assert_file(".devcontainer/Dockerfile")
assert_file(".devcontainer/docker-compose.yml") do |content|
assert_match /- selenium/, content
assert_match /selenium:/, content
assert_match /redis:/, content
assert_match /- redis/, content
assert_no_match /- maria_db/, content
assert_no_match /maria_db:/, content
assert_no_match /- postgres/, content
Expand All @@ -1278,6 +1280,7 @@ def test_devcontainer_no_redis_skipping_action_cable_and_active_job
run_generator [ destination_root, "--skip_action_cable", "--skip_active_job" ]

assert_file(".devcontainer/docker-compose.yml") do |content|
assert_no_match /- redis/, content
assert_no_match /redis:/, content
end
end
Expand Down Expand Up @@ -1334,6 +1337,18 @@ def test_devonctainer_mariadb
end
end

def test_devcontainer_no_selenium_when_skipping_system_test
run_generator [ destination_root, "--skip_system_test" ]

assert_file(".devcontainer/docker-compose.yml") do |content|
assert_no_match /- selenium/, content
assert_no_match /selenium:/, content
end
assert_file(".devcontainer/devcontainer.json") do |content|
assert_no_match /CAPYBARA_SERVER_PORT/, content
end
end

private
def assert_node_files
assert_file ".node-version" do |content|
Expand Down

0 comments on commit e18de91

Please sign in to comment.