Skip to content

Commit

Permalink
Merge pull request #1861 from emanlove/update-atests-with-preconfigur…
Browse files Browse the repository at this point in the history
…ed-webdriver

Update atests with preconfigured webdriver
  • Loading branch information
emanlove authored Nov 1, 2023
2 parents 036771b + a3846e2 commit 6008d6c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion atest/acceptance/create_webdriver.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
40 changes: 23 additions & 17 deletions atest/acceptance/keywords/cookies.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,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
Expand All @@ -35,21 +36,21 @@ 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
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
Expand All @@ -71,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} 2023
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
Expand Down Expand Up @@ -106,18 +107,23 @@ 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=2023-10-29 19:36:51
... expiry=2024-09-15 11:22:33
... extra={'sameSite': 'Lax'}
${cookie} = Get Cookie another
${cookie} = Get Cookie far_future

*** Keyword ***
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
${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=1726399353 # 2024-09-15 11:22:33
6 changes: 4 additions & 2 deletions atest/acceptance/keywords/page_load_timeout.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions atest/acceptance/multiple_browsers_options.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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}
2 changes: 1 addition & 1 deletion atest/acceptance/open_and_close.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.

0 comments on commit 6008d6c

Please sign in to comment.