Skip to content

Commit 3ca47fd

Browse files
authored
Merge branch 'main' into codex/extend-dockerfile-to-include-xvfb
2 parents 7c3c0d2 + cd6aecf commit 3ca47fd

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.git
2+
.github
3+
*.md
4+
5+
# Ignore bundler and gem artifacts
6+
.bundle/
7+
vendor/
8+
9+
# Ignore temporary or log files
10+
log/
11+
tmp/
12+
*.log

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
55
build-essential \
66
chromium \
77
xvfb \
8+
chromium-driver \
89
libpq-dev \
910
&& rm -rf /var/lib/apt/lists/*
1011

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,29 @@ This command launches the container with the current working directory set
4141
to `/app`, where your tests are mounted. From there you can run any
4242
commands you need, such as `bundle exec cucumber` or `bundle exec rspec`.
4343

44+
4445
If your tests require an X server, you can prefix the test command with
4546
`xvfb-run` to run them in a virtual framebuffer. For example:
4647

4748
```bash
4849
xvfb-run bundle exec rspec
4950
```
51+
52+
## Testing Watir
53+
54+
You can quickly verify that Watir is working inside the container by running a small script.
55+
56+
```ruby
57+
# test_browser.rb
58+
require 'watir'
59+
browser = Watir::Browser.new(:chrome, headless: true)
60+
browser.goto('https://example.com')
61+
puts browser.title
62+
browser.close
63+
```
64+
65+
Run the script inside the container with:
66+
67+
```bash
68+
bundle exec ruby test_browser.rb
69+
```

test_browser.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require 'watir'
2+
3+
browser = Watir::Browser.new(:chrome, headless: true)
4+
browser.goto('https://example.com')
5+
puts browser.title
6+
browser.close

0 commit comments

Comments
 (0)