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
|
# Step: Install ChromeDriver for integration tests
|
||||||
- name: Setup ChromeDriver
|
- name: Setup ChromeDriver
|
||||||
uses: nanasess/setup-chromedriver@v2
|
uses: nanasess/setup-chromedriver@v2
|
||||||
with:
|
# Note: Using latest stable version instead of pinned version for better compatibility
|
||||||
chromedriver-version: '119.0.6045.105'
|
|
||||||
|
|
||||||
# Step: Execute the tests.
|
# Step: Execute the tests.
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
|
@ -128,3 +127,8 @@ jobs:
|
||||||
# Step: Run integration tests separately with Wallaby
|
# Step: Run integration tests separately with Wallaby
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: mix test --only integration
|
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
|
# Configure Wallaby
|
||||||
config :wallaby,
|
config :wallaby,
|
||||||
driver: Wallaby.Chrome,
|
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_on_failure: true,
|
||||||
screenshot_dir: "test/screenshots",
|
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
|
import Wallaby.Browser
|
||||||
|
|
||||||
alias Aprsme.Repo
|
alias Aprsme.Repo
|
||||||
|
alias Ecto.Adapters.SQL.Sandbox
|
||||||
alias Wallaby.Query
|
alias Wallaby.Query
|
||||||
|
|
||||||
@moduletag :integration
|
@moduletag :integration
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)
|
:ok = Sandbox.checkout(Repo)
|
||||||
Ecto.Adapters.SQL.Sandbox.mode(Repo, {:shared, self()})
|
Sandbox.mode(Repo, {:shared, self()})
|
||||||
{:ok, %{}}
|
{:ok, %{}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -38,4 +39,4 @@ defmodule AprsmeWeb.MapIntegrationTest do
|
||||||
|> visit("/info")
|
|> visit("/info")
|
||||||
|> assert_has(Query.css("body"))
|
|> assert_has(Query.css("body"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,15 @@ defmodule AprsmeWeb.SimpleIntegrationTest do
|
||||||
use Wallaby.Feature
|
use Wallaby.Feature
|
||||||
|
|
||||||
import Wallaby.Browser
|
import Wallaby.Browser
|
||||||
|
|
||||||
|
alias Ecto.Adapters.SQL.Sandbox
|
||||||
alias Wallaby.Query
|
alias Wallaby.Query
|
||||||
|
|
||||||
@moduletag :integration
|
@moduletag :integration
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Aprsme.Repo)
|
:ok = Sandbox.checkout(Aprsme.Repo)
|
||||||
Ecto.Adapters.SQL.Sandbox.mode(Aprsme.Repo, {:shared, self()})
|
Sandbox.mode(Aprsme.Repo, {:shared, self()})
|
||||||
{:ok, %{}}
|
{:ok, %{}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -22,4 +23,4 @@ defmodule AprsmeWeb.SimpleIntegrationTest do
|
||||||
|> visit("/")
|
|> visit("/")
|
||||||
|> assert_has(Query.text("APRS"))
|
|> assert_has(Query.text("APRS"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue