Skip to content

Commit cd6aecf

Browse files
authored
Merge pull request #5 from lets-qa/codex/add-testing-watir-section-to-readme
Add Watir example and README notes
2 parents 7e8453b + 44c0fbd commit cd6aecf

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,23 @@ docker run -it --rm -v ~/lets-qa/acceptance:/app test-runner:amd64 bash
4040
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`.
43+
44+
## Testing Watir
45+
46+
You can quickly verify that Watir is working inside the container by running a small script.
47+
48+
```ruby
49+
# test_browser.rb
50+
require 'watir'
51+
browser = Watir::Browser.new(:chrome, headless: true)
52+
browser.goto('https://example.com')
53+
puts browser.title
54+
browser.close
55+
```
56+
57+
Run the script inside the container with:
58+
59+
```bash
60+
bundle exec ruby test_browser.rb
61+
```
62+

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)