Skip to content

Commit 62fe312

Browse files
authored
Merge branch 'robotframework:master' into master
2 parents 9047313 + 3cbc641 commit 62fe312

29 files changed

+4733
-223
lines changed

.github/workflows/CI.yml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ jobs:
1010
strategy:
1111
matrix:
1212
python-version: [3.8, 3.11] # 3.12, pypy-3.9
13-
rf-version: [5.0.1, 6.1.1, 7.0b1]
14-
selenium-version: [4.14.0, 4.15.2, 4.16.0]
13+
rf-version: [5.0.1, 6.1.1, 7.0]
14+
selenium-version: [4.14.0, 4.15.2, 4.16.0, 4.17.2, 4.18.1, 4.19.0]
15+
browser: [firefox, chrome, headlesschrome] #edge
1516

1617
steps:
17-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1819
- name: Set up Python ${{ matrix.python-version }} with Robot Framework ${{ matrix.rf-version }}
19-
uses: actions/setup-python@v4
20+
uses: actions/setup-python@v5
2021
with:
2122
python-version: ${{ matrix.python-version }}
2223
- name: Setup Chrome
@@ -27,6 +28,14 @@ jobs:
2728
- run: |
2829
echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }}
2930
${{ steps.setup-chrome.outputs.chrome-path }} --version
31+
- name: Setup firefox
32+
id: setup-firefox
33+
uses: browser-actions/setup-firefox@v1
34+
with:
35+
firefox-version: latest
36+
- run: |
37+
echo Installed firefox versions: ${{ steps.setup-firefox.outputs.firefox-version }}
38+
${{ steps.setup-firefox.outputs.firefox-path }} --version
3039
- name: Start xvfb
3140
run: |
3241
export DISPLAY=:99.0
@@ -62,25 +71,14 @@ jobs:
6271
6372
# Temporarily ignoring pypy execution
6473
- name: Run tests with headless Chrome and with PyPy
65-
if: matrix.python-version == 'pypy-3.9'
74+
if: startsWith( matrix.python-version, 'pypy') == true
6675
run: |
6776
xvfb-run --auto-servernum python atest/run.py --nounit --zip headlesschrome
6877
69-
- name: Run tests with normal Chrome if CPython
70-
if: matrix.python-version != 'pypy-3.9'
71-
run: |
72-
xvfb-run --auto-servernum python atest/run.py --zip chrome
73-
74-
# Recognize for the moment this will NOT run as we aren't using Python 3.9
75-
- name: Run tests with headless Firefox with Python 3.9 and RF 4.1.3
76-
if: matrix.python-version == '3.9' && matrix.rf-version == '4.1.3'
77-
run: |
78-
xvfb-run --auto-servernum python atest/run.py --zip headlessfirefox
79-
80-
- name: Run tests with normal Firefox with Python 3.9 and RF != 4.1.3
81-
if: matrix.python-version == '3.9' && matrix.rf-version != '4.1.3'
78+
- name: Run tests with ${{ matrix.browser }} if CPython
79+
if: startsWith( matrix.python-version, 'pypy') == false
8280
run: |
83-
xvfb-run --auto-servernum python atest/run.py --zip firefox
81+
xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }}
8482
8583
# - name: Run tests with Selenium Grid
8684
# if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.9'
@@ -90,7 +88,7 @@ jobs:
9088
# xvfb-run --auto-servernum python atest/run.py --zip headlesschrome --grid True
9189

9290
- uses: actions/upload-artifact@v1
93-
if: success() || failure()
91+
if: failure()
9492
with:
9593
name: SeleniumLibrary Test results
9694
path: atest/zip_results

BUILD.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ Testing
6464
-------
6565

6666
Make sure that adequate tests are executed before releases are created.
67-
See `<test/README.rst>`_ for details.
67+
For more information about unit tests see `<utest/README.rst>`_ or for
68+
acceptance tests see `<atest/README.rst>`_.
6869

6970
Preparation
7071
-----------

CONTRIBUTING.rst

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@ Contribution guidelines
33

44
These guidelines instruct how to submit issues and contribute code to
55
the `SeleniumLibrary project`_. Other great ways to contribute include
6-
answering questions and participating discussion on `robotframework-users`_
7-
mailing list and other forums as well as spreading the word about the
8-
framework one way or the other.
6+
answering questions and participating in discussions within the
7+
#seleniumlibrary channel on the community `Robot Framework Slack`_, the
8+
`Robot Framework Forum`_ and other channels as well as spreading the word
9+
about the framework one way or the other.
910

1011
Submitting issues
1112
=================
1213

