Skip to content

Commit 47d53e1

Browse files
Merge branch 'trunk' into apply-pep8-to-python-tests
2 parents 6a6cd1b + 3d19b84 commit 47d53e1

34 files changed

Lines changed: 634 additions & 162 deletions

File tree

.github/actions/bazel-test/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: 'Run bazel query and pass found targets to bazel test'
22
inputs:
33
query: # id of input
4+
description: 'Query to execute and to be used when running tests'
45
required: true
56
attempts:
7+
description: 'Test attempts before giving up'
68
required: false
79
default: 1
810
runs:

.github/actions/bazel/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: 'Run bazel'
2+
description: 'Simple action to run bazel commands'
23
inputs:
34
command: # id of input
5+
description: 'Bazel command to run'
46
required: true
57
runs:
68
using: "composite"

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: '08:00'
8+
open-pull-requests-limit: 99

.github/workflows/ci-javascript.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run javascript]') == true }}
2626
needs: check_workflow
2727
runs-on: ubuntu-latest
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
- { "browser": "firefox", "version": "latest" }
33+
- { "browser": "chrome", "version": "stable" }
2834
steps:
2935
- name: Checkout source tree
3036
uses: actions/checkout@v2
@@ -48,19 +54,28 @@ jobs:
4854
java-version: 11
4955
- name: Setup bazelisk
5056
uses: ./.github/actions/setup-bazelisk
51-
- name: Setup Firefox
52-
uses: browser-actions/setup-firefox@latest
53-
- name: Setup GeckoDriver
54-
uses: browser-actions/setup-geckodriver@latest
57+
- name: Setup Firefox and GeckoDriver
58+
uses: ./.github/actions/setup-firefox
59+
with:
60+
version: ${{ matrix.version }}
61+
if: |
62+
matrix.browser == 'firefox'
63+
- name: Setup Chrome and ChromeDriver
64+
uses: ./.github/actions/setup-chrome
65+
with:
66+
version: ${{ matrix.version }}
67+
if: |
68+
matrix.browser == 'chrome'
5569
- name: Start XVFB
5670
run: Xvfb :99 &
57-
- name: Run JavaScript tests on Firefox
58-
uses: ./.github/actions/bazel
71+
- name: Run JavaScript tests
72+
uses: ./.github/actions/bazel-test
5973
with:
60-
command: test //javascript/node/selenium-webdriver:tests
74+
query: //javascript/node/selenium-webdriver:tests
75+
attempts: 3
6176
env:
6277
DISPLAY: :99
63-
SELENIUM_BROWSER: firefox
78+
SELENIUM_BROWSER: ${{ matrix.browser }}
6479

6580
firefox_atom_tests:
6681
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run javascript]') == true }}
@@ -84,10 +99,10 @@ jobs:
8499
java-version: 11
85100
- name: Setup bazelisk
86101
uses: ./.github/actions/setup-bazelisk
87-
- name: Setup Firefox
88-
uses: browser-actions/setup-firefox@latest
89-
- name: Setup GeckoDriver
90-
uses: browser-actions/setup-geckodriver@latest
102+
- name: Setup Firefox and GeckoDriver
103+
uses: ./.github/actions/setup-firefox
104+
with:
105+
version: ${{ matrix.version }}
91106
- name: Start XVFB
92107
run: Xvfb :99 &
93108
- name: Run atom tests on Firefox

CONTRIBUTING.md

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,106 @@ Use `git rebase` (not `git merge`) to sync your work from time to time.
180180
### Step 5: Test
181181

