From 5b5c598e3ba5c4650231911221622494dbc2a820 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 08:19:32 -0400 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 5/6] 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 6/6] 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