Improve CI/CD stability for frontend integration tests
Address browser testing reliability in CI environments: ## CI/CD Improvements - **ChromeDriver**: Use latest stable version instead of pinned version for better compatibility - **Timeouts**: Add 10-minute timeout for integration tests to prevent CI hangs - **Environment Variables**: Configure WALLABY_MAX_WAIT_TIME for CI-specific timeouts ## Wallaby Configuration Enhancements - **Chrome Args**: Add CI-stable Chrome options (--no-sandbox, --disable-dev-shm-usage) - **Window Size**: Set consistent 1280x720 window size for reproducible tests - **Dynamic Timeouts**: Environment-configurable max wait time with sensible defaults - **Pool Size**: Limit to single browser instance to prevent resource conflicts ## Benefits - ✅ More reliable test execution in CI environments - ✅ Better error handling and timeout management - ✅ Consistent browser behavior across environments - ✅ Reduced flakiness from resource constraints 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9a63c9ed63
commit
79be23813e
4 changed files with 30 additions and 11 deletions
8
.github/workflows/elixir.yaml
vendored
8
.github/workflows/elixir.yaml
vendored
|
|
@ -118,8 +118,7 @@ jobs:
|
|||
# Step: Install ChromeDriver for integration tests
|
||||
- name: Setup ChromeDriver
|
||||
uses: nanasess/setup-chromedriver@v2
|
||||
with:
|
||||
chromedriver-version: '119.0.6045.105'
|
||||
# Note: Using latest stable version instead of pinned version for better compatibility
|
||||
|
||||
# Step: Execute the tests.
|
||||
- name: Run tests
|
||||
|
|
@ -128,3 +127,8 @@ jobs:
|
|||
# Step: Run integration tests separately with Wallaby
|
||||
- name: Run integration tests
|
||||
run: mix test --only integration
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
# Increase timeouts for browser tests in CI environment
|
||||
WALLABY_SCREENSHOT_ON_FAILURE: true
|
||||
WALLABY_MAX_WAIT_TIME: 30000
|
||||
|
|
|
|||
|
|
@ -83,7 +83,20 @@ config :swoosh, :api_client, false
|
|||
# Configure Wallaby
|
||||
config :wallaby,
|
||||
driver: Wallaby.Chrome,
|
||||
chromedriver: [headless: true],
|
||||
chromedriver: [
|
||||
headless: true,
|
||||
# Additional Chrome options for CI stability
|
||||
args: [
|
||||
"--no-sandbox",
|
||||
"--disable-dev-shm-usage",
|
||||
"--disable-gpu",
|
||||
"--window-size=1280,720"
|
||||
]
|
||||
],
|
||||
screenshot_on_failure: true,
|
||||
screenshot_dir: "test/screenshots",
|
||||
base_url: "http://localhost:4002"
|
||||
base_url: "http://localhost:4002",
|
||||
# Increase default timeouts for CI environment
|
||||
max_wait_time: "WALLABY_MAX_WAIT_TIME" |> System.get_env("5000") |> String.to_integer(),
|
||||
# Pool configuration for concurrent tests
|
||||
pool_size: 1
|
||||
|
|
|
|||
|
|
@ -9,13 +9,14 @@ defmodule AprsmeWeb.MapIntegrationTest do
|
|||
import Wallaby.Browser
|
||||
|
||||
alias Aprsme.Repo
|
||||
alias Ecto.Adapters.SQL.Sandbox
|
||||
alias Wallaby.Query
|
||||
|
||||
@moduletag :integration
|
||||
|
||||
setup do
|
||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)
|
||||
Ecto.Adapters.SQL.Sandbox.mode(Repo, {:shared, self()})
|
||||
:ok = Sandbox.checkout(Repo)
|
||||
Sandbox.mode(Repo, {:shared, self()})
|
||||
{:ok, %{}}
|
||||
end
|
||||
|
||||
|
|
@ -38,4 +39,4 @@ defmodule AprsmeWeb.MapIntegrationTest do
|
|||
|> visit("/info")
|
||||
|> assert_has(Query.css("body"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,14 +6,15 @@ defmodule AprsmeWeb.SimpleIntegrationTest do
|
|||
use Wallaby.Feature
|
||||
|
||||
import Wallaby.Browser
|
||||
|
||||
|
||||
alias Ecto.Adapters.SQL.Sandbox
|
||||
alias Wallaby.Query
|
||||
|
||||
@moduletag :integration
|
||||
|
||||
setup do
|
||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Aprsme.Repo)
|
||||
Ecto.Adapters.SQL.Sandbox.mode(Aprsme.Repo, {:shared, self()})
|
||||
:ok = Sandbox.checkout(Aprsme.Repo)
|
||||
Sandbox.mode(Aprsme.Repo, {:shared, self()})
|
||||
{:ok, %{}}
|
||||
end
|
||||
|
||||
|
|
@ -22,4 +23,4 @@ defmodule AprsmeWeb.SimpleIntegrationTest do
|
|||
|> visit("/")
|
||||
|> assert_has(Query.text("APRS"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue