Skip to content

Commit b868111

Browse files
committed
Experimenting fixtures in pytest.
1 parent ed89a76 commit b868111

File tree

6 files changed

+226
-9
lines changed

6 files changed

+226
-9
lines changed
File renamed without changes.

Pytest_Framework/geckodriver.log

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
1732014463779 geckodriver INFO Listening on 127.0.0.1:57722
2+
1732014466867 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "57723" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofileUjdbhv"
3+
console.warn: services.settings: Ignoring preference override of remote settings server
4+
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
5+
Dynamically enable window occlusion 0
6+
1732014467730 Marionette INFO Marionette enabled
7+
1732014467914 Marionette INFO Listening on port 57731
8+
WebDriver BiDi listening on ws://127.0.0.1:57723
9+
Read port: 57731
10+
1732014468162 RemoteAgent WARN TLS certificate errors will be ignored for this session
11+
1732014506346 Marionette INFO Stopped listening on port 57731
12+
Dynamically enable window occlusion 1
13+
1732014632191 geckodriver INFO Listening on 127.0.0.1:57757
14+
1732014635235 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "57758" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofileiBlwlZ"
15+
console.warn: services.settings: Ignoring preference override of remote settings server
16+
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
17+
Dynamically enable window occlusion 0
18+
1732014635632 Marionette INFO Marionette enabled
19+
1732014635774 Marionette INFO Listening on port 57765
20+
WebDriver BiDi listening on ws://127.0.0.1:57758
21+
Read port: 57765
22+
1732014635978 RemoteAgent WARN TLS certificate errors will be ignored for this session
23+
JavaScript warning: https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG, line 184: Script terminated by timeout at:
24+
ib@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:184:159
25+
fB@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:135
26+
gB/<@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:111
27+
28+
1732014648707 Marionette INFO Stopped listening on port 57765
29+
Dynamically enable window occlusion 1
30+
1732014730828 geckodriver INFO Listening on 127.0.0.1:57803
31+
1732014733913 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "57804" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofile9vIPi2"
32+
console.warn: services.settings: Ignoring preference override of remote settings server
33+
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
34+
Dynamically enable window occlusion 0
35+
1732014734325 Marionette INFO Marionette enabled
36+
1732014734489 Marionette INFO Listening on port 57811
37+
WebDriver BiDi listening on ws://127.0.0.1:57804
38+
Read port: 57811
39+
1732014734690 RemoteAgent WARN TLS certificate errors will be ignored for this session
40+
JavaScript warning: https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG, line 184: Script terminated by timeout at:
41+
ib@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:184:159
42+
fB@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:135
43+
gB/<@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:111
44+
45+
1732014773036 Marionette INFO Stopped listening on port 57811
46+
Dynamically enable window occlusion 1
47+
1732014779327 geckodriver INFO Listening on 127.0.0.1:57846
48+
1732014782378 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "57847" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofileRSBMjF"
49+
console.warn: services.settings: Ignoring preference override of remote settings server
50+
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
51+
Dynamically enable window occlusion 0
52+
1732014782752 Marionette INFO Marionette enabled
53+
1732014782950 Marionette INFO Listening on port 57854
54+
WebDriver BiDi listening on ws://127.0.0.1:57847
55+
Read port: 57854
56+
1732014783125 RemoteAgent WARN TLS certificate errors will be ignored for this session
57+
1732014790592 Marionette INFO Stopped listening on port 57854
58+
JavaScript warning: https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js, line 655: Script terminated by timeout at:
59+
B4@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:655:383
60+
E<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:126:43
61+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:159:492
62+
K</R<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:155:519
63+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:154:314
64+
C</this.next@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:369:57
65+
K</O<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:157:487
66+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:157:380
67+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:147:252
68+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:155:482
69+
E</A<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:103:86
70+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:154:314
71+
C</this.next@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:369:57
72+
K</O<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:157:487
73+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:157:380
74+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:147:252
75+
E<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:102:465
76+
g</f<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:490:51
77+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:154:314
78+
C</this.next@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:369:57
79+
K</O<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:157:487
80+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:157:380
81+
K<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:147:252
82+
g<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:489:457
83+
v</v<@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:568:446
84+
Za@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:748:59
85+
D@https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js:504:103
86+
87+
Dynamically enable window occlusion 1
88+
1732014811826 geckodriver INFO Listening on 127.0.0.1:57884
89+
1732014814903 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "57885" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofileagWLzQ"
90+
console.warn: services.settings: Ignoring preference override of remote settings server
91+
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
92+
Dynamically enable window occlusion 0
93+
1732014815328 Marionette INFO Marionette enabled
94+
1732014815470 Marionette INFO Listening on port 57892
95+
WebDriver BiDi listening on ws://127.0.0.1:57885
96+
Read port: 57892
97+
1732014815667 RemoteAgent WARN TLS certificate errors will be ignored for this session
98+
JavaScript warning: https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG, line 184: Script terminated by timeout at:
99+
ib@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:184:159
100+
fB@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:135
101+
gB/<@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:111
102+
103+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
104+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
105+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
106+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
107+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
108+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
109+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
110+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
111+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
112+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
113+
JavaScript error: resource://gre/modules/AsyncShutdown.sys.mjs, line 569: NotFoundError: No such JSProcessActor 'DevToolsProcess'
114+
1732014876791 Marionette INFO Stopped listening on port 57892
115+
Dynamically enable window occlusion 1
116+
console.error: "Error in worker resource://devtools/client/shared/source-map-loader/worker.js" ": "
117+
1732014960939 geckodriver INFO Listening on 127.0.0.1:57936
118+
1732014963983 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "57937" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofilelm0yvg"
119+
console.warn: services.settings: Ignoring preference override of remote settings server
120+
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
121+
Dynamically enable window occlusion 0
122+
1732014964404 Marionette INFO Marionette enabled
123+
1732014964554 Marionette INFO Listening on port 57944
124+
WebDriver BiDi listening on ws://127.0.0.1:57937
125+
Read port: 57944
126+
1732014964749 RemoteAgent WARN TLS certificate errors will be ignored for this session
127+
JavaScript warning: https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG, line 184: Script terminated by timeout at:
128+
ib@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:184:159
129+
fB@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:135
130+
gB/<@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:111
131+
132+
1732014981737 Marionette INFO Stopped listening on port 57944
133+
Dynamically enable window occlusion 1
134+
1732015457062 geckodriver INFO Listening on 127.0.0.1:58007
135+
1732015460125 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "58008" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofileJx86Au"
136+
console.warn: services.settings: Ignoring preference override of remote settings server
137+
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
138+
Dynamically enable window occlusion 0
139+
1732015460524 Marionette INFO Marionette enabled
140+
1732015460668 Marionette INFO Listening on port 58015
141+
WebDriver BiDi listening on ws://127.0.0.1:58008
142+
Read port: 58015
143+
1732015460870 RemoteAgent WARN TLS certificate errors will be ignored for this session
144+
JavaScript warning: https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG, line 184: Script terminated by timeout at:
145+
ib@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:184:159
146+
fB@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:135
147+
gB/<@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:584:111
148+
149+
1732015503437 Marionette INFO Stopped listening on port 58015
150+
Dynamically enable window occlusion 1

Pytest_Framework/test_deleteme.py

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
Using fixtures in plain way
3+
"""
4+
import pytest
5+
from selenium import webdriver
6+
from selenium.webdriver.common.by import By
7+
8+
fDriver = webdriver.Firefox()
9+
10+
11+
@pytest.fixture()
12+
def setup():
13+
print('Start Setup')
14+
# Firefox webdriver for herokuapp site
15+
fDriver.get('https://www.ggeorgiou.gr/')
16+
17+
yield # commands executed after the main test
18+
print(' End Setup')
19+
20+
21+
def test_search_wordpress_term(setup):
22+
fDriver.find_element(By.XPATH, "//input[@id='s']").send_keys('wordpress')
23+
fDriver.find_element(By.XPATH, "//span[@class='ignition-icons ignition-icons-search']").click()
24+
25+
26+
def test_search_wordpress_html(setup):
27+
fDriver.find_element(By.XPATH, "//input[@id='s']").send_keys('html')
28+
fDriver.find_element(By.XPATH, "//span[@class='ignition-icons ignition-icons-search']").click()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
Using fixtures by using class
3+
"""
4+
import pytest
5+
from selenium import webdriver
6+
from selenium.webdriver.common.by import By
7+
8+
fDriver = webdriver.Firefox()
9+
10+
11+
@pytest.fixture()
12+
def setup():
13+
print('Start Setup')
14+
# Firefox webdriver for herokuapp site
15+
fDriver.get('https://www.ggeorgiou.gr/')
16+
17+
yield # commands executed after the main test
18+
print(' End Setup')
19+
20+
21+
@pytest.mark.usefixtures("setup")
22+
class Test_GG_Site:
23+
24+
def test_search_wordpress_term(self):
25+
fDriver.find_element(By.XPATH, "//input[@id='s']").send_keys('wordpress')
26+
fDriver.find_element(By.XPATH, "//span[@class='ignition-icons ignition-icons-search']").click()
27+
28+
def test_search_wordpress_html(self):
29+
fDriver.find_element(By.XPATH, "//input[@id='s']").send_keys('html')
30+
fDriver.find_element(By.XPATH, "//span[@class='ignition-icons ignition-icons-search']").click()

Pytest_temp/test_temp.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
import pytest
22

33

4-
def test_SayHello():
5-
print('Hello there')
4+
# Simple fixture
5+
@pytest.fixture()
6+
def setup():
7+
print('I will be executed first')
8+
yield
9+
print('I will executed last')
610

711

8-
# @pytest.Mark.smoke # ToDo - Mark method does not have smoke and other attributes. Study pytest.
9-
def test_bool():
10-
assert 4>3
12+
@pytest.mark.usefixtures("setup")
13+
class TestExample:
1114

15+
def test_fixtureDemo(self):
16+
print("i will execute steps in fixtureDemo method")
1217

13-
def test_book2():
14-
assert -1<1
18+
def test_fixtureDemo1(self):
19+
print("i will execute steps in fixtureDemo1 method")
20+
21+
def test_fixtureDemo2(self):
22+
print("i will execute steps in fixtureDemo2 method")
23+
24+
def test_fixtureDemo3(self):
25+
print("i will execute steps in fixtureDemo3 method")

0 commit comments

Comments
 (0)