1314
Bugs and enhancements are tracked in the `issue tracker`_.
1415
If you are unsure if something is a bug or is a feature worth
15-
implementing, you can first ask on `robotframework-users`_ list. This and
16+
implementing, you can first ask within the `Robot Framework Slack`_. This and
1617
other similar forums, not the issue tracker, are also places where to ask
1718
general questions.
1819

19-
Before submitting a new issue, it is always a good idea to check is the
20-
same bug or enhancement already reported. If it is, please add your
20+
Before submitting a new issue, it is always a good idea to check if the
21+
same bug or enhancement is already reported. If it is, please add your
2122
comments to the existing issue instead of creating a new one.
2223

2324
Reporting bugs
@@ -43,9 +44,11 @@ Enhancement requests
4344

4445
Describe the new feature and use cases for it in as much detail as
4546
possible in an issue. Especially with larger enhancements, be prepared to
46-
contribute the code in form of a pull request as explained below or to
47+
contribute the code in the form of a pull request as explained below or to
4748
pay someone for the work. Consider also would it be better to implement this
48-
functionality as a separate library outside the SeleniumLibrary.
49+
functionality as a separate library outside the SeleniumLibrary. One option
50+
here is to extend SeleniumLibrary using the public API or plug-in api. Please
51+
see `extending documentation`_ for more details.
4952

5053
Code contributions
5154
==================
@@ -88,17 +91,25 @@ We do, however, recommend to create dedicated branches for pull requests
8891
instead of creating them based on the master branch. This is especially
8992
important if you plan to work on multiple pull requests at the same time.
9093

91-
This project requires that pull request contains linear history of commits and
92-
we do not allow that pull request contains merge commits or other noise. This helps
93-
the review process and makes the maintenance easier for the project administrators.
94-
Generally it is recommended to do `git pull --rebase` instead of the `git pull --merge`
95-
when there is need pull changes from upstream.
94+
This project asks that prior to making an enhancement pull request that you
95+
discuss the enhancement with the team. We wish to avoid having you spend effort on an
96+
ehancement that won't match with the project. We require that a pull request contains
97+
linear history of commits and we do not allow that pull request contains merge commits
98+
or other noise. This helps the review process and makes the maintenance easier for the
99+
project administrators. Generally it is recommended to do `git pull --rebase` instead
100+
of the `git pull --merge` when there is need pull changes from upstream.
96101

97102
Coding conventions
98103
------------------
99104

105+
The SeleniumLibrary team is currently reviewing, revising, and updating
106+
the coding conventions during Q1 2024. Knowing these coding conventions
107+
are seen as a good practice, we are leaving these here as recommendations
108+
in the mean time but are not forcing this as a requirement for accepting
109+
pull requests.
110+
100111
SeleniumLibrary uses the general Python code conventions defined in
101-
`PEP-8`_. In addition to that, we try to write `idiomatic Python`_
112+
`PEP-8`_. In addition to that, we try to write `idiomatic Python`_ or `"Pythonic" code`_
102113
and follow the `SOLID principles`_. with all new code. An important guideline
103114
is that the code should be clear enough that comments are generally not needed.
104115

@@ -145,7 +156,7 @@ individual keywords.
145156

146157
- All new enhancements or changes should have a note telling when the
147158
change was introduced. Often adding something like
148-
``New in SeleniumLibray 1.8.`` is enough.
159+
``New in SeleniumLibrary 1.8.`` is enough.
149160

150161
Keyword documentation can be easily created using `invoke`_ task::
151162

@@ -159,34 +170,38 @@ Tests
159170
When submitting a pull request with a new feature or a fix, you should
160171
always include tests for your changes. These tests prove that your
161172
changes work, help prevent bugs in the future, and help document what
162-
your changes do. Depending an the change, you may need
163-
``acceptance tests``\ *, ``unit tests``* or both.
173+
your changes do. Depending an the change, you may need ``acceptance tests``,
174+
``unit tests`` or both.
164175

165176
Make sure to run all of the tests before submitting a pull request to be
166177
sure that your changes do not break anything. If you can, test in
167178
multiple browsers and versions (Firefox, Chrome, IE, Edge etc). Pull requests
168-
are also automatically tested on `Travis CI`_.
179+
are also automatically tested on `GitHub Actions`_.
169180

170181
Acceptance tests
171182
~~~~~~~~~~~~~~~~
172183

173184
Most of SeleniumLibrary's testing is done using acceptance tests that
174185
naturally use Robot Framework itself for testing. Every new
175186
functionality or fix should generally get one or more acceptance tests.
187+
For more details on acceptance tests and how to run the acceptance tests,
188+
see `atest/README.rst`_.
176189

177190
Unit tests
178191
~~~~~~~~~~
179192

180193
Unit tests are great for testing internal logic and should be added when
181-
appropriate. For more details see `Unit and acceptance
182-
tests <https://github.com/robotframework/SeleniumLibrary/blob/master/BUILD.rst#unit-and-acceptance-tests%3E>`__.
194+
appropriate. For more details on unit tests and running them, see
195+
`utest/README.rst`_.
183196

