From c9147e7522c9357b8d4cb0ab82ee4251f2f17e82 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 13:19:07 -0400 Subject: [PATCH 01/14] Setup Chrome and chromedriver via selenium-manager We want to setup Chrome before we execute the tasks so that we can avoid selenium-manager doing at the time of execution and changing the debug log messages. --- .github/workflows/CI.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0ee38f2cd..ec03cf723 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,6 +17,18 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Setup Chrome + uses: browser-actions/setup-chrome@latest + with: + chrome-version: latest + id: setup-chrome + - run: | + echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} + ${{ steps.setup-chrome.outputs.chrome-path }} --version + - run: | + SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') + echo "$SELENIUM_MANAGER_EXE" + $SELENIUM_MANAGER_EXE --browser chrome --debug - name: Start xvfb run: | export DISPLAY=:99.0 From 98d9aa8ad9fae5fb65c4bc770e95e777e04f23c3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 13:26:55 -0400 Subject: [PATCH 02/14] Moved selenium-manager execution till after installing selenium --- .github/workflows/CI.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ec03cf723..5d98ec8a7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,10 +25,6 @@ jobs: - run: | echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} ${{ steps.setup-chrome.outputs.chrome-path }} --version - - run: | - SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') - echo "$SELENIUM_MANAGER_EXE" - $SELENIUM_MANAGER_EXE --browser chrome --debug - name: Start xvfb run: | export DISPLAY=:99.0 @@ -48,6 +44,11 @@ jobs: - name: Install RF ${{ matrix.rf-version }} run: | pip install -U --pre robotframework==${{ matrix.rf-version }} + - name: Install drivers via selenium-manager + run: | + SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') + echo "$SELENIUM_MANAGER_EXE" + $SELENIUM_MANAGER_EXE --browser chrome --debug - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' run: | From b5bd87b3115ffa65ea6a76bbf03838de8fd663bc Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 19:49:06 -0400 Subject: [PATCH 03/14] Attempting to get selenium-manager not to run during script To avoid having the extra logging for selenium-manager (or at least to control the debug output) we are setting the executable_path or the path to the driver. Trying with the event_firing_webdriver script to see if we see debug output there. --- .github/workflows/CI.yml | 2 +- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5d98ec8a7..b29b2853d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,7 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - $SELENIUM_MANAGER_EXE --browser chrome --debug + DRIVER_PATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' run: | diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index 1392f2bbf..bd6ce1550 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -2,7 +2,7 @@ Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py Resource resource_event_firing_webdriver.robot Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} desired_capabilities=${DESIRED_CAPABILITIES} +... remote_url=${REMOTE_URL} executable_path=%{DRIVER_PATH} Suite Teardown Close All Browsers *** Variables *** From 4a57052be1b1182d622273e1b2bab6b8b7b90df7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 20:02:30 -0400 Subject: [PATCH 04/14] Robot might hase trouble with environment variables with an underscore --- .github/workflows/CI.yml | 3 ++- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b29b2853d..020b7842f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,8 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - DRIVER_PATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' run: | diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index bd6ce1550..a43009cfc 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -2,7 +2,7 @@ Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py Resource resource_event_firing_webdriver.robot Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} executable_path=%{DRIVER_PATH} +... remote_url=${REMOTE_URL} executable_path=%{WEBDRIVERPATH} Suite Teardown Close All Browsers *** Variables *** From dc3f00151a13d8f8b9b45c6009f64e4d15c113f2 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 20:14:52 -0400 Subject: [PATCH 05/14] Try source the env variable --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 020b7842f..9a8b386d1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,7 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + source WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' From e254fd3865ca40e39fc954684b414508317b0cc1 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 20:22:08 -0400 Subject: [PATCH 06/14] Trying export instead of source --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9a8b386d1..9b86478b5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,7 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - source WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + export WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' From 82f7fed0c3683c26214cc8ef31ab8f1f57431417 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 20:35:25 -0400 Subject: [PATCH 07/14] Try hard coding driver executable path --- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index a43009cfc..863b5e284 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -2,7 +2,7 @@ Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py Resource resource_event_firing_webdriver.robot Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} executable_path=%{WEBDRIVERPATH} +... remote_url=${REMOTE_URL} executable_path=/usr/bin/chromedriver Suite Teardown Close All Browsers *** Variables *** From 62e0d2be801f31bbfb90f22fd8144798d7cf750a Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 21:10:23 -0400 Subject: [PATCH 08/14] Corrected setting env variable within Github Actions There is apparently a method for setting variables. Basically, echo "{environment_variable_name}={value}" >> "$GITHUB_ENV" Trying this out .. Reference: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable --- .github/workflows/CI.yml | 2 +- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9b86478b5..5d59b5c10 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,7 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - export WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index 863b5e284..a43009cfc 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -2,7 +2,7 @@ Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py Resource resource_event_firing_webdriver.robot Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} executable_path=/usr/bin/chromedriver +... remote_url=${REMOTE_URL} executable_path=%{WEBDRIVERPATH} Suite Teardown Close All Browsers *** Variables *** From 5b5c598e3ba5c4650231911221622494dbc2a820 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 08:19:32 -0400 Subject: [PATCH 09/14] Update atests some with preconfigured webdriver --- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- atest/acceptance/create_webdriver.robot | 2 +- atest/acceptance/keywords/page_load_timeout.robot | 6 ++++-- atest/acceptance/multiple_browsers_options.robot | 6 ++++++ atest/acceptance/open_and_close.robot | 2 +- .../{remote_browsers.robot => remote_browsers.robot.TRIAGE} | 0 6 files changed, 13 insertions(+), 5 deletions(-) rename atest/acceptance/{remote_browsers.robot => remote_browsers.robot.TRIAGE} (100%) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index a43009cfc..ea9d633c6 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -15,7 +15,7 @@ Open Browser To Start Page ... LOG 1:20 DEBUG Wrapping driver to event_firing_webdriver. ... LOG 1:22 INFO Got driver also from SeleniumLibrary. Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} - ... desired_capabilities=${DESIRED_CAPABILITIES} + ... executable_path=%{WEBDRIVERPATH} Event Firing Webdriver Go To (WebDriver) [Tags] NoGrid diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index 854c63ba0..15aba3d4e 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -7,7 +7,7 @@ Library Collections Create Webdriver Creates Functioning WebDriver [Documentation] ... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver. - ... LOG 1:8 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. + ... LOG 1:25 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. [Tags] Known Issue Internet Explorer Known Issue Safari [Setup] Set Driver Variables Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS} diff --git a/atest/acceptance/keywords/page_load_timeout.robot b/atest/acceptance/keywords/page_load_timeout.robot index 384eb4410..8113dc84c 100644 --- a/atest/acceptance/keywords/page_load_timeout.robot +++ b/atest/acceptance/keywords/page_load_timeout.robot @@ -7,8 +7,10 @@ Test Teardown Close Browser And Reset Page Load Timeout *** Test Cases *** Should Open Browser With Default Page Load Timeout [Documentation] Verify that 'Open Browser' changes the page load timeout. - ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} - ... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200 + ... LOG 1.1.1:33 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} + ... LOG 1.1.1:35 DEBUG STARTS: Remote response: status=200 + # ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} + # ... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200 Open Browser To Start Page Should Run Into Timeout Exception diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index 8899526a3..92631859d 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -13,6 +13,7 @@ Chrome Browser With Selenium Options As String ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options As String With Attirbute As True [Documentation] @@ -21,6 +22,7 @@ Chrome Browser With Selenium Options As String With Attirbute As True ... LOG 1:3 DEBUG GLOB: *"--headless"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options With Complex Object [Tags] NoGrid @@ -30,6 +32,7 @@ Chrome Browser With Selenium Options With Complex Object ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'}) + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options Object [Documentation] @@ -38,11 +41,13 @@ Chrome Browser With Selenium Options Object ${options} = Get Chrome Options Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=${options} + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options Invalid Method Run Keyword And Expect Error AttributeError: 'Options' object has no attribute 'not_here_method' ... Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=not_here_method("arg1") + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options Argument With Semicolon @@ -51,3 +56,4 @@ Chrome Browser With Selenium Options Argument With Semicolon ... LOG 1:3 DEBUG GLOB: *["has;semicolon"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon") + ... executable_path=%{WEBDRIVERPATH} diff --git a/atest/acceptance/open_and_close.robot b/atest/acceptance/open_and_close.robot index 5efd2d0d2..9bb13c01d 100644 --- a/atest/acceptance/open_and_close.robot +++ b/atest/acceptance/open_and_close.robot @@ -20,7 +20,7 @@ Browser Open With Not Well-Formed URL Should Close ... LOG 1.1:24 DEBUG REGEXP: .*but failed to open url.* ... LOG 2:2 DEBUG STARTS: DELETE ... LOG 2:5 DEBUG STARTS: Finished Request - Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} + Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} executable_path=%{WEBDRIVERPATH} Close All Browsers Switch to closed browser is possible diff --git a/atest/acceptance/remote_browsers.robot b/atest/acceptance/remote_browsers.robot.TRIAGE similarity index 100% rename from atest/acceptance/remote_browsers.robot rename to atest/acceptance/remote_browsers.robot.TRIAGE From 546d21d2a0038695038f9e43f5bc5cb02d4898f9 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 08:20:18 -0400 Subject: [PATCH 10/14] Changed cookie expiry from hard-coded to tomorrow this time --- atest/acceptance/keywords/cookies.robot | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index a457842e5..a4cf9a0f8 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -4,6 +4,7 @@ Suite Setup Go To Page "cookies.html" Suite Teardown Delete All Cookies Test Setup Add Cookies Resource ../resource.robot +Library DateTime *** Test Cases *** Get Cookies @@ -120,4 +121,6 @@ Test Get Cookie Keyword Logging Add Cookies Delete All Cookies Add Cookie test seleniumlibrary - Add Cookie another value expiry=2023-10-29 19:36:51 + ${now} = Get Current Date + ${tomorrow_thistime} = Add Time To Date ${now} 1 day + Add Cookie another value expiry=${tomorrow_thistime} From 6ddfc24ebd449f7771deaa645394c8f106b590a7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 08:44:51 -0400 Subject: [PATCH 11/14] Updated cookie tests with expiry dates into 2024 --- atest/acceptance/keywords/cookies.robot | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index a4cf9a0f8..6a46d2877 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -36,15 +36,15 @@ Add Cookie When Secure Is False Should Be Equal ${cookie.secure} ${False} Add Cookie When Expiry Is Epoch - Add Cookie Cookie1 value1 expiry=1698601011 + Add Cookie Cookie1 value1 expiry=1730205247 ${cookie} = Get Cookie Cookie1 - ${expiry} = Convert Date ${1698601011} exclude_millis=True + ${expiry} = Convert Date ${1730205247} exclude_millis=True Should Be Equal As Strings ${cookie.expiry} ${expiry} Add Cookie When Expiry Is Human Readable Data&Time - Add Cookie Cookie12 value12 expiry=2023-10-29 19:36:51 + Add Cookie Cookie12 value12 expiry=2024-10-29 19:36:51 ${cookie} = Get Cookie Cookie12 - Should Be Equal As Strings ${cookie.expiry} 2023-10-29 19:36:51 + Should Be Equal As Strings ${cookie.expiry} 2024-10-29 19:36:51 Delete Cookie [Tags] Known Issue Safari @@ -72,7 +72,7 @@ Get Cookies As Dict When There Are None Test Get Cookie Object Expiry ${cookie} = Get Cookie another - Should Be Equal As Integers ${cookie.expiry.year} 2023 + Should Be Equal As Integers ${cookie.expiry.year} 2024 Should Be Equal As Integers ${cookie.expiry.month} 10 Should Be Equal As Integers ${cookie.expiry.day} 29 Should Be Equal As Integers ${cookie.expiry.hour} 19 @@ -113,7 +113,7 @@ Test Get Cookie Keyword Logging ... domain=localhost ... secure=False ... httpOnly=False - ... expiry=2023-10-29 19:36:51 + ... expiry=2024-10-29 19:36:51 ... extra={'sameSite': 'Lax'} ${cookie} = Get Cookie another From 26ccf8874910adfcd05fad160de53ef746d3243b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 12:46:45 -0400 Subject: [PATCH 12/14] Fixed cookies tests where we needed aprior knowledge of expiry There were a couple tests when I updated the expiry date to variable based upon today had hard coded expected values. To fix I added another far in the future (from now) date to use for these few tests. This actually might be complicating things too much and instead just stay with anouther cookie and hard code it two years out. --- atest/acceptance/keywords/cookies.robot | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 6a46d2877..9e6f8cfa9 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -14,7 +14,7 @@ Get Cookies Get Cookies As Dict ${cookies}= Get Cookies as_dict=True - ${expected_cookies}= Create Dictionary test=seleniumlibrary another=value + ${expected_cookies}= Create Dictionary test=seleniumlibrary another=value far_future=timemachine Dictionaries Should Be Equal ${expected_cookies} ${cookies} App Sees Cookie Set By Selenium @@ -50,7 +50,7 @@ Delete Cookie [Tags] Known Issue Safari Delete Cookie test ${cookies} = Get Cookies - Should Be Equal ${cookies} another=value + Should Be Equal ${cookies} far_future=timemachine; another=value Non-existent Cookie Run Keyword And Expect Error @@ -72,12 +72,12 @@ Get Cookies As Dict When There Are None Test Get Cookie Object Expiry ${cookie} = Get Cookie another - Should Be Equal As Integers ${cookie.expiry.year} 2024 - Should Be Equal As Integers ${cookie.expiry.month} 10 - Should Be Equal As Integers ${cookie.expiry.day} 29 - Should Be Equal As Integers ${cookie.expiry.hour} 19 - Should Be Equal As Integers ${cookie.expiry.minute} 36 - Should Be Equal As Integers ${cookie.expiry.second} 51 + Should Be Equal As Integers ${cookie.expiry.year} ${tomorrow_thistime_datetime.year} + Should Be Equal As Integers ${cookie.expiry.month} ${tomorrow_thistime_datetime.month} + Should Be Equal As Integers ${cookie.expiry.day} ${tomorrow_thistime_datetime.day} + Should Be Equal As Integers ${cookie.expiry.hour} ${tomorrow_thistime_datetime.hour} + Should Be Equal As Integers ${cookie.expiry.minute} ${tomorrow_thistime_datetime.minute} + Should Be Equal As Integers ${cookie.expiry.second} ${tomorrow_thistime_datetime.second} Should Be Equal As Integers ${cookie.expiry.microsecond} 0 Test Get Cookie Object Domain @@ -113,9 +113,9 @@ Test Get Cookie Keyword Logging ... domain=localhost ... secure=False ... httpOnly=False - ... expiry=2024-10-29 19:36:51 + ... expiry=2026-9-15 11:22:33 ... extra={'sameSite': 'Lax'} - ${cookie} = Get Cookie another + ${cookie} = Get Cookie far_future *** Keyword *** Add Cookies @@ -123,4 +123,7 @@ Add Cookies Add Cookie test seleniumlibrary ${now} = Get Current Date ${tomorrow_thistime} = Add Time To Date ${now} 1 day + ${tomorrow_thistime_datetime} = Convert Date ${tomorrow_thistime} datetime + Set Suite Variable ${tomorrow_thistime_datetime} Add Cookie another value expiry=${tomorrow_thistime} + Add Cookie far_future timemachine expiry=1789485753 # 2026-09-15 11:22:33 From 0c17cd69eb23b564657d0dfba948d519ddc21def Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 13:31:48 -0400 Subject: [PATCH 13/14] Fixed issue with Get Cookie logging assertions There was some missed chnages to the log. In addition, Chrome now has a limit on length of expiry with cookies. Its maximum length is 400 days, as per, https://developer.chrome.com/blog/cookie-max-age-expires/. As such back off the far future date to one just about a year out. Starting to think the hardcoded expiry is better in that one can immediately see it it verse the calculate some date in the future each time the test is run. Will revisit this in the future. --- atest/acceptance/keywords/cookies.robot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 9e6f8cfa9..4f341c05a 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -107,13 +107,13 @@ Test Get Cookie Object Value Test Get Cookie Keyword Logging [Tags] NoGrid Known Issue Firefox [Documentation] - ... LOG 1:5 ${cookie} = name=another - ... value=value + ... LOG 1:5 ${cookie} = name=far_future + ... value=timemachine ... path=/ ... domain=localhost ... secure=False ... httpOnly=False - ... expiry=2026-9-15 11:22:33 + ... expiry=2024-09-15 11:22:33 ... extra={'sameSite': 'Lax'} ${cookie} = Get Cookie far_future @@ -126,4 +126,4 @@ Add Cookies ${tomorrow_thistime_datetime} = Convert Date ${tomorrow_thistime} datetime Set Suite Variable ${tomorrow_thistime_datetime} Add Cookie another value expiry=${tomorrow_thistime} - Add Cookie far_future timemachine expiry=1789485753 # 2026-09-15 11:22:33 + Add Cookie far_future timemachine expiry=1726413753 # 2024-09-15 11:22:33 From a3846e263528aa0dafd148e88ca516e5b48318cc Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 13:53:41 -0400 Subject: [PATCH 14/14] Apparently need to deal with UTC time when dealing with cookie expiry --- atest/acceptance/keywords/cookies.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 4f341c05a..6ff52ccfb 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -126,4 +126,4 @@ Add Cookies ${tomorrow_thistime_datetime} = Convert Date ${tomorrow_thistime} datetime Set Suite Variable ${tomorrow_thistime_datetime} Add Cookie another value expiry=${tomorrow_thistime} - Add Cookie far_future timemachine expiry=1726413753 # 2024-09-15 11:22:33 + Add Cookie far_future timemachine expiry=1726399353 # 2024-09-15 11:22:33