Skip to content

Commit be4df1f

Browse files
committed
feat: add documentation for playwright integration
1 parent 31f296e commit be4df1f

11 files changed

+105
-19
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
Toolium Changelog
22
=================
33

4-
v3.3.2
4+
v3.4.0
55
------
66

77
*Release date: In development*
88

9+
- Now Playwright is available to run web tests instead of Selenium
10+
911
v3.3.1
1012
------
1113

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Toolium
33

44
|Build Status| |Coverage Status| |CodeClimate| |Documentation Status|
55

6-
Toolium is a Python wrapper tool of Selenium and Appium libraries to test web and mobile applications in a single
6+
Toolium is a Python wrapper tool of Selenium, Playwright and Appium libraries to test web and mobile applications in a single
77
project. It provides a way of choosing and configuring the driver through a configuration file, implements a Page Object
88
pattern and includes a simple visual testing solution.
99

@@ -26,6 +26,8 @@ The main dependencies are:
2626

2727
- `Selenium <http://docs.seleniumhq.org/>`_: to test web applications in major browsers (Firefox, Chrome, Internet
2828
Explorer, Edge or Safari)
29+
- `Playwright <https://playwright.dev/>`_: to test web applications in major browsers (Firefox, Chrome, Edge or Safari)
30+
as an alternative to Selenium (Beta integration in toolium)
2931
- `Appium-Python-Client <https://github.com/appium/python-client>`_: to test mobile applications (native, hybrid or web)
3032
in Android or iOS devices/emulators.
3133
- `requests <http://docs.python-requests.org>`_: to test APIs

docs/bdd_integration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ After initialization, the following attributes will be available in behave conte
4848

4949
- :code:`context.toolium_config`: dictionary with Toolium configuration, readed from properties.cfg
5050
- :code:`context.driver_wrapper`: :ref:`DriverWrapper <driver_wrapper>` instance
51-
- :code:`context.driver`: Selenium or Appium driver instance
51+
- :code:`context.driver`: Selenium, Playwright or Appium driver instance
5252
- :code:`context.utils`: :ref:`Utils <utils>` instance
5353

5454
Behave userdata properties

docs/browser_configuration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Browser Configuration
66
Common Configuration
77
--------------------
88

9-
To choose the browser in which Selenium will execute the tests, configure *type* property in *[Driver]* section in
10-
properties.cfg file with one of these values: firefox, chrome, iexplore, edge or safari.
9+
To choose the browser in which Selenium or Playwright will execute the tests, configure *type* property in *[Driver]*
10+
section in properties.cfg file with one of these values: firefox, chrome, iexplore, edge or safari.
1111

1212
The following example shows how to choose Firefox::
1313

docs/driver_configuration.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
Driver Configuration
44
====================
55

6-
Toolium allows to run tests on web browsers (using Selenium) or on mobile devices (using Appium). To choose the browser
7-
or the mobile OS, configure :code:`type` property in :code:`[Driver]` section in :code:`conf/properties.cfg` file with
8-
one of these values: :code:`firefox`, :code:`chrome`, :code:`iexplore`, :code:`edge`, :code:`safari`, :code:`ios` or
9-
:code:`android`.
6+
Toolium allows to run tests on web browsers (using Selenium or Playwright) or on mobile devices (using Appium). To
7+
choose the browser or the mobile OS, configure :code:`type` property in :code:`[Driver]` section in
8+
:code:`conf/properties.cfg` file with one of these values: :code:`firefox`, :code:`chrome`, :code:`iexplore`,
9+
:code:`edge`, :code:`safari`, :code:`ios` or :code:`android`.
1010

1111
The following example shows how to choose Firefox::
1212

@@ -18,9 +18,9 @@ If driver is not needed, typically in API tests, disable it using an empty strin
1818
[Driver]
1919
type: api
2020

21-
By default, Toolium configuration is loaded from :code:`conf/properties.cfg` and :code:`conf/local-properties.cfg` files. If
22-
different properties files are used for different environments, they can be selected using a system property named
23-
:code:`TOOLIUM_CONFIG_ENVIRONMENT`. For example, if :code:`TOOLIUM_CONFIG_ENVIRONMENT` value is :code:`android`,
21+
By default, Toolium configuration is loaded from :code:`conf/properties.cfg` and :code:`conf/local-properties.cfg`
22+
files. If different properties files are used for different environments, they can be selected using a system property
23+
named :code:`TOOLIUM_CONFIG_ENVIRONMENT`. For example, if :code:`TOOLIUM_CONFIG_ENVIRONMENT` value is :code:`android`,
2424
Toolium configuration will be loaded from :code:`conf/properties.cfg`, :code:`conf/android-properties.cfg` and
2525
:code:`local-android-properties.cfg` files:
2626

@@ -45,6 +45,7 @@ Behave:
4545
- :ref:`Driver Configuration Modification <driver_configuration_modification>`
4646
- :ref:`Browser Configuration <browser_configuration>`
4747
- :ref:`Mobile Configuration <mobile_configuration>`
48+
- :ref:`Playwright Configuration <playwright_configuration>`
4849
- :ref:`Remote Driver Configuration <remote_configuration>`
4950
- :ref:`Multiple Simultaneous Drivers <multiple_drivers>`
5051
- :ref:`Reuse Driver <reuse_driver>`
@@ -55,6 +56,7 @@ Behave:
5556
Driver Configuration Modification <driver_configuration_modification.rst>
5657
Browser Configuration <browser_configuration.rst>
5758
Mobile Configuration <mobile_configuration.rst>
59+
Playwright Configuration <playwright_configuration.rst>
5860
Remote Driver Configuration <remote_configuration.rst>
5961
Multiple Simultaneous Drivers <multiple_drivers.rst>
6062
Reuse Driver <reuse_driver.rst>

