From 3b8e3df0005a8ca3574eb64225d1a342e07f4ce6 Mon Sep 17 00:00:00 2001 From: Colby Swandale <996377+colby-swandale@users.noreply.github.com> Date: Sat, 23 Nov 2024 10:05:55 +1100 Subject: [PATCH 1/4] Refactor system tests to pass in DevContainers --- .devcontainer/Dockerfile | 4 +- .devcontainer/devcontainer.json | 2 + app/views/layouts/_session.html.erb | 2 +- app/views/layouts/application.html.erb | 2 +- config/environments/test.rb | 2 +- config/initializers/webauthn.rb | 6 +- test/application_system_test_case.rb | 8 ++- test/helpers/email_helpers.rb | 2 +- test/system/api_keys_test.rb | 20 +++--- test/system/avo/manual_changes_test.rb | 6 +- test/system/avo/rubygems_test.rb | 6 ++ test/system/avo/users_test.rb | 6 ++ test/system/avo/versions_test.rb | 6 ++ .../email_confirmation_test.rb | 40 +++++------ test/system/multifactor_auths_test.rb | 2 - test/{integration => system}/owner_test.rb | 65 +++++++++++------- .../password_reset_test.rb | 67 +++++++++---------- test/system/sign_in_webauthn_test.rb | 38 +++++------ test/system/webauthn_verification_test.rb | 24 ++++--- test/test_helper.rb | 32 +++------ 20 files changed, 184 insertions(+), 156 deletions(-) rename test/{integration => system}/email_confirmation_test.rb (69%) rename test/{integration => system}/owner_test.rb (81%) rename test/{integration => system}/password_reset_test.rb (78%) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8106685b3e7..eda658e0c81 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,6 +3,4 @@ ARG RUBY_VERSION=3.3.5 FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION -RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends pkg-config \ - && apt-get clean && rm -rf /var/lib/apt/lists/* +RUN sudo apt-get update && sudo apt-get -y install --no-install-recommends pkg-config diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d05adf8a1e8..bc2ecaae758 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -34,6 +34,8 @@ "containerEnv": { "EDITOR": "code --wait", "GIT_EDITOR": "code --wait", + "DEVCONTAINER_APP_HOST": "http://rails-app", + "MEMCACHED_ENDPOINT": "cache:11211", "CAPYBARA_SERVER_PORT": "45678", "SELENIUM_HOST": "selenium", "ELASTICSEARCH_URL": "http://search:9200", diff --git a/app/views/layouts/_session.html.erb b/app/views/layouts/_session.html.erb index 677752bc08b..468f53a2e71 100644 --- a/app/views/layouts/_session.html.erb +++ b/app/views/layouts/_session.html.erb @@ -1,7 +1,7 @@