Skip to content

Commit

Permalink
Merge pull request #1875 from emanlove/update-test-under-selenium-ver…
Browse files Browse the repository at this point in the history
…sions

Update test under selenium versions
  • Loading branch information
emanlove authored Dec 19, 2023
2 parents 5c115ac + b4e73a0 commit fe01706
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 40 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
strategy:
matrix:
python-version: [3.8, 3.11] # 3.12, pypy-3.9
rf-version: [4.1.3, 5.0.1, 6.0.1, 6.1.1]
rf-version: [5.0.1, 6.1.1, 7.0b1]
selenium-version: [4.14.0, 4.15.2, 4.16.0]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -42,6 +43,9 @@ jobs:
pip install -r requirements.txt
pip install robotstatuschecker>=1.4
pip install requests robotframework-pabot
- name: Install Seleninum v${{ matrix.selenium-version }}
run: |
pip install --upgrade selenium==${{ matrix.selenium-version }}
- name: Install RF ${{ matrix.rf-version }}
run: |
pip install -U --pre robotframework==${{ matrix.rf-version }}
Expand All @@ -56,6 +60,7 @@ jobs:
run: |
invoke gen-stub
# Temporarily ignoring pypy execution
- name: Run tests with headless Chrome and with PyPy
if: matrix.python-version == 'pypy-3.9'
run: |
Expand All @@ -78,7 +83,7 @@ jobs:
xvfb-run --auto-servernum python atest/run.py --zip firefox
# - name: Run tests with Selenium Grid
# if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.7'
# if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.9'
# run: |
# wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
# sudo chmod u+x ./selenium-server-standalone.jar
Expand All @@ -87,5 +92,5 @@ jobs:
- uses: actions/upload-artifact@v1
if: success() || failure()
with:
name: Failed Test results
name: SeleniumLibrary Test results
path: atest/zip_results
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Suite Teardown Close All Browsers

*** Variables ***
Expand All @@ -12,10 +12,9 @@ ${event_firing_or_none} ${NONE}
Open Browser To Start Page
[Tags] NoGrid
[Documentation]
... LOG 1:20 DEBUG Wrapping driver to event_firing_webdriver.
... LOG 1:22 INFO Got driver also from SeleniumLibrary.
... LOG 1:31 DEBUG Wrapping driver to event_firing_webdriver.
... LOG 1:33 INFO Got driver also from SeleniumLibrary.
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... executable_path=%{WEBDRIVERPATH}

Event Firing Webdriver Go To (WebDriver)
[Tags] NoGrid
Expand Down
4 changes: 2 additions & 2 deletions atest/acceptance/keywords/cookies.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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=far_future
... LOG 1:5 GLOB: ${cookie} = name=far_future
... value=timemachine
... path=/
... domain=localhost
... secure=False
... httpOnly=False
... expiry=2024-09-15 11:22:33
... expiry=2024-09-15 *:22:33
... extra={'sameSite': 'Lax'}
${cookie} = Get Cookie far_future

Expand Down
2 changes: 1 addition & 1 deletion atest/acceptance/keywords/textfields.robot
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Input Password Should Not Log Password String
... LOG 1:8 DEBUG STARTS: Remote response
... LOG 1:9 DEBUG Finished Request
... LOG 1:10 INFO Temporally setting log level to: NONE
... LOG 1:11 INFO Log level changed from NONE to DEBUG.
... LOG 1:11 ANY Log level changed from NONE to DEBUG.
... LOG 1:12 NONE
... LOG 2:1 INFO Typing text 'username' into text field 'username_field'.
Input Password password_field password
Expand Down
5 changes: 0 additions & 5 deletions atest/acceptance/locators/locator_parsing.robot
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ Multiple Locators with double arrows as separator should work
Multiple Locators strategy should be case-insensitive
Page Should Contain Element cSs=div#div_id >> XpaTh=a[6] >> iD=image1_id

Multiple Locators as a List should work
${element} = Get WebElement id:foo:bar
${locator_list} = Create List id:div_id ${element} id:bar=foo
Page Should Contain Element ${locator_list}

When One Of Locator From Multiple Locators Is Not Found Keyword Fails
Run Keyword And Expect Error
... Element with locator 'id:not_here' not found.
Expand Down
38 changes: 16 additions & 22 deletions atest/acceptance/multiple_browsers_options.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,45 @@ Documentation Creating test which would work on all browser is not possible.
*** Test Cases ***
Chrome Browser With Selenium Options As String
[Documentation]
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:14 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 Attribute As True
[Documentation]
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 1:3 DEBUG GLOB: *"--headless=new"*
... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:14 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 1:14 DEBUG GLOB: *"--headless=new"*
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_argument ( "--headless=new" )
... executable_path=%{WEBDRIVERPATH}


Chrome Browser With Selenium Options With Complex Object
[Tags] NoGrid
[Documentation]
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:3 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"*
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:14 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"*
... LOG 1:14 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]
... LOG 2:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 2:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
... LOG 2:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 2:14 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
${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
[Documentation]
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:3 DEBUG GLOB: *["has;semicolon"*
... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"*
... LOG 1:14 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}
6 changes: 3 additions & 3 deletions atest/acceptance/open_and_close.robot
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Close Browser Does Nothing When No Browser Is Opened

Browser Open With Not Well-Formed URL Should Close
[Documentation] Verify after incomplete 'Open Browser' browser closes
... LOG 1.1:24 DEBUG STARTS: Opened browser with session id
... LOG 1.1:24 DEBUG REGEXP: .*but failed to open url.*
... LOG 1.1:35 DEBUG STARTS: Opened browser with session id
... LOG 1.1:35 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} executable_path=%{WEBDRIVERPATH}
Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER}
Close All Browsers

Switch to closed browser is possible
Expand Down
1 change: 1 addition & 0 deletions atest/acceptance/windows.robot
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Set Window Position using strings
Should Be Equal ${y} ${100}

Test Minimize and Maximize Will Actually Move and Resize Window
[Tags] Triage
Set Window Position 300 200
Set Window Size 400 300
${isHidden}= Execute Javascript return document.hidden;
Expand Down

0 comments on commit fe01706

Please sign in to comment.