cloudbeat-selenium 0.0.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.
- cloudbeat_selenium-0.0.1/PKG-INFO +39 -0
- cloudbeat_selenium-0.0.1/README.md +0 -0
- cloudbeat_selenium-0.0.1/cloudbeat_selenium.egg-info/PKG-INFO +39 -0
- cloudbeat_selenium-0.0.1/cloudbeat_selenium.egg-info/SOURCES.txt +9 -0
- cloudbeat_selenium-0.0.1/cloudbeat_selenium.egg-info/dependency_links.txt +1 -0
- cloudbeat_selenium-0.0.1/cloudbeat_selenium.egg-info/requires.txt +3 -0
- cloudbeat_selenium-0.0.1/cloudbeat_selenium.egg-info/top_level.txt +1 -0
- cloudbeat_selenium-0.0.1/setup.cfg +4 -0
- cloudbeat_selenium-0.0.1/setup.py +59 -0
- cloudbeat_selenium-0.0.1/src/listener.py +63 -0
- cloudbeat_selenium-0.0.1/src/wrapper.py +13 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cloudbeat-selenium
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Selenium wrapper for CloudBeat Pytest Kit
|
|
5
|
+
Home-page: https://cloudbeat.io/
|
|
6
|
+
Author: CBNR Cloud Solutions LTD
|
|
7
|
+
Author-email: info@cloudbeat.io
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Project-URL: Source, https://github.com/cloudbeat-io/cb-kit-python
|
|
10
|
+
Keywords: cloudbeat testing reporting python
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Requires-Python: >=3.6
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
Requires-Dist: attrs>=16.0.0
|
|
27
|
+
Requires-Dist: pluggy>=0.4.0
|
|
28
|
+
Requires-Dist: cloudbeat_common>=0.0.1
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: author-email
|
|
31
|
+
Dynamic: classifier
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: home-page
|
|
34
|
+
Dynamic: keywords
|
|
35
|
+
Dynamic: license
|
|
36
|
+
Dynamic: project-url
|
|
37
|
+
Dynamic: requires-dist
|
|
38
|
+
Dynamic: requires-python
|
|
39
|
+
Dynamic: summary
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cloudbeat-selenium
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Selenium wrapper for CloudBeat Pytest Kit
|
|
5
|
+
Home-page: https://cloudbeat.io/
|
|
6
|
+
Author: CBNR Cloud Solutions LTD
|
|
7
|
+
Author-email: info@cloudbeat.io
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Project-URL: Source, https://github.com/cloudbeat-io/cb-kit-python
|
|
10
|
+
Keywords: cloudbeat testing reporting python
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Requires-Python: >=3.6
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
Requires-Dist: attrs>=16.0.0
|
|
27
|
+
Requires-Dist: pluggy>=0.4.0
|
|
28
|
+
Requires-Dist: cloudbeat_common>=0.0.1
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: author-email
|
|
31
|
+
Dynamic: classifier
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: home-page
|
|
34
|
+
Dynamic: keywords
|
|
35
|
+
Dynamic: license
|
|
36
|
+
Dynamic: project-url
|
|
37
|
+
Dynamic: requires-dist
|
|
38
|
+
Dynamic: requires-python
|
|
39
|
+
Dynamic: summary
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
cloudbeat_selenium.egg-info/PKG-INFO
|
|
4
|
+
cloudbeat_selenium.egg-info/SOURCES.txt
|
|
5
|
+
cloudbeat_selenium.egg-info/dependency_links.txt
|
|
6
|
+
cloudbeat_selenium.egg-info/requires.txt
|
|
7
|
+
cloudbeat_selenium.egg-info/top_level.txt
|
|
8
|
+
src/listener.py
|
|
9
|
+
src/wrapper.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cloudbeat_selenium
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
|
|
4
|
+
PACKAGE = "cloudbeat-selenium"
|
|
5
|
+
|
|
6
|
+
classifiers = [
|
|
7
|
+
'Development Status :: 5 - Production/Stable',
|
|
8
|
+
'Intended Audience :: Developers',
|
|
9
|
+
'License :: OSI Approved :: Apache Software License',
|
|
10
|
+
'Topic :: Software Development :: Quality Assurance',
|
|
11
|
+
'Topic :: Software Development :: Testing',
|
|
12
|
+
'Programming Language :: Python :: 3',
|
|
13
|
+
'Programming Language :: Python :: 3 :: Only',
|
|
14
|
+
'Programming Language :: Python :: 3.7',
|
|
15
|
+
'Programming Language :: Python :: 3.8',
|
|
16
|
+
'Programming Language :: Python :: 3.9',
|
|
17
|
+
'Programming Language :: Python :: 3.10',
|
|
18
|
+
'Programming Language :: Python :: 3.11',
|
|
19
|
+
'Programming Language :: Python :: 3.12',
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
install_requires = [
|
|
23
|
+
"attrs>=16.0.0",
|
|
24
|
+
"pluggy>=0.4.0",
|
|
25
|
+
"cloudbeat_common>=0.0.1"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
def get_readme(fname):
|
|
29
|
+
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
|
30
|
+
|
|
31
|
+
def main():
|
|
32
|
+
setup(
|
|
33
|
+
name=PACKAGE,
|
|
34
|
+
version="0.0.1", # Hardcoded version here
|
|
35
|
+
description="Selenium wrapper for CloudBeat Pytest Kit",
|
|
36
|
+
url="https://cloudbeat.io/",
|
|
37
|
+
project_urls={
|
|
38
|
+
"Source": "https://github.com/cloudbeat-io/cb-kit-python",
|
|
39
|
+
},
|
|
40
|
+
author="CBNR Cloud Solutions LTD",
|
|
41
|
+
author_email="info@cloudbeat.io",
|
|
42
|
+
license="Apache-2.0",
|
|
43
|
+
classifiers=classifiers,
|
|
44
|
+
keywords="cloudbeat testing reporting python",
|
|
45
|
+
# long_description=get_readme("README.md"),
|
|
46
|
+
long_description_content_type="text/markdown",
|
|
47
|
+
packages=["cloudbeat_selenium"],
|
|
48
|
+
package_dir={"cloudbeat_selenium": 'src'},
|
|
49
|
+
install_requires=install_requires,
|
|
50
|
+
py_modules=['cloudbeat_selenium'],
|
|
51
|
+
python_requires='>=3.6',
|
|
52
|
+
|
|
53
|
+
# COMMENTED OUT OLD CODE
|
|
54
|
+
# use_scm_version={"root": "..", "relative_to": __file__},
|
|
55
|
+
# setup_requires=['setuptools_scm'],
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
if __name__ == '__main__':
|
|
59
|
+
main()
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from cloudbeat_common.reporter import CbTestReporter
|
|
2
|
+
from selenium.webdriver.support.events import EventFiringWebDriver, AbstractEventListener
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# CloudBeat implementation of AbstractEventListener
|
|
6
|
+
class CbWebDriverListener(AbstractEventListener):
|
|
7
|
+
def __init__(self, reporter: CbTestReporter):
|
|
8
|
+
self._reporter = reporter
|
|
9
|
+
|
|
10
|
+
def before_navigate_to(self, url, driver):
|
|
11
|
+
self._reporter.start_step(f"Navigate to \"{url}\"")
|
|
12
|
+
|
|
13
|
+
def after_navigate_to(self, url, driver):
|
|
14
|
+
self._reporter.end_step()
|
|
15
|
+
|
|
16
|
+
def before_click(self, element, driver):
|
|
17
|
+
self._reporter.start_step(f"Click on {get_element_label(element)}")
|
|
18
|
+
|
|
19
|
+
def after_click(self, element, driver):
|
|
20
|
+
self._reporter.end_step()
|
|
21
|
+
|
|
22
|
+
# def before_send_keys(self, element, value, driver):
|
|
23
|
+
# self._reporter.start_step(f"Type {value} on {get_element_label(element)}")
|
|
24
|
+
|
|
25
|
+
# def after_send_keys(self, element, driver):
|
|
26
|
+
# self._reporter.end_step()
|
|
27
|
+
|
|
28
|
+
def before_find(self, by, value, driver) -> None:
|
|
29
|
+
self._reporter.start_step(f"Find element by {by.upper()} \"{value}\"")
|
|
30
|
+
|
|
31
|
+
def after_find(self, by, value, driver) -> None:
|
|
32
|
+
self._reporter.end_step()
|
|
33
|
+
|
|
34
|
+
def before_change_value_of(self, element, driver) -> None:
|
|
35
|
+
self._reporter.start_step(f"Set value of {get_element_label(element)}")
|
|
36
|
+
|
|
37
|
+
def after_change_value_of(self, element, driver) -> None:
|
|
38
|
+
self._reporter.end_step()
|
|
39
|
+
|
|
40
|
+
def get_element_label(element):
|
|
41
|
+
if element is None:
|
|
42
|
+
return ""
|
|
43
|
+
elm_text = element.text
|
|
44
|
+
tag_name = element.tag_name
|
|
45
|
+
elm_type = element.get_attribute("type")
|
|
46
|
+
label = ""
|
|
47
|
+
if tag_name == "a":
|
|
48
|
+
label = "link "
|
|
49
|
+
elif tag_name == "button":
|
|
50
|
+
label = "button "
|
|
51
|
+
elif tag_name == "option":
|
|
52
|
+
label = "option "
|
|
53
|
+
elif tag_name == "label":
|
|
54
|
+
label = "label "
|
|
55
|
+
elif tag_name == "input" and (elm_type == "button" or elm_type == "submit"):
|
|
56
|
+
label = "button "
|
|
57
|
+
elif tag_name == "input" and elm_type == "link":
|
|
58
|
+
label = "link "
|
|
59
|
+
|
|
60
|
+
if elm_text != "":
|
|
61
|
+
return f"{label} \"{elm_text}\""
|
|
62
|
+
else:
|
|
63
|
+
return f"{label} <{tag_name}>"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from cloudbeat_common.reporter import CbTestReporter
|
|
2
|
+
from selenium import webdriver
|
|
3
|
+
from selenium.webdriver.support.event_firing_webdriver import EventFiringWebDriver
|
|
4
|
+
|
|
5
|
+
from cloudbeat_selenium.listener import CbWebDriverListener
|
|
6
|
+
|
|
7
|
+
class CbSeleniumWrapper:
|
|
8
|
+
def __init__(self, reporter: CbTestReporter):
|
|
9
|
+
self._reporter = reporter
|
|
10
|
+
|
|
11
|
+
def wrap(self, driver: webdriver):
|
|
12
|
+
listener = CbWebDriverListener(self._reporter)
|
|
13
|
+
return EventFiringWebDriver(driver, listener)
|