-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up wallaby and add a feature test
Followed the instructions in the wallaby readme, using chromdriver because that seems to be the most common setup that works well for people, based on looking around the elixir forum I added a new mix alias for running tests in ci because you have to ensure that js is built otherwise liveview stuff doesn't work. there may be a day when we need to also add the css assets? Finally, I skipped everything in the setup about running tests async and ensuring database connections don't mess with one another. We may need to do that stuff at some point. Note that failing feature tests will add a screenshot artifact closes #311
- Loading branch information
1 parent
94bf233
commit 8fc3fe9
Showing
8 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ version: 2.1 | |
|
||
description: Common jobs for testing and building phoenix applications | ||
|
||
orbs: | ||
browser-tools: circleci/[email protected] | ||
node: circleci/[email protected] | ||
executors: | ||
builder: | ||
docker: | ||
|
@@ -83,7 +86,7 @@ commands: | |
steps: | ||
- run: | ||
name: Run tests | ||
command: MIX_ENV=test mix test | ||
command: MIX_ENV=test mix test-ci | ||
|
||
jobs: | ||
check-formatting: | ||
|
@@ -97,6 +100,7 @@ jobs: | |
run-unit-tests: | ||
executor: builder | ||
steps: | ||
- browser-tools/install-chromedriver | ||
- checkout | ||
- install-deps: | ||
include-assets: false | ||
|
@@ -113,6 +117,9 @@ jobs: | |
- store_artifacts: | ||
path: cover | ||
destination: cover | ||
- store_artifacts: | ||
path: screenshots | ||
destination: screenshots | ||
|
||
workflows: | ||
version: 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule DpulCollectionsWeb.Features.LocaleTest do | ||
use ExUnit.Case, async: true | ||
use Wallaby.Feature | ||
|
||
import Wallaby.Query | ||
|
||
feature "locale persists between pages", %{session: session} do | ||
session | ||
|> visit("/") | ||
|> assert_has(css("h3", text: "Explore Our Digital Collections")) | ||
|> click(button("Language")) | ||
|> click(link("Español")) | ||
|> assert_has(css("h3", text: "Explora nuestras colecciones")) | ||
|> click(button("Buscar")) | ||
|> assert_has(css("div#filters", text: "Relevancia")) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
ExUnit.start() | ||
Ecto.Adapters.SQL.Sandbox.mode(DpulCollections.Repo, :manual) | ||
|
||
{:ok, _} = Application.ensure_all_started(:wallaby) | ||
Application.put_env(:wallaby, :base_url, DpulCollectionsWeb.Endpoint.url()) |