Skip to content

Commit 8159a16

Browse files
authored
Merge pull request #791 from lcreid/update-to-capybara-screenshot-diff-breaks-tests
Update to capybara screenshot diff breaks tests
2 parents fdf05c5 + ae8cd5e commit 8159a16

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

.devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// The optional 'workspaceFolder' property is the path VS Code should open by default when
1414
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
15-
"workspaceFolder": "/app",
15+
"workspaceFolder": "/home/dev/app",
1616
// "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
1717

1818
// Features to add to the dev container. More info: https://containers.dev/features.
@@ -34,5 +34,5 @@
3434
// "customizations": {},
3535

3636
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
37-
// "remoteUser": "reid"
37+
// "remoteUser": "devcontainer"
3838
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ demo/.yarn-integrity
5252
demo/vendor/bundle
5353

5454
# For stuff that gets created if using the Dockerfile image
55+
# These are likely no longer needed.
5556
/.bundle/
5657
.cache/
5758
vendor/bundle
5859

60+
# Neither are many of these, I think.
5961
# or .local/share/pry/pry_history if you need to be more exact
6062
.local/
6163
.irb_history

compose.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
# https://medium.com/@retrorubies/chrome-as-a-service-for-rails-testing-b1a45e70fec1
55
services:
66
web:
7-
image: lenchoreyes/jade:rails-app-${RUBY_VERSION:-3.3}-sqlite-${DISTRO:-bookworm}
7+
image: lenchoreyes/jade:rails-app-${RUBY_VERSION:-4.0}-sqlite-trixie
88
stdin_open: true
99
tty: true
10+
user: "dev:dev"
1011
volumes:
11-
- .:/app:cached
12+
- .:/home/dev/app
13+
- dev_home:/home/dev
1214
environment:
13-
- HISTFILE=/app/.bash_history
1415
- SELENIUM_HOST=selenium
1516
- SELENIUM_PORT=4444
1617
- TEST_APP_HOST=web
1718
- TEST_APP_PORT=3001
1819
ports:
1920
- "3000"
2021
- "3001"
22+
- "5990"
2123
command: /bin/bash
2224

2325
selenium:
@@ -34,3 +36,6 @@ services:
3436
- LANG_WHICH=en
3537
ports:
3638
- "7900"
39+
40+
volumes:
41+
dev_home:

demo/test/system/bootstrap_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class BootstrapTest < ApplicationSystemTestCase
3737
screenshot_group :readme
3838

3939
readme = File.read(File.expand_path("../../../README.md", __dir__))
40+
screenshot_index = 0
4041
augmented_readme = readme.gsub(REGEXP) do |_|
4142
erb = Regexp.last_match(1)
4243
header = Regexp.last_match(2)
@@ -49,7 +50,6 @@ class BootstrapTest < ApplicationSystemTestCase
4950

5051
visit fragment_path erb: wrapped_erb
5152
wrapper = find(".fragment")
52-
i = @screenshot_counter
5353
screenshot :example, crop: bounds(wrapper)
5454
wrapper = wrapper.find("form") if wrapped_erb != erb
5555
html = wrapper["innerHTML"].strip.gsub("><", ">\n<")
@@ -65,8 +65,9 @@ class BootstrapTest < ApplicationSystemTestCase
6565
end
6666
html = doc.to_html
6767
image = <<~MD
68-
![Example #{i}](demo/doc/screenshots/bootstrap/readme/#{format('%02i', i)}_example.png "Example #{i}")
68+
![Example #{screenshot_index}](demo/doc/screenshots/bootstrap/readme/#{format('%02i', screenshot_index)}_example.png "Example #{screenshot_index}")
6969
MD
70+
screenshot_index += 1
7071
html = <<~MD
7172
7273
#{header || 'Generated HTML:'}

0 commit comments

Comments
 (0)