vigilant-kit 1.2.0__tar.gz → 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vigilant-kit might be problematic. Click here for more details.
- vigilant_kit-1.2.1/PKG-INFO +59 -0
- vigilant_kit-1.2.1/README.md +43 -0
- vigilant_kit-1.2.1/docs/selenium_install.md +50 -0
- vigilant_kit-1.2.0/README.md → vigilant_kit-1.2.1/docs/vigilant_unittest.md +1 -40
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/pyproject.toml +1 -1
- vigilant_kit-1.2.0/PKG-INFO +0 -150
- vigilant_kit-1.2.0/docs/selenium_install.md +0 -41
- vigilant_kit-1.2.0/docs/vigilant_unittest.md +0 -49
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/.gitignore +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/.vigilant.env.example +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/LICENSE +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/docs/actions.md +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/docs/browser_options.md +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/docs/native_selenium.md +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/docs/tutorial_pytest.md +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/docs/vigilant_pytest.md +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vgl_cli/install_dev_kit_command.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vgl_cli/install_standalone_command.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vgl_cli/install_webdriver_command.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vgl_cli/run_selenium_command.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vgl_cli/vgl.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/__init__.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/actions/__init__.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/actions/assertions.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/actions/finder.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/actions/vigilant_actions.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/actions/waiter.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/driver/__init__.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/driver/vigilant_driver.py +0 -0
- {vigilant_kit-1.2.0 → vigilant_kit-1.2.1}/src/vigilant/logger.py +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: vigilant_kit
|
|
3
|
+
Version: 1.2.1
|
|
4
|
+
Summary: Library that makes functional testing with Selenium WebDriver fast and easy.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ivpel/vigilant
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/ivpel/vigilant/issues
|
|
7
|
+
Author-email: Pelykh Ivan <ivan.pelykh@protonmail.com>
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: bdd,functional,functional-testing,pytest,selenium,tdd,testing,unittest,webdriver
|
|
10
|
+
Requires-Python: >=3.7
|
|
11
|
+
Requires-Dist: click
|
|
12
|
+
Requires-Dist: python-dotenv
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Requires-Dist: selenium
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# Vigilant Kit
|
|
18
|
+
Vigilant is a set of tools designed to help write and run robust functional tests using Selenium WebDriver. It provides
|
|
19
|
+
methods for interacting with the WebBrowser, assertions, and waiting. With Vigilant, you can start writing complex test
|
|
20
|
+
cases in a minute.
|
|
21
|
+
|
|
22
|
+
## Why Vigilant?
|
|
23
|
+
- **Easy to start & Fast To Write**: Easy configuration process, straightforward way to writing your tests.
|
|
24
|
+
Vigilant provides you with methods that help you write functional tests quickly without spending time on writing
|
|
25
|
+
boilerplate code every time you start a new project.
|
|
26
|
+
- **Flexible Framework Usage**: Usage is not limited to a single testing framework; you can use Vigilant with unittest,
|
|
27
|
+
pytest, or anything else.
|
|
28
|
+
|
|
29
|
+
## What it includes?
|
|
30
|
+
Methods for **interacting** with WebBrowser (`click`, `scroll_to`, etc.), **assertions** (`see`, `dont_see`, `see_text`
|
|
31
|
+
, etc.) **waiters** (`wait_for_element_to_be_visible`, `wait_for_element_to_be_clickable`, etc.)
|
|
32
|
+
It is already there, ready to use.
|
|
33
|
+
|
|
34
|
+
Also, a bunch of CLI scripts, to make your life easier!
|
|
35
|
+
|
|
36
|
+
Use `vgl --help` to see all available commands.
|
|
37
|
+
|
|
38
|
+
List of all available [actions](docs/actions.md).
|
|
39
|
+
|
|
40
|
+
## Extending Functionality
|
|
41
|
+
If you need something that is not covered in this library, you still have access to all native `Selenium WebDriver`
|
|
42
|
+
methods. You can create your own methods or use native `WebDriver` methods and share them on one browser session.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
```shell
|
|
46
|
+
pip install vigilant-kit
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Docs
|
|
50
|
+
- [How to install Selenium server & browser drivers](docs/selenium_install.md)
|
|
51
|
+
- [Quick start example using `unittest` library](docs/vigilant_unittest.md)
|
|
52
|
+
- [Quick start example using `pytest`](docs/vigilant_pytest.md)
|
|
53
|
+
- [How to add custom browser options](docs/browser_options.md)
|
|
54
|
+
- [Access native Selenium WebDriver methods](docs/native_selenium.md)
|
|
55
|
+
- [List of actions](docs/actions.md).
|
|
56
|
+
|
|
57
|
+
## Tutorials
|
|
58
|
+
- [Testing ecommerce project using `vigilant-kit` and `pytest`](docs/tutorial_pytest.md)
|
|
59
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Vigilant Kit
|
|
2
|
+
Vigilant is a set of tools designed to help write and run robust functional tests using Selenium WebDriver. It provides
|
|
3
|
+
methods for interacting with the WebBrowser, assertions, and waiting. With Vigilant, you can start writing complex test
|
|
4
|
+
cases in a minute.
|
|
5
|
+
|
|
6
|
+
## Why Vigilant?
|
|
7
|
+
- **Easy to start & Fast To Write**: Easy configuration process, straightforward way to writing your tests.
|
|
8
|
+
Vigilant provides you with methods that help you write functional tests quickly without spending time on writing
|
|
9
|
+
boilerplate code every time you start a new project.
|
|
10
|
+
- **Flexible Framework Usage**: Usage is not limited to a single testing framework; you can use Vigilant with unittest,
|
|
11
|
+
pytest, or anything else.
|
|
12
|
+
|
|
13
|
+
## What it includes?
|
|
14
|
+
Methods for **interacting** with WebBrowser (`click`, `scroll_to`, etc.), **assertions** (`see`, `dont_see`, `see_text`
|
|
15
|
+
, etc.) **waiters** (`wait_for_element_to_be_visible`, `wait_for_element_to_be_clickable`, etc.)
|
|
16
|
+
It is already there, ready to use.
|
|
17
|
+
|
|
18
|
+
Also, a bunch of CLI scripts, to make your life easier!
|
|
19
|
+
|
|
20
|
+
Use `vgl --help` to see all available commands.
|
|
21
|
+
|
|
22
|
+
List of all available [actions](docs/actions.md).
|
|
23
|
+
|
|
24
|
+
## Extending Functionality
|
|
25
|
+
If you need something that is not covered in this library, you still have access to all native `Selenium WebDriver`
|
|
26
|
+
methods. You can create your own methods or use native `WebDriver` methods and share them on one browser session.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
```shell
|
|
30
|
+
pip install vigilant-kit
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Docs
|
|
34
|
+
- [How to install Selenium server & browser drivers](docs/selenium_install.md)
|
|
35
|
+
- [Quick start example using `unittest` library](docs/vigilant_unittest.md)
|
|
36
|
+
- [Quick start example using `pytest`](docs/vigilant_pytest.md)
|
|
37
|
+
- [How to add custom browser options](docs/browser_options.md)
|
|
38
|
+
- [Access native Selenium WebDriver methods](docs/native_selenium.md)
|
|
39
|
+
- [List of actions](docs/actions.md).
|
|
40
|
+
|
|
41
|
+
## Tutorials
|
|
42
|
+
- [Testing ecommerce project using `vigilant-kit` and `pytest`](docs/tutorial_pytest.md)
|
|
43
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# How to install Selenium Server & browser drivers
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
## Option 1: Run Selenium server + browser driver locally
|
|
5
|
+
### 1. Install Selenium Standalone Server and Webdriver
|
|
6
|
+
`vgl install dev-kit -b chrome`
|
|
7
|
+
|
|
8
|
+
If everything is okay and your machine has all dependencies installed, you will see this output:
|
|
9
|
+
```text
|
|
10
|
+
Found: chrome browser, version 112.0.5615.165.
|
|
11
|
+
Downloading driver for chrome browser ... OK
|
|
12
|
+
Downloading Selenium Standalone server ...OK
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2. Run Selenium Server
|
|
16
|
+
To run your Selenium Server use:
|
|
17
|
+
`vgl run selenium-server`
|
|
18
|
+
|
|
19
|
+
This command will launch Selenium Standalone server on your local machine.
|
|
20
|
+
|
|
21
|
+
### Need help? Use `--help`
|
|
22
|
+
To see all available options for these commands you can use `--help` flag.
|
|
23
|
+
|
|
24
|
+
For example:
|
|
25
|
+
`vgl run selenium-server --help`
|
|
26
|
+
|
|
27
|
+
Will output this:
|
|
28
|
+
```text
|
|
29
|
+
Usage: vgl run selenium-server [OPTIONS]
|
|
30
|
+
|
|
31
|
+
Run Selenium Server JAR file
|
|
32
|
+
|
|
33
|
+
Options:
|
|
34
|
+
-p, --port INTEGER Port number for the server
|
|
35
|
+
-D, --driver TEXT Specify driver options (e.g.
|
|
36
|
+
-Dwebdriver.chrome.driver=chromedriver)
|
|
37
|
+
-d, --daemon Run the server as a daemon
|
|
38
|
+
--help Show this message and exit.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Option 2: Start Selenium server + browser inside Docker
|
|
42
|
+
***
|
|
43
|
+
If you don't want to install and run Selenium server and the browser locally, you can run both of them in a Docker
|
|
44
|
+
container. The Selenium project provides many prepared official containers.
|
|
45
|
+
For example to start a container with Selenium server and Firefox, simply run:
|
|
46
|
+
```shell
|
|
47
|
+
docker run -d -p 4446:4444 -p 7902:7900 --shm-size="2g" selenium/standalone-firefox:4.6.0-20221104
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For more info about available options check official [Docker Selenium](https://github.com/SeleniumHQ/docker-selenium) page.
|
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
# Vigilant Kit
|
|
2
|
-
Vigilant is a set of tools made to help writing and running robust functional tests using Selenium WebDriver.
|
|
3
|
-
|
|
4
|
-
## Why Vigilant?
|
|
5
|
-
- It allows you to start writing complex test cases in a minute.
|
|
6
|
-
- Simple configuration process (just one `.vigilant.env` file to start)
|
|
7
|
-
- Usage is not limited to a single testing framework, it can be used with `unittest`, `pytest` or anything else.
|
|
8
|
-
It is up to you.
|
|
9
|
-
|
|
10
|
-
**Vigilant** provide you with methods that help write functional tests fast, without spending your time on writing
|
|
11
|
-
boilerplate code every time you start new project.
|
|
12
|
-
|
|
13
|
-
Methods for **interacting** with WebBrowser (`click`, `scroll_to`, etc.), **assertions** (`see`, `dont_see`, `see_text`
|
|
14
|
-
, etc.) **waiting** (`wait_for_element_to_be_visible`, `wait_for_element_to_be_clickable`, etc.)
|
|
15
|
-
It is already there, ready to use.
|
|
16
|
-
|
|
17
|
-
List of all available [actions](docs/actions.md).
|
|
18
|
-
|
|
19
|
-
### What if you need something that is not covered in this library?
|
|
20
|
-
|
|
21
|
-
You still have access to all native `Selenium WebDriver` methods. Despite all functional that library provide -
|
|
22
|
-
you can create your own methods or use native `WebDriver` methods and share them on one browser session.
|
|
23
|
-
|
|
24
|
-
## Docs
|
|
25
|
-
- [How to install Selenium server & browser drivers](docs/selenium_install.md)
|
|
26
|
-
- [Quick start example using `unittest` library](docs/vigilant_unittest.md)
|
|
27
|
-
- [Quick start example using `pytest`](docs/vigilant_pytest.md)
|
|
28
|
-
- [How to add custom browser options](docs/browser_options.md)
|
|
29
|
-
- [Access native Selenium WebDriver methods](docs/native_selenium.md)
|
|
30
|
-
- [List of actions](docs/actions.md).
|
|
31
|
-
|
|
32
|
-
## Tutorials
|
|
33
|
-
- [Testing ecommerce project using `vigilant-kit` and `pytest`](docs/tutorial_pytest.md)
|
|
34
|
-
|
|
35
|
-
## Install
|
|
36
|
-
```shell
|
|
37
|
-
pip install vigilant-kit
|
|
38
|
-
```
|
|
39
|
-
|
|
40
1
|
## Quick start
|
|
41
2
|
We will write our first test with `unittest` library. Also make sure that you installed
|
|
42
3
|
`vigilant-kit` library.
|
|
@@ -44,7 +5,7 @@ We will write our first test with `unittest` library. Also make sure that you in
|
|
|
44
5
|
|
|
45
6
|
### Configuration
|
|
46
7
|
Configuration can be done through environment variables. Make sure that your Selenium Server is up and running, if not -
|
|
47
|
-
[**Install Selenium server**](
|
|
8
|
+
[**Install Selenium server**](selenium_install.md)
|
|
48
9
|
|
|
49
10
|
Create `.vigilant.env` file with next data:
|
|
50
11
|
```shell
|
vigilant_kit-1.2.0/PKG-INFO
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: vigilant_kit
|
|
3
|
-
Version: 1.2.0
|
|
4
|
-
Summary: Library that makes functional testing with Selenium WebDriver fast and easy.
|
|
5
|
-
Project-URL: Homepage, https://github.com/ivpel/vigilant
|
|
6
|
-
Project-URL: Bug Tracker, https://github.com/ivpel/vigilant/issues
|
|
7
|
-
Author-email: Pelykh Ivan <ivan.pelykh@protonmail.com>
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Keywords: bdd,functional,functional-testing,pytest,selenium,tdd,testing,unittest,webdriver
|
|
10
|
-
Requires-Python: >=3.7
|
|
11
|
-
Requires-Dist: click
|
|
12
|
-
Requires-Dist: python-dotenv
|
|
13
|
-
Requires-Dist: requests
|
|
14
|
-
Requires-Dist: selenium
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
|
|
17
|
-
# Vigilant Kit
|
|
18
|
-
Vigilant is a set of tools made to help writing and running robust functional tests using Selenium WebDriver.
|
|
19
|
-
|
|
20
|
-
## Why Vigilant?
|
|
21
|
-
- It allows you to start writing complex test cases in a minute.
|
|
22
|
-
- Simple configuration process (just one `.vigilant.env` file to start)
|
|
23
|
-
- Usage is not limited to a single testing framework, it can be used with `unittest`, `pytest` or anything else.
|
|
24
|
-
It is up to you.
|
|
25
|
-
|
|
26
|
-
**Vigilant** provide you with methods that help write functional tests fast, without spending your time on writing
|
|
27
|
-
boilerplate code every time you start new project.
|
|
28
|
-
|
|
29
|
-
Methods for **interacting** with WebBrowser (`click`, `scroll_to`, etc.), **assertions** (`see`, `dont_see`, `see_text`
|
|
30
|
-
, etc.) **waiting** (`wait_for_element_to_be_visible`, `wait_for_element_to_be_clickable`, etc.)
|
|
31
|
-
It is already there, ready to use.
|
|
32
|
-
|
|
33
|
-
List of all available [actions](docs/actions.md).
|
|
34
|
-
|
|
35
|
-
### What if you need something that is not covered in this library?
|
|
36
|
-
|
|
37
|
-
You still have access to all native `Selenium WebDriver` methods. Despite all functional that library provide -
|
|
38
|
-
you can create your own methods or use native `WebDriver` methods and share them on one browser session.
|
|
39
|
-
|
|
40
|
-
## Docs
|
|
41
|
-
- [How to install Selenium server & browser drivers](docs/selenium_install.md)
|
|
42
|
-
- [Quick start example using `unittest` library](docs/vigilant_unittest.md)
|
|
43
|
-
- [Quick start example using `pytest`](docs/vigilant_pytest.md)
|
|
44
|
-
- [How to add custom browser options](docs/browser_options.md)
|
|
45
|
-
- [Access native Selenium WebDriver methods](docs/native_selenium.md)
|
|
46
|
-
- [List of actions](docs/actions.md).
|
|
47
|
-
|
|
48
|
-
## Tutorials
|
|
49
|
-
- [Testing ecommerce project using `vigilant-kit` and `pytest`](docs/tutorial_pytest.md)
|
|
50
|
-
|
|
51
|
-
## Install
|
|
52
|
-
```shell
|
|
53
|
-
pip install vigilant-kit
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Quick start
|
|
57
|
-
We will write our first test with `unittest` library. Also make sure that you installed
|
|
58
|
-
`vigilant-kit` library.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### Configuration
|
|
62
|
-
Configuration can be done through environment variables. Make sure that your Selenium Server is up and running, if not -
|
|
63
|
-
[**Install Selenium server**](docs/selenium_install.md)
|
|
64
|
-
|
|
65
|
-
Create `.vigilant.env` file with next data:
|
|
66
|
-
```shell
|
|
67
|
-
# Selenium host URL
|
|
68
|
-
SELENIUM_HOST=http://127.0.0.1:4444/wd/hub
|
|
69
|
-
|
|
70
|
-
# Browser which will performing the tests
|
|
71
|
-
SELENIUM_BROWSER=firefox
|
|
72
|
-
|
|
73
|
-
# The root URL of the application under test.
|
|
74
|
-
BASE_URL=http://www.python.org
|
|
75
|
-
|
|
76
|
-
# Amount of time (in seconds) that a test will wait while loading a page or waiting for element
|
|
77
|
-
WAIT_TIMEOUT=10
|
|
78
|
-
|
|
79
|
-
# Log level
|
|
80
|
-
LOGGER_LEVEL=INFO
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Test
|
|
84
|
-
Create file `test_first.py` with same code as below. We will cover 3 simple cases for demo purposes.
|
|
85
|
-
```python
|
|
86
|
-
import unittest
|
|
87
|
-
|
|
88
|
-
from vigilant.driver.vigilant_driver import VigilantDriver
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
class TestHomePage(unittest.TestCase):
|
|
92
|
-
|
|
93
|
-
@classmethod
|
|
94
|
-
def setUpClass(cls) -> None:
|
|
95
|
-
cls.act = VigilantDriver()
|
|
96
|
-
|
|
97
|
-
@classmethod
|
|
98
|
-
def tearDownClass(cls) -> None:
|
|
99
|
-
cls.act.quit()
|
|
100
|
-
|
|
101
|
-
def test_home_page(self):
|
|
102
|
-
# Case 1. Go to some page and assert page title
|
|
103
|
-
self.act.get_page('/') # Go to root page
|
|
104
|
-
self.act.assertions.see_in_title('Python') # Assert that page title contains 'Python' string
|
|
105
|
-
|
|
106
|
-
def test_text_block(self):
|
|
107
|
-
# Case 2. Scroll to some block and assert visible text
|
|
108
|
-
self.act.get_page('/') # Go to root page
|
|
109
|
-
self.act.scroll_to('//h2[text()="Success Stories"]') # Scroll to Success Stories block
|
|
110
|
-
self.act.assertions.see_text('Success Stories') # Assert that Success Stories string is visible
|
|
111
|
-
|
|
112
|
-
def test_search_page(self):
|
|
113
|
-
# Case 3. Fill in Search field with search key word, assert result in search result page.
|
|
114
|
-
self.act.get_page('/') # Go to root page
|
|
115
|
-
self.act.fill_field('//input[@name="q"]', 'python') # Fill search field
|
|
116
|
-
self.act.click('//button[@id="submit"]') # Click Search button
|
|
117
|
-
self.act.assertions.see_in_url(
|
|
118
|
-
'/search/?q=python') # See in URL that we are redirected to search result page
|
|
119
|
-
self.act.assertions.see_text('Results') # Assert visible Results text
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if __name__ == '__main__':
|
|
123
|
-
unittest.main()
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
Now run our script:
|
|
127
|
-
```shell
|
|
128
|
-
python3 test_first.py
|
|
129
|
-
```
|
|
130
|
-
### Results
|
|
131
|
-
If you are running your Selenium Server locally - you can see how script interact with browser in real time. But in any
|
|
132
|
-
case you should have terminal output similar to this, due to LOGGER_LEVEL=INFO:
|
|
133
|
-
```text
|
|
134
|
-
[2022-11-02 16:34:26,452: INFO] Creating remote session.
|
|
135
|
-
Command executor: http://127.0.0.1:4444/wd/hub
|
|
136
|
-
Browser: firefox
|
|
137
|
-
[2022-11-02 16:34:26,452: INFO] Setting default browser options: firefox
|
|
138
|
-
[2022-11-02 16:34:27,890: INFO] Getting page: /
|
|
139
|
-
[2022-11-02 16:34:33,942: INFO] Assert: see string Python in current page title
|
|
140
|
-
[2022-11-02 16:34:33,956: INFO] Scrolling to element: //h2[text()="Success Stories"]
|
|
141
|
-
[2022-11-02 16:34:33,956: INFO] Execute JS script: arguments[0].scrollIntoView({block: "center"}) with arguments: <selenium.webdriver.remote.webelement.WebElement (session="3c63a627-1ffd-40ed-b008-78e671d82085", element="703e049a-3ab4-4bd5-814a-bb38dd64864a")>
|
|
142
|
-
[2022-11-02 16:34:33,980: INFO] Waiting for element with selector: //input[@name="q"] - to be visible.
|
|
143
|
-
[2022-11-02 16:34:33,991: INFO] Filling field: //input[@name="q"] with value: python
|
|
144
|
-
[2022-11-02 16:34:34,012: INFO] Waiting for element with selector: //button[@id="submit"] - to be visible.
|
|
145
|
-
[2022-11-02 16:34:34,026: INFO] Clicking on element: //button[@id="submit"]
|
|
146
|
-
[2022-11-02 16:34:34,411: INFO] Assert: see string /search/?q=python in current page URL
|
|
147
|
-
[2022-11-02 16:34:34,434: INFO] Quits the driver and closes every associated window
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
Congrats! You successfully created your first testing script using Vigilant Kit :)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# How to install Selenium Server & browser drivers
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
## Option 1: Run Selenium server + browser driver locally
|
|
5
|
-
### 1. Install Selenium server
|
|
6
|
-
Selenium server is simply a jar file. To install (download) it, just run this command in the root directory
|
|
7
|
-
of your project or root directory of your tests
|
|
8
|
-
```shell
|
|
9
|
-
mkdir selenium-server && cd selenium && wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.6.0/selenium-server-4.6.0.jar && cd -
|
|
10
|
-
```
|
|
11
|
-
### 2. Install browser driver
|
|
12
|
-
You will also need to download Selenium driver for the browser where you want to execute the tests. This driver is used
|
|
13
|
-
by Selenium server to start the browser of your choice - see following table for the most common browsers:
|
|
14
|
-
|
|
15
|
-
| Browser | Driver | Download link |
|
|
16
|
-
|---------|---------------------|-----------------------------------------------------------------------------------|
|
|
17
|
-
| Firefox | Geckodriver | [Download](https://github.com/mozilla/geckodriver/releases) |
|
|
18
|
-
| Chrome | Chromedriver | [Download](https://sites.google.com/a/chromium.org/chromedriver/downloads) |
|
|
19
|
-
| MS Edge | Microsoft WebDriver | [Download](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/) |
|
|
20
|
-
|
|
21
|
-
Download the browser driver and place the binary file (like geckodriver or chromedriver) to the `selenium-server/`
|
|
22
|
-
directory (where our selenium standalone server is located).
|
|
23
|
-
You can also place the file elsewhere, but then you must pass the path to the Selenium server, but as for me, it is easier
|
|
24
|
-
to have server and driver binaries in one place.
|
|
25
|
-
|
|
26
|
-
### 3. Start Selenium server
|
|
27
|
-
To start the Selenium server listening for incoming connections simply run:
|
|
28
|
-
```shell
|
|
29
|
-
java -jar selenium-server/selenium-server-4.6.0.jar
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Option 2: Start Selenium server + browser inside Docker
|
|
33
|
-
***
|
|
34
|
-
If you don't want to install and run Selenium server and the browser locally, you can run both of them in a Docker
|
|
35
|
-
container. The Selenium project provides many prepared official containers.
|
|
36
|
-
For example to start a container with Selenium server and Firefox, simply run:
|
|
37
|
-
```shell
|
|
38
|
-
docker run -d -p 4446:4444 -p 7902:7900 --shm-size="2g" selenium/standalone-firefox:4.6.0-20221104
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
For more info about available options check official [Docker Selenium](https://github.com/SeleniumHQ/docker-selenium) page.
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# How to start testing with `unittest` library
|
|
2
|
-
|
|
3
|
-
If you are not already familiar with the basic concepts of testing, you might want to read this tutorial:
|
|
4
|
-
[unittest](https://docs.python.org/3/library/unittest.html)
|
|
5
|
-
|
|
6
|
-
Example using `unittest` library.
|
|
7
|
-
```python
|
|
8
|
-
import unittest
|
|
9
|
-
|
|
10
|
-
from vigilant.driver.vigilant_driver import VigilantDriver
|
|
11
|
-
from selenium.webdriver.firefox.options import Options
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class TestHomePage(unittest.TestCase):
|
|
15
|
-
|
|
16
|
-
@classmethod
|
|
17
|
-
def setUpClass(cls) -> None:
|
|
18
|
-
cls.act = VigilantDriver()
|
|
19
|
-
|
|
20
|
-
@classmethod
|
|
21
|
-
def tearDownClass(cls) -> None:
|
|
22
|
-
cls.act.quit()
|
|
23
|
-
|
|
24
|
-
def test_home_page(self):
|
|
25
|
-
# Case 1. Go to some page and assert page title
|
|
26
|
-
self.act.get_page('/') # Go to root page
|
|
27
|
-
self.act.assertions.see_in_title('Python') # Assert that page title contains 'Python' string
|
|
28
|
-
|
|
29
|
-
def test_text_block(self):
|
|
30
|
-
# Case 2. Scroll to some block and assert visible text
|
|
31
|
-
self.act.get_page('/') # Go to root page
|
|
32
|
-
self.act.scroll_to('//h2[text()="Success Stories"]') # Scroll to Success Stories block
|
|
33
|
-
self.act.assertions.see_text('Success Stories') # Assert that Success Stories string is visible
|
|
34
|
-
|
|
35
|
-
def test_search_page(self):
|
|
36
|
-
# Case 3. Fill in Search field with search key word, assert result in search result page.
|
|
37
|
-
self.act.get_page('/') # Go to root page
|
|
38
|
-
self.act.fill_field('//input[@name="q"]', 'python') # Fill search field
|
|
39
|
-
self.act.click('//button[@id="submit"]') # Click Search button
|
|
40
|
-
self.act.assertions.see_in_url(
|
|
41
|
-
'/search/?q=python') # See in URL that we are redirected to search result page
|
|
42
|
-
self.act.assertions.see_text('Results') # Assert visible Results text
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if __name__ == '__main__':
|
|
46
|
-
unittest.main()
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|