docs/mobile_configuration.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Mobile Configuration
44
====================
55

6-
To choose mobile operating system in which Appium will execute the tests, configure *type* property in *[Driver]*
7-
section in properties.cfg file with one of these values: :code:`ios` or :code:`android`. Moreover, configure Appium
8-
properties in *[AppiumCapabilities]* section in properties.cfg file.
6+
To choose mobile operating system in which Appium will execute the tests, configure :code:`type` property in
7+
:code:`[Driver]` section in :code:`conf/properties.cfg` file with one of these values: :code:`ios` or :code:`android`.
8+
Moreover, configure Appium properties in :code:`[AppiumCapabilities]` section in :code:`conf/properties.cfg` file.
99

1010
The following example shows how to configure Appium to run tests over TestApp app on an iPhone 14 with iOS 16.1::
1111

docs/page_objects.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Page Objects
66
Toolium implements Page Object pattern, where a page object represents a web page or a mobile screen (or a part of them)
77
and a page element is any of the elements contained in those pages (inputs, buttons, texts, ...).
88

9-
Toolium loads page elements in lazy loading, so they are searched in Selenium or Appium when they are used, not when
10-
they are defined.
9+
Toolium loads page elements in lazy loading, so they are searched in Selenium, Playwright or Appium when they are used,
10+
not when they are defined.
1111

1212
Basic usage
1313
-----------
@@ -41,6 +41,8 @@ Example of a test using the previous page object:
4141
LoginPageObject().login('user', 'pass')
4242
...
4343
44+
.. _page_element_types:
45+
4446
Page element types
4547
------------------
4648

@@ -68,8 +70,8 @@ element (Button), for example.
6870
username.text = 'username'
6971
7072
Page elements only implement the most commonly used methods. When performing any other action with the element, get the
71-
web element of the page element and execute the action. *web_element* property returns the Selenium or Appium
72-
WebElement.
73+
web element of the page element and execute the action. *web_element* property returns the Selenium, Playwright or
74+
Appium WebElement.
7375

7476
.. code-block:: python
7577
@@ -78,6 +80,8 @@ WebElement.
7880
# Check if the element is enabled
7981
enabled = username.web_element.is_enabled()
8082
83+
.. _page_element_parent:
84+
8185
Parent
8286
~~~~~~
8387

docs/playwright_configuration.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _playwright_configuration:
2+
3+
Playwright Configuration
4+
========================
5+
6+
Playwright is an alternative to Selenium to test web applications using toolium. This integration is currently in beta
7+
version.
8+
9+
To choose Playwright instead of Selenium, configure :code:`web_library` property in :code:`[Driver]` section in
10+
:code:`conf/properties.cfg` file with :code:`playwright` and configure the browser in :code:`type` property as in
11+
Selenium tests.
12+
13+
The following example shows how to configure toolium to run tests on Chrome using Playwright::
14+
15+
[Driver]
16+
web_library: playwright
17+
type: chrome
18+
19+
Features not supported yet
20+
--------------------------
21+
22+
The following toolium features are not supported yet when using Playwright:
23+
24+
* :ref:`Page Elements <page_element_types>`: not all page elements are implemented for Playwright. Currently only
25+
:ref:`Text <playwright_text_page_element>` and :ref:`Button <playwright_button_page_element>` page elements are
26+
implemented.
27+
* :ref:`Element Parent <page_element_parent>`: elements can not be located inside another element using Playwright.
28+
* Locators: only :code:`id` and :code:`xpath` locators are implemented for Playwright.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Playwright pageelements
2+
=======================
3+
4+
.. _playwright_page_element:
5+
6+
playwright_page_element
7+
-----------------------
8+
9+
.. automodule:: toolium.pageelements.playwright.page_element
10+
:members:
11+
:undoc-members:
12+
:show-inheritance:
13+
14+
.. _playwright_button_page_element:
15+
16+
playwright_button_page_element
17+
------------------------------
18+
19+
.. automodule:: toolium.pageelements.playwright.button_page_element
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:
23+
24+
.. _playwright_checkbox_page_element:
25+
26+
playwright_input_text_page_element
27+
----------------------------------
28+
29+
.. automodule:: toolium.pageelements.playwright.input_text_page_element
30+
:members:
31+
:undoc-members:
32+
:show-inheritance:
33+
34+
.. _playwright_text_page_element:
35+
36+
playwright_text_page_element
37+
----------------------------
38+
39+
.. automodule:: toolium.pageelements.playwright.text_page_element
40+
:members:
41+
:undoc-members:
42+
:show-inheritance:

docs/toolium.pageelements.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,7 @@ page_elements
100100
:members:
101101
:undoc-members:
102102
:show-inheritance:
103+
104+
.. toctree::
105+
106+
toolium.pageelements.playwright

0 commit comments

Comments
 (0)