Skip to content

Commit 3c6ff20

Browse files
committed
[javascript] Fixing ChromeDevTools test
Also, running JS tests in Chrome
1 parent 2f93fe5 commit 3c6ff20

File tree

2 files changed

+43
-25
lines changed

2 files changed

+43
-25
lines changed

‎.github/workflows/ci-javascript.yml

Lines changed: 23 additions & 9 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,10 +54,18 @@ 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 &
5771
- name: Run JavaScript tests on Firefox
@@ -60,7 +74,7 @@ jobs:
6074
command: test //javascript/node/selenium-webdriver:tests
6175
env:
6276
DISPLAY: :99
63-
SELENIUM_BROWSER: firefox
77+
SELENIUM_BROWSER: ${{ matrix.browser }}
6478

6579
firefox_atom_tests:
6680
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 +98,10 @@ jobs:
8498
java-version: 11
8599
- name: Setup bazelisk
86100
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
101+
- name: Setup Firefox and GeckoDriver
102+
uses: ./.github/actions/setup-firefox
103+
with:
104+
version: ${{ matrix.version }}
91105
- name: Start XVFB
92106
run: Xvfb :99 &
93107
- name: Run atom tests on Firefox

‎javascript/node/selenium-webdriver/test/chrome/devtools_test.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,27 @@ test.suite(
138138
})
139139

140140
describe('Basic Auth Injection', function () {
141-
it('denies entry if username and password do not match', async function () {
142-
const pageCdpConnection = await driver.createCDPConnection('page')
143-
144-
await driver.register('random', 'random', pageCdpConnection)
145-
await driver.get(fileServer.Pages.basicAuth)
146-
let source = await driver.getPageSource()
147-
assert.strictEqual(source.includes('Access granted!'), false)
148-
})
149-
150-
it('grants access if username and password are a match', async function () {
151-
const pageCdpConnection = await driver.createCDPConnection('page')
141+
it('denies entry if username and password do not match',
142+
async function () {
143+
const pageCdpConnection = await driver.createCDPConnection('page')
144+
145+
await driver.register('random', 'random', pageCdpConnection)
146+
await driver.get(fileServer.Pages.basicAuth)
147+
let source = await driver.getPageSource()
148+
assert.strictEqual(source.includes('Access granted!'), false, source)
149+
})
150+
})
152151

153-
await driver.register('genie', 'bottle', pageCdpConnection)
154-
await driver.get(fileServer.Pages.basicAuth)
155-
let source = await driver.getPageSource()
156-
assert.strictEqual(source.includes('Access granted!'), true)
157-
})
152+
describe('Basic Auth Injection', function () {
153+
it('grants access if username and password are a match',
154+
async function () {
155+
const pageCdpConnection = await driver.createCDPConnection('page')
156+
157+
await driver.register('genie', 'bottle', pageCdpConnection)
158+
await driver.get(fileServer.Pages.basicAuth)
159+
let source = await driver.getPageSource()
160+
assert.strictEqual(source.includes('Access granted!'), true)
161+
})
158162
})
159163

160164
describe('setDownloadPath', function () {

0 commit comments

Comments
 (0)