182182
Bug fixes and features **should have tests**. Look at other tests to
183-
see how they should be structured.
183+
see how they should be structured. Verify that new and existing tests are
184+
passing locally before pushing code.
185+
186+
#### Running tests locally
187+
188+
Build your code for the latest changes and run tests locally.
189+
190+
##### Python
191+
<details>
192+
<summary>
193+
Click to see How to run Python Tests.
194+
</summary>
195+
196+
It's not mandatory to run tests sequentially but running Unit tests
197+
before browser testing is recommended.
198+
199+
Unit Tests
200+
```shell
201+
% bazel test //py:unit
202+
```
203+
204+
Remote Tests
205+
```shell
206+
% bazel test --jobs 1 //py:test-remote
207+
```
208+
209+
Browser Tests
210+
```shell
211+
% bazel test //py:test-<browsername> #eg test-chrome, test-firefox
212+
```
213+
</details>
214+
215+
##### Javascript
216+
<details>
217+
<summary>
218+
Click to see How to run JavaScript Tests.
219+
</summary>
220+
221+
Node Tests
222+
```shell
223+
% bazel test //javascript/node/selenium-webdriver:tests
224+
```
225+
226+
Firefox Atom Tests
227+
```shell
228+
% bazel test --test_tag_filters=firefox //javascript/atoms/... //javascript/selenium-atoms/... //javascript/webdriver/...
229+
```
230+
231+
Grid UI Unit Tests
232+
```shell
233+
% cd javascript/grid-ui && npm install && npm test
234+
```
235+
</details>
236+
237+
##### Java
238+
<details>
239+
<summary>
240+
Click to see How to run Java Tests.
241+
</summary>
242+
243+
Small Tests
244+
```shell
245+
% bazel test --cache_test_results=no --test_size_filters=small grid java/test/...
246+
```
247+
248+
Large Tests
249+
```shell
250+
% bazel test --cache_test_results=no java/test/org/openqa/selenium/grid/router:large-tests
251+
```
252+
253+
Browser Tests
254+
```shell
255+
bazel test --test_size_filters=small,medium --cache_test_results=no --test_tag_filters=-browser-test //java/...
256+
```
257+
</details>
258+
259+
##### Ruby
260+
<details>
261+
<summary>
262+
Click to see How to run Ruby Tests.
263+
</summary>
264+
265+
It's not mandatory to run tests sequentially but running Unit tests
266+
before browser testing is recommended.
267+
268+
Unit Tests
269+
```shell
270+
% bazel test rb:unit-test
271+
```
272+
273+
Chrome Tests
274+
```shell
275+
bazel test rb:chrome-test
276+
```
277+
278+
Remote Tests
279+
```shell
280+
% bazel test --test_output=all --test_arg="-tfocus" --test_arg="--fail-fast" rb:remote-chrome-test
281+
```
282+
</details>
184283

185284
### Step 6: Push
186285

WORKSPACE

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ python_register_toolchains(
6262
python_version = "3.9",
6363
)
6464

65-
load("@python3_9//:defs.bzl", "interpreter")
66-
6765
# This one is only needed if you're using the packaging rules.
6866
load("@rules_python//python:pip.bzl", "pip_install")
6967

@@ -180,11 +178,11 @@ rules_closure_toolchains()
180178

181179
http_archive(
182180
name = "rules_pkg",
181+
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
183182
urls = [
184183
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
185184
"https://github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
186185
],
187-
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
188186
)
189187

190188
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

common/extensions/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ filegroup(
1010
"//java/test/org/openqa/selenium/environment:__pkg__",
1111
"//java/test/org/openqa/selenium/firefox:__pkg__",
1212
"//javascript/node/selenium-webdriver:__pkg__",
13+
"//py:__pkg__",
1314
],
1415
)
1516

@@ -19,5 +20,6 @@ exports_files(
1920
],
2021
visibility = [
2122
"//java/test/org/openqa/selenium/firefox:__pkg__",
23+
"//py:__pkg__",
2224
],
2325
)

common/repositories.bzl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# This file has been generated using `bazel run scripts:pinned_browsers`
32

