From 6dc13275ac81be47b29ba98a3ceef67fca797700 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 11 Jul 2024 21:57:41 +0100 Subject: [PATCH 1/5] Update test.yml workflow branch --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b72275a4..bafba400 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test Eel on: push: - branches: [ master ] + branches: [ main ] pull_request: jobs: From b4836d0f76f6635eba665f6b38328c803b221066 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 11 Jul 2024 21:58:24 +0100 Subject: [PATCH 2/5] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a1d535a0..a1621116 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,10 +2,10 @@ name: "CodeQL" on: push: - branches: [master] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [master] + branches: [main] schedule: - cron: '0 11 * * 0' From 51ea94663e05a6a9e92250399e856e63663d51d7 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 11 Jul 2024 22:18:54 +0100 Subject: [PATCH 3/5] Fix tests for new selenium+webdriver --- .python-version | 5 +---- requirements-test.txt | 4 ++-- tests/conftest.py | 11 ++++------- tests/integration/test_examples.py | 10 +++++----- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.python-version b/.python-version index 543423dd..c8cfe395 100644 --- a/.python-version +++ b/.python-version @@ -1,4 +1 @@ -3.7.14 -3.8.14 -3.9.13 -3.10.8 +3.10 diff --git a/requirements-test.txt b/requirements-test.txt index 9d145d8c..84701082 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,8 +3,8 @@ psutil==5.9.2 pytest==7.0.1 pytest-timeout==2.1.0 -selenium==3.141.0 -webdriver_manager==3.7.1 +selenium>=4.0.0,<5.0.0 +webdriver_manager>=4.0.0,<5.0.0 mypy==0.971 pyinstaller==4.10 types-setuptools==67.2.0.1 diff --git a/tests/conftest.py b/tests/conftest.py index 92b16fab..e222ab58 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,7 @@ import pytest from selenium import webdriver -from selenium.webdriver import DesiredCapabilities +from selenium.webdriver.chrome.service import Service as ChromeService from webdriver_manager.chrome import ChromeDriverManager @@ -14,18 +14,15 @@ def driver(): if TEST_BROWSER == "chrome": options = webdriver.ChromeOptions() - options.headless = True - capabilities = DesiredCapabilities.CHROME - capabilities["goog:loggingPrefs"] = {"browser": "ALL"} + options.add_argument('--headless=new') + options.set_capability("goog:loggingPrefs", {"browser": "ALL"}) if platform.system() == "Windows": options.binary_location = "C:/Program Files/Google/Chrome/Application/chrome.exe" driver = webdriver.Chrome( - ChromeDriverManager().install(), + service=ChromeService(ChromeDriverManager().install(), log_output=os.path.devnull), options=options, - desired_capabilities=capabilities, - service_log_path=os.path.devnull, ) # Firefox doesn't currently supported pulling JavaScript console logs, which we currently scan to affirm that diff --git a/tests/integration/test_examples.py b/tests/integration/test_examples.py index 6e51868d..53dff2a0 100644 --- a/tests/integration/test_examples.py +++ b/tests/integration/test_examples.py @@ -46,12 +46,12 @@ def test_04_file_access(driver: webdriver.Remote): assert driver.title == "Eel Demo" with TemporaryDirectory() as temp_dir, NamedTemporaryFile(dir=temp_dir) as temp_file: - driver.find_element_by_id('input-box').clear() - driver.find_element_by_id('input-box').send_keys(temp_dir) + driver.find_element(value='input-box').clear() + driver.find_element(value='input-box').send_keys(temp_dir) time.sleep(0.5) - driver.find_element_by_css_selector('button').click() + driver.find_element(By.CSS_SELECTOR, 'button').click() - assert driver.find_element_by_id('file-name').text == os.path.basename(temp_file.name) + assert driver.find_element(value='file-name').text == os.path.basename(temp_file.name) def test_06_jinja_templates(driver: webdriver.Remote): @@ -59,7 +59,7 @@ def test_06_jinja_templates(driver: webdriver.Remote): driver.get(eel_url) assert driver.title == "Hello, World!" - driver.find_element_by_css_selector('a').click() + driver.find_element(By.CSS_SELECTOR, 'a').click() WebDriverWait(driver, 2.0).until(expected_conditions.presence_of_element_located((By.XPATH, '//h1[text()="This is page 2"]'))) From 9d40c8f28d61fda3e92eeb0a6f8e158045cbdd61 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 11 Jul 2024 22:25:24 +0100 Subject: [PATCH 4/5] Remove logging redirect --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index e222ab58..30ca7198 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,7 +21,7 @@ def driver(): options.binary_location = "C:/Program Files/Google/Chrome/Application/chrome.exe" driver = webdriver.Chrome( - service=ChromeService(ChromeDriverManager().install(), log_output=os.path.devnull), + service=ChromeService(ChromeDriverManager().install()), options=options, ) From b01e6f9a55972365993296c67cbc2c0ff1e43aa0 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 11 Jul 2024 22:36:22 +0100 Subject: [PATCH 5/5] Remove macos python 3.7 check - no longer available --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bafba400..104194b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,9 @@ jobs: matrix: os: [ubuntu-20.04, windows-latest, macos-latest] python-version: [3.7, 3.8, 3.9, "3.10"] + exclude: + - os: macos-latest + python-version: 3.7 steps: - name: Checkout repository