Skip to content

Commit 2bd18eb

Browse files
committed
[ci][py] Init launcher tests for Edge
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 6819795 commit 2bd18eb

File tree

5 files changed

+90
-4
lines changed

5 files changed

+90
-4
lines changed

.github/workflows/ci-python.yml

+21-3
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ jobs:
100100
fail-fast: false
101101
matrix:
102102
include:
103-
- browser: safari
104-
os: macos
105103
- browser: chrome
106104
os: ubuntu
107105
- browser: edge
@@ -113,4 +111,24 @@ jobs:
113111
browser: ${{ matrix.browser }}
114112
os: ${{ matrix.os }}
115113
cache-key: py-browser-${{ matrix.browser }}
116-
run: bazel test --flaky_test_attempts 3 //py:test-${{ matrix.browser }}
114+
run: |
115+
bazel test --flaky_test_attempts 3 //py:common-${{ matrix.browser }}-bidi
116+
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}
117+
118+
safari-tests:
119+
name: Browser Tests
120+
needs: build
121+
uses: ./.github/workflows/bazel.yml
122+
strategy:
123+
fail-fast: false
124+
matrix:
125+
include:
126+
- browser: safari
127+
os: macos
128+
with:
129+
name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }})
130+
browser: ${{ matrix.browser }}
131+
os: ${{ matrix.os }}
132+
cache-key: py-browser-${{ matrix.browser }}
133+
run: |
134+
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,18 @@ Run unit tests with:
317317
bazel test //py:unit
318318
```
319319

320+
To run common tests with a specific browser:
321+
322+
```sh
323+
bazel test //py:common-<browsername>
324+
```
325+
326+
To run common tests with a specific browser (include BiDi tests):
327+
328+
```sh
329+
bazel test //py:common-<browsername>-bidi
330+
```
331+
320332
To run tests with a specific browser:
321333

322334
```sh

py/test/selenium/webdriver/common/typing_tests.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
from selenium.webdriver.common.by import By
2121
from selenium.webdriver.common.keys import Keys
22+
from selenium.webdriver.support import expected_conditions as EC
23+
from selenium.webdriver.support.wait import WebDriverWait
2224

2325

2426
def test_should_fire_key_press_events(driver, pages):
@@ -49,6 +51,7 @@ def test_should_type_lower_case_letters(driver, pages):
4951
pages.load("javascriptPage.html")
5052
keyReporter = driver.find_element(by=By.ID, value="keyReporter")
5153
keyReporter.send_keys("abc def")
54+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "abc def"))
5255
assert keyReporter.get_attribute("value") == "abc def"
5356

5457

@@ -98,6 +101,7 @@ def test_should_be_able_to_use_arrow_keys(driver, pages):
98101
pages.load("javascriptPage.html")
99102
keyReporter = driver.find_element(by=By.ID, value="keyReporter")
100103
keyReporter.send_keys("Tet", Keys.ARROW_LEFT, "s")
104+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "Test"))
101105
assert keyReporter.get_attribute("value") == "Test"
102106

103107

@@ -212,6 +216,7 @@ def test_lower_case_alpha_keys(driver, pages):
212216
element = driver.find_element(by=By.ID, value="keyReporter")
213217
lowerAlphas = "abcdefghijklmnopqrstuvwxyz"
214218
element.send_keys(lowerAlphas)
219+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), lowerAlphas))
215220
assert element.get_attribute("value") == lowerAlphas
216221

217222

@@ -235,7 +240,7 @@ def test_all_printable_keys(driver, pages):
235240
element = driver.find_element(by=By.ID, value="keyReporter")
236241
allPrintable = "!\"#$%&'()*+,-./0123456789:<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
237242
element.send_keys(allPrintable)
238-
243+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), allPrintable))
239244
assert element.get_attribute("value") == allPrintable
240245
assert "up: 16" in result.text.strip()
241246

@@ -282,6 +287,7 @@ def test_special_space_keys(driver, pages):
282287
pages.load("javascriptPage.html")
283288
element = driver.find_element(by=By.ID, value="keyReporter")
284289
element.send_keys("abcd" + Keys.SPACE + "fgh" + Keys.SPACE + "ij")
290+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "abcd fgh ij"))
285291
assert element.get_attribute("value") == "abcd fgh ij"
286292

287293

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Licensed to the Software Freedom Conservancy (SFC) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The SFC licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed to the Software Freedom Conservancy (SFC) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The SFC licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
import pytest
19+
20+
21+
@pytest.mark.no_driver_after_test
22+
def test_launch_and_close_browser(clean_driver, clean_service):
23+
driver = clean_driver(service=clean_service)
24+
driver.quit()
25+
26+
27+
@pytest.mark.no_driver_after_test
28+
def test_we_can_launch_multiple_edge_instances(clean_driver, clean_service):
29+
driver1 = clean_driver(service=clean_service)
30+
driver2 = clean_driver(service=clean_service)
31+
driver3 = clean_driver(service=clean_service)
32+
driver1.quit()
33+
driver2.quit()
34+
driver3.quit()

0 commit comments

Comments
 (0)