43
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
@@ -15,28 +14,28 @@ def pin_browsers():
1514
sha256 = "07c5f3dad0850a92d5c609278fb1fe682b2562fa55e6733c09a6b4da7373bfcc",
1615
build_file_content = "exports_files([\"firefox\"])",
1716
)
18-
17+
1918
dmg_archive(
2019
name = "mac_firefox",
2120
url = "https://ftp.mozilla.org/pub/firefox/releases/98.0.2/mac/en-US/Firefox%2098.0.2.dmg",
2221
sha256 = "304dfd917c0dcda0313dab1576b520d56de8af7af2e47e7763166d4f5da99851",
2322
build_file_content = "exports_files([\"Firefox.app\"])",
2423
)
25-
24+
2625
http_archive(
2726
name = "linux_geckodriver",
2827
url = "https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz",
2928
sha256 = "12c37f41d11ed982b7be43d02411ff2c75fb7a484e46966d000b47d1665baa88",
3029
build_file_content = "exports_files([\"geckodriver\"])",
3130
)
32-
31+
3332
http_archive(
3433
name = "mac_geckodriver",
3534
url = "https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-macos.tar.gz",
3635
sha256 = "560ba192666c1fe8796404153cfdf2d12551515601c4b3937aabcba6ee300f8c",
3736
build_file_content = "exports_files([\"geckodriver\"])",
3837
)
39-
38+
4039
pkg_archive(
4140
name = "mac_edge",
4241
url = "https://officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/MicrosoftEdge-99.0.1150.55.pkg?platform=Mac&Consent=0&channel=Stable",
@@ -46,40 +45,39 @@ def pin_browsers():
4645
},
4746
build_file_content = "exports_files([\"Edge.app\"])",
4847
)
49-
48+
5049
http_archive(
5150
name = "mac_edgedriver",
5251
url = "https://msedgedriver.azureedge.net/99.0.1150.55/edgedriver_mac64.zip",
5352
sha256 = "8581a2e3c91b393485ca7b7e86a04bacaad1ba44ce87d0b350163e3c816f1ed9",
5453
build_file_content = "exports_files([\"msedgedriver\"])",
5554
)
56-
55+
5756
http_archive(
5857
name = "linux_chrome",
5958
url = "https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/972739/chrome-linux.zip",
6059
sha256 = "228f8a7b4ab7bd3c43d555ba5857a8240f21fc5df96a91cc827d0ae509b01097",
6160
build_file_content = "exports_files([\"chrome-linux\"])",
6261
)
63-
62+
6463
http_archive(
6564
name = "mac_chrome",
6665
url = "https://storage.googleapis.com/chromium-browser-snapshots/Mac/972739/chrome-mac.zip",
6766
sha256 = "a9c59baa2c6c455172c1780ee3411f4b3aa0561a8ed2882d7247d6716d6ccd66",
6867
strip_prefix = "chrome-mac",
6968
build_file_content = "exports_files([\"Chromium.app\"])",
7069
)
71-
70+
7271
http_archive(
7372
name = "linux_chromedriver",
7473
url = "https://chromedriver.storage.googleapis.com/99.0.4844.51/chromedriver_linux64.zip",
7574
sha256 = "3e948b12229667fbb30897de3bae4a3deaac998e552be9a5094227b91c5bbce4",
7675
build_file_content = "exports_files([\"chromedriver\"])",
7776
)
78-
77+
7978
http_archive(
8079
name = "mac_chromedriver",
8180
url = "https://chromedriver.storage.googleapis.com/99.0.4844.51/chromedriver_mac64.zip",
8281
sha256 = "9723d866b6d9e151e985ed206232264ff1fc41082cd5713a2589e706cb4553d9",
8382
build_file_content = "exports_files([\"chromedriver\"])",
8483
)
85-

generate_api_docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ rb)
2323
echo ""
2424
echo "./generate_api_docs.sh java|rb|py"
2525
echo -e "\t Example:"
26-
echo -e "\t Genrating API docs for the Ruby bindings"
26+
echo -e "\t Generating API docs for the Ruby bindings"
2727
echo -e "\t ./generate_api_docs.sh rb"
2828
exit 1
2929
;;

java/src/org/openqa/selenium/devtools/CdpVersionFinder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class CdpVersionFinder {
4141
public CdpVersionFinder() {
4242
this(
4343
5,
44-
StreamSupport.stream(ServiceLoader.load(CdpInfo.class).spliterator(), false).collect(Collectors.toSet()));
44+
StreamSupport.stream(ServiceLoader.load(CdpInfo.class, CdpVersionFinder.class.getClassLoader()).spliterator(), false).collect(Collectors.toSet()));
4545
}
4646

4747
public CdpVersionFinder(int versionFudgeFactor, Collection<CdpInfo> infos) {

0 commit comments

Comments
 (0)