184197
Continuous integration
185198
----------------------
186199

187-
SeleniumLibrary's continuous integration (CI) servers are visible through
188-
`Travis CI`_. For more details about how to run test and how `Travis CI`_
189-
integration is implemented can be found from the `test/README.rst`_.
200+
SeleniumLibrary uses GitHub Actions as it's continuous integration (CI) server.
201+
202+
.. ToDo: re-add when explanation of GitHUb Actions is written
203+
More details about how `GitHub Actions`_ integration is implemented can be
204+
found within `<.github/CI/README.rst>.
190205
191206
Finalizing pull requests
192207
------------------------
@@ -198,7 +213,7 @@ Acknowledgments
198213
~~~~~~~~~~~~~~~
199214

200215
If you have done any non-trivial change and would like to be credited,
201-
remind us to add `acknowledge` tag to the issue. This way we will add
216+
remind us to add ``acknowledge`` tag to the issue. This way we will add
202217
your name to the release notes, when next release is made.
203218

204219
Resolving conflicts
@@ -209,22 +224,26 @@ the same code as your changes. In that case you should
209224
`sync your fork`_ and `resolve conflicts`_ to allow for an easy merge.
210225

211226
.. _SeleniumLibrary project: https://github.com/robotframework/SeleniumLibrary
212-
.. _robotframework-users: http://groups.google.com/group/robotframework-users
227+
.. _Robot Framework Slack: https://rf-invite.herokuapp.com/
228+
.. _Robot Framework Forum: https://forum.robotframework.org/c/libraries/lib-seleniumlibrary/11
213229
.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues
214230
.. _(SSCCE): http://sscce.org
231+
.. _extending documentation: https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst
215232
.. _GitHub account: https://github.com/
216233
.. _Git: https://git-scm.com
217234
.. _set up Git: https://help.github.com/articles/set-up-git/
218235
.. _fork a repository: https://help.github.com/articles/fork-a-repo/
219236
.. _use pull requests: https://help.github.com/articles/using-pull-requests
220237
.. _PEP-8: https://www.python.org/dev/peps/pep-0008/
221-
.. _idiomatic Python: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
238+
.. _idiomatic Python: https://en.wikibooks.org/wiki/Python_Programming/Idioms
239+
.. _"Pythonic" code: https://docs.python-guide.org/writing/style/
222240
.. _SOLID principles: https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)
223241
.. _PEP-257: https://www.python.org/dev/peps/pep-0257/
224242
.. _invoke: http://www.pyinvoke.org/
225-
.. _Travis CI: https://travis-ci.org/robotframework/SeleniumLibrary
226-
.. _test/README.rst`: https://github.com/robotframework/SeleniumLibrary/blob/master/test/README.rst
243+
.. _GitHub Actions: https://github.com/robotframework/SeleniumLibrary/actions
244+
.. _atest/README.rst: https://github.com/robotframework/SeleniumLibrary/tree/master/atest/README.rst
245+
.. _utest/README.rst: https://github.com/robotframework/SeleniumLibrary/blob/master/utest/README.rst
227246
.. _sync your fork: https://help.github.com/articles/syncing-a-fork/
228247
.. _resolve conflicts: https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line
229248
.. _Black: https://github.com/psf/black
230-
.. _flake8: https://gitlab.com/pycqa/flake8
249+
.. _flake8: https://github.com/PyCQA/flake8
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
*** Test Cases ***
2+
# Wait Until Element State Is (Not)
3+
# Get Element State
4+
# Element States Should (Not) Be
5+
6+
Check waiting for condition that takes a element
7+
Fail
8+
9+
Check waiting for condition that takes a title
10+
Fail
11+
12+
Check waiting for condition that takes a url
13+
Fail
14+
Wait Until url contains google
15+
# verify took 2 seconds
16+
17+
Check waiting for condition that takes locator and string
18+
Wait Until Element State Is ${condition} ${locator} ${string}
19+
Wait Until Element State Is ${condition} ${element}
20+
Wait Until Condition Is ${condition} ${target}
21+
Wait Until Condition Is ${condition} ${whatelse you need for this condition}
22+
23+
24+
Wait Until State Is number_of_windows_to_be
25+
Wait Until Expected Condition Is number_of_windows_to_be
26+
Wait Until Condition Is number of windows to be 5
27+
Wait Until Condition Is text to be present in element attribute //some/xpath/to/an/element href http://hello
28+
29+
Wait Until Condition Is number of windows to be 5 text to be present in element attribute //some/xpath/to/an/element href http://hello
30+
31+
Wait Until number of windows to be 5
32+
Wait Until text to be present in element attribute //some/xpath/to/an/element href http://hello
33+
Get Condition
34+
Is number of windows to be 5

