diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 8f1ceb01f82b6..70eccee27f1ce 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -100,8 +100,6 @@ jobs: fail-fast: false matrix: include: - - browser: safari - os: macos - browser: chrome os: ubuntu - browser: edge @@ -113,4 +111,24 @@ jobs: browser: ${{ matrix.browser }} os: ${{ matrix.os }} cache-key: py-browser-${{ matrix.browser }} - run: bazel test --flaky_test_attempts 3 //py:test-${{ matrix.browser }} + run: | + bazel test --flaky_test_attempts 3 //py:common-${{ matrix.browser }}-bidi + bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }} + + safari-tests: + name: Browser Tests + needs: build + uses: ./.github/workflows/bazel.yml + strategy: + fail-fast: false + matrix: + include: + - browser: safari + os: macos + with: + name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }}) + browser: ${{ matrix.browser }} + os: ${{ matrix.os }} + cache-key: py-browser-${{ matrix.browser }} + run: | + bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }} diff --git a/README.md b/README.md index 637c6428c3198..fe7ce42b18ccb 100644 --- a/README.md +++ b/README.md @@ -317,6 +317,18 @@ Run unit tests with: bazel test //py:unit ``` +To run common tests with a specific browser: + +```sh +bazel test //py:common- +``` + +To run common tests with a specific browser (include BiDi tests): + +```sh +bazel test //py:common--bidi +``` + To run tests with a specific browser: ```sh diff --git a/py/test/selenium/webdriver/common/typing_tests.py b/py/test/selenium/webdriver/common/typing_tests.py index 92741533c3de1..57e254fe902c1 100644 --- a/py/test/selenium/webdriver/common/typing_tests.py +++ b/py/test/selenium/webdriver/common/typing_tests.py @@ -19,6 +19,8 @@ from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.support.wait import WebDriverWait def test_should_fire_key_press_events(driver, pages): @@ -49,6 +51,7 @@ def test_should_type_lower_case_letters(driver, pages): pages.load("javascriptPage.html") keyReporter = driver.find_element(by=By.ID, value="keyReporter") keyReporter.send_keys("abc def") + WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "abc def")) assert keyReporter.get_attribute("value") == "abc def" @@ -98,6 +101,7 @@ def test_should_be_able_to_use_arrow_keys(driver, pages): pages.load("javascriptPage.html") keyReporter = driver.find_element(by=By.ID, value="keyReporter") keyReporter.send_keys("Tet", Keys.ARROW_LEFT, "s") + WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "Test")) assert keyReporter.get_attribute("value") == "Test" @@ -212,6 +216,7 @@ def test_lower_case_alpha_keys(driver, pages): element = driver.find_element(by=By.ID, value="keyReporter") lowerAlphas = "abcdefghijklmnopqrstuvwxyz" element.send_keys(lowerAlphas) + WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), lowerAlphas)) assert element.get_attribute("value") == lowerAlphas @@ -235,7 +240,7 @@ def test_all_printable_keys(driver, pages): element = driver.find_element(by=By.ID, value="keyReporter") allPrintable = "!\"#$%&'()*+,-./0123456789:<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" element.send_keys(allPrintable) - + WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), allPrintable)) assert element.get_attribute("value") == allPrintable assert "up: 16" in result.text.strip() @@ -282,6 +287,7 @@ def test_special_space_keys(driver, pages): pages.load("javascriptPage.html") element = driver.find_element(by=By.ID, value="keyReporter") element.send_keys("abcd" + Keys.SPACE + "fgh" + Keys.SPACE + "ij") + WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "abcd fgh ij")) assert element.get_attribute("value") == "abcd fgh ij" diff --git a/py/test/selenium/webdriver/edge/__init__.py b/py/test/selenium/webdriver/edge/__init__.py new file mode 100644 index 0000000000000..a5b1e6f85a09e --- /dev/null +++ b/py/test/selenium/webdriver/edge/__init__.py @@ -0,0 +1,16 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. diff --git a/py/test/selenium/webdriver/edge/edge_launcher_tests.py b/py/test/selenium/webdriver/edge/edge_launcher_tests.py new file mode 100644 index 0000000000000..f928054a2c725 --- /dev/null +++ b/py/test/selenium/webdriver/edge/edge_launcher_tests.py @@ -0,0 +1,34 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import pytest + + +@pytest.mark.no_driver_after_test +def test_launch_and_close_browser(clean_driver, clean_service): + driver = clean_driver(service=clean_service) + driver.quit() + + +@pytest.mark.no_driver_after_test +def test_we_can_launch_multiple_edge_instances(clean_driver, clean_service): + driver1 = clean_driver(service=clean_service) + driver2 = clean_driver(service=clean_service) + driver3 = clean_driver(service=clean_service) + driver1.quit() + driver2.quit() + driver3.quit()