Skip to content

Commit 37ead3b

Browse files
Merge pull request #2 from sadym-chromium/sadym/install-chrome
Fix Chromium version
2 parents b7809b9 + f9e962b commit 37ead3b

7 files changed

Lines changed: 1601 additions & 72 deletions

File tree

.github/workflows/macos-selenium-mochajs.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ jobs:
4848
working-directory: macos-selenium-mochajs
4949
run: npm test
5050

51-
- name: Dump log
51+
- name: Dump latest ChromeDriver log
5252
if: always()
53-
run: cat chromedriver.log
53+
run: |
54+
if [ -d "logs" ]; then
55+
LATEST_LOG=$(ls -t logs/chromedriver-*.log 2>/dev/null | head -n 1)
56+
if [ -n "$LATEST_LOG" ]; then
57+
echo "Dumping $LATEST_LOG"
58+
cat "$LATEST_LOG"
59+
else
60+
echo "No log files found in logs/"
61+
fi
62+
else
63+
echo "logs/ directory not found"
64+
fi

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
node_modules
1+
node_modules/
2+
.cache/
3+
.idea/
4+
logs/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"printWidth": 80,
3+
"singleQuote": true
4+
}

macos-selenium-mochajs/README.md

Lines changed: 88 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,99 @@
1-
# Template for macOS, Selenium, MochaJS
1+
# Template for Selenium, MochaJS
22

3-
This repository provides a template for reproducing any ChromeDriver bug.
3+
This repository serves as a boilerplate for reproducing ChromeDriver regressions
4+
across platforms using Selenium WebDriver and MochaJS.
45

5-
## Steps to Reproduce
6+
Its primary purpose is to provide a standardized, isolated environment where you can
7+
quickly set up and verify a specific ChromeDriver bug, making it easier to share and
8+
debug.
69

7-
The test in `test/regression.js` follows these steps:
10+
## Your Goal
811

9-
1. Initializes a new Chrome browser session.
10-
2. Navigates to a URL.
11-
3. Asserts that the page title is correct.
12+
To use this template, you are expected to extend the `ISSUE REPRODUCTION` test case
13+
in `test.js` with the precise steps that demonstrate the ChromeDriver regression you
14+
are investigating. The aim is to create a reproducible test case that reliably fails
15+
when the bug is present and passes when it's resolved.
1216

13-
This sequence of actions fails with ChromeDriver 126, but works with 125.
17+
## Overview
18+
19+
The test script (`test.js`) performs the following actions:
20+
21+
1. **Environment Setup**: Automatically downloads a specific version of Chrome
22+
(Canary by default) and the matching ChromeDriver binary into a local `.cache`
23+
directory using `@puppeteer/browsers`.
24+
2. **WebDriver Initialization**: Configures Selenium to use the downloaded binaries
25+
explicitly, ensuring version compatibility.
26+
3. **Test Execution**:
27+
- Navigates to `https://www.google.com` to verify the setup.
28+
- Includes a placeholder test case (`ISSUE REPRODUCTION`) where you can add your
29+
specific reproduction steps.
30+
31+
## Prerequisites
32+
33+
- Node.js installed.
34+
35+
## Installation
36+
37+
Install the necessary dependencies:
38+
39+
```bash
40+
npm install
41+
```
1442

1543
## Running the Tests
1644

17-
1. Install dependencies:
18-
```bash
19-
npm install
20-
```
21-
2. Run the tests:
22-
```bash
23-
npm test
24-
```
45+
To run the tests with the default configuration (latest Chrome Canary):
46+
47+
```bash
48+
npm test
49+
```
50+
51+
### Targeting a Specific Chrome Version
52+
53+
You can specify a particular version of Chrome/ChromeDriver using the
54+
`BROWSER_VERSION` environment variable. This is useful for testing against a specific
55+
build or regression testing.
56+
57+
```bash
58+
# Example: Targeting a specific build ID
59+
BROWSER_VERSION=144.0.7557.0 npm test
60+
```
61+
62+
If `BROWSER_VERSION` is not provided, the script automatically resolves and downloads
63+
the latest build from the Chrome Canary channel.
64+
65+
## Logging and Debugging
66+
67+
### Test Output Logs
68+
69+
The test runner uses `winston` for logging info about the setup process (e.g., binary
70+
locations). You can control the verbosity using the `LOG_LEVEL` environment variable.
71+
72+
- **Standard Output:** `npm test`
73+
- **Debug Output:** `LOG_LEVEL=debug npm test`
74+
75+
### ChromeDriver Logs
76+
77+
Verbose logging for ChromeDriver is enabled by default. Logs are captured and saved
78+
to individual files within the **`logs/`** directory, with each filename timestamped
79+
(e.g., `logs/chromedriver-2025-12-02T10:00:00.000Z.log`). This ensures that logs are
80+
preserved across multiple test runs and are crucial for debugging WebDriver issues.
81+
82+
## Customizing the Test
83+
84+
Open `test.js` and modify the `ISSUE REPRODUCTION` test block to include the steps
85+
required to reproduce your specific issue.
86+
87+
```javascript
88+
it('ISSUE REPRODUCTION', async function () {
89+
// Add test reproducing the issue here.
90+
await driver.get('https://example.com');
91+
// ... assertions and interactions
92+
});
93+
```
2594

2695
## GitHub Actions
2796

28-
The included GitHub Actions workflow in `.github/workflows/macos-selenium-mochajs.yml` will automatically run the tests on every push and pull request.
97+
The included GitHub Actions workflow in
98+
`.github/workflows/macos-selenium-mochajs.yml` will automatically run the tests on
99+
every push and pull request.

0 commit comments

Comments
 (0)