atest/acceptance/keywords/choose_file.robot

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ Choose File With Grid From Library Using SL choose_file method
4545

4646
Input Text Should Work Same Way When Not Using Grid
4747
[Documentation]
48-
... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {*
49-
... LOG 1:9 DEBUG Finished Request
50-
... LOG 1:10 DEBUG GLOB: POST*/session/*/value*"text": "*
51-
... LOG 1:13 DEBUG Finished Request
52-
... LOG 1:14 DEBUG NONE
48+
... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {*
49+
... LOG 1:9 DEBUG Finished Request
50+
... LOG 1:10 DEBUG REGEXP: POST.*/session/.*/value.*['\\\"]text['\\\"]: ['\\\"].*
51+
... LOG 1:13 DEBUG Finished Request
52+
... LOG 1:14 DEBUG NONE
5353
[Tags] NoGrid
5454
[Setup] Touch ${CURDIR}${/}temp.txt
5555
Input Text file_to_upload ${CURDIR}${/}temp.txt

atest/acceptance/keywords/click_element.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Click Element Action Chain
4040
[Tags] NoGrid
4141
[Documentation]
4242
... LOB 1:1 INFO Clicking 'singleClickButton' using an action chain.
43-
... LOG 1:6 DEBUG GLOB: *actions {"actions": [{*
43+
... LOG 1:6 DEBUG REGEXP: .*actions {['\\\"]actions['\\\"]: \\\[\\\{.*
4444
Click Element singleClickButton action_chain=True
4545
Element Text Should Be output single clicked
4646

atest/acceptance/keywords/cookies.robot

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ Add Cookie When Expiry Is Human Readable Data&Time
4949
Delete Cookie
5050
[Tags] Known Issue Safari
5151
Delete Cookie test
52-
${cookies} = Get Cookies
53-
Should Be Equal ${cookies} far_future=timemachine; another=value
52+
${cookies} = Get Cookies as_dict=True
53+
${expected_cookies} Create Dictionary far_future=timemachine another=value
54+
Dictionaries Should Be Equal ${cookies} ${expected_cookies}
5455

5556
Non-existent Cookie
5657
Run Keyword And Expect Error
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
*** Settings ***
2+
Test Setup Go To Page "javascript/expected_conditions.html"
3+
Resource ../resource.robot
4+
5+
*** Test Cases ***
6+
Wait For Expected Conditions One Argument
7+
Title Should Be Original
8+
Click Element link=delayed change title
9+
Wait For Expected Condition title_is Delayed
10+
Title Should Be Delayed
11+
12+
Wait For Expected Condition Times out within set timeout
13+
[Documentation] FAIL REGEXP: TimeoutException: Message: Expected Condition not met within set timeout of 0.3*
14+
Title Should Be Original
15+
Click Element link=delayed change title
16+
Wait For Expected Condition title_is Delayed timeout=0.3
17+
18+
Wait For Expected Conditions using WebElement as locator
19+
Click Button Change the button state
20+
${dynamic_btn}= Get WebElement id:enabledDisabledBtn
21+
Wait For Expected Condition element_to_be_clickable ${dynamic_btn}
22+
23+
Wait For Expected Conditions Where Condition Written With Spaces
24+
Title Should Be Original
25+
Click Element link=delayed change title
26+
Wait For Expected Condition title is Delayed
27+
Title Should Be Delayed
28+
29+
Wait For Expected Conditions Where Condition Is Variable
30+
${condition}= Set Variable title is
31+
Title Should Be Original
32+
Click Element link=delayed change title
33+
Wait For Expected Condition ${condition} Delayed
34+
Title Should Be Delayed
35+
36+
Wait For Expected Conditions Where Condition Is Strange Case
37+
Click Button Change the button state
38+
${dynamic_btn}= Get WebElement id:enabledDisabledBtn
39+
Wait For Expected Condition EleMENT tO BE cLiCkAbLe ${dynamic_btn}
40+
41+
Wait For Non Existing Expected Conditions
42+
Click Button Change the button state
43+
${dynamic_btn}= Get WebElement id:enabledDisabledBtn
44+
Run Keyword And Expect Error this_is_not_an_expected_con_dition is an unknown expected condition
45+
... Wait For Expected Condition this_is not an expected con dition ${dynamic_btn}
46+
47+
Wait For Expected Conditions When Condition Includes Locator
48+
Title Should Be Original
49+
${byElem}= Evaluate ("id","added_btn")
50+
Click Element link:delayed add element
51+
Wait For Expected Condition Presence Of Element Located ${byElem}
52+
Click Element id:added_btn

0 commit comments

Comments
 (0)