Skip to content

Commit 264fc57

Browse files
committed
Conftest file and fixtures
1 parent 794ad3d commit 264fc57

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

Pytest_Framework/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import pytest
22
from selenium import webdriver
33

4-
@pytest.fixture(scope="class") # Χρησιμοποιούμε το scope "class" για να χρησιμοποιείται εντός class
5-
def setup(request): # Εδώ διαχειριζόμαστε το driver
4+
@pytest.fixture(scope="class") # Use the "class" scope for usage into a class
5+
def setup(request): # We operate driver
66
print('Start Setup')
77
driver = webdriver.Firefox()
88
driver.get('https://www.ggeorgiou.gr/')
99

10-
# Μοιράζουμε τον driver στα tests
10+
# Sharing driver in tests
1111
request.cls.driver = driver
1212

1313
yield driver

Pytest_Framework/geckodriver.log

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,15 @@ JavaScript error: , line 0: NotFoundError: No such JSProcessActor 'DevToolsProce
264264
JavaScript error: , line 0: NotFoundError: No such JSProcessActor 'DevToolsProcess'
265265
JavaScript error: , line 0: NotFoundError: No such JSProcessActor 'DevToolsProcess'
266266
JavaScript error: , line 0: NS_ERROR_NOT_AVAILABLE
267-
1:51767
268-
1732786965412 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "51768" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofileJt2VgO"
269-
console.warn: services.settings: Ignoring preference override of remote settings server
270-
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
271-
Dynamically enable window occlusion 0
267+
JavaScript error: , line 0: NS_ERROR_NOT_AVAILABLE
268+
JavaScript warning: https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG, line 184: Script terminated by timeout at:
269+
ib@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:184:159
270+
gB@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:594:135
271+
hB/<@https://www.googletagmanager.com/gtag/js?id=G-E423JL13RG:594:111
272+
273+
1732896465278 Marionette INFO Stopped listening on port 51653
274+
Dynamically enable window occlusion 1
275+
le window occlusion 0
272276
1732786965855 Marionette INFO Marionette enabled
273277
1732786965993 Marionette INFO Listening on port 51775
274278
WebDriver BiDi listening on ws://127.0.0.1:51768
@@ -419,3 +423,18 @@ JavaScript warning: https://www.gstatic.com/recaptcha/releases/pPK749sccDmVW_9DS
419423
p</N</Y.U.onmessage@https://www.gstatic.com/recaptcha/releases/pPK749sccDmVW_9DSeTMVvh2/recaptcha__en.js:171:131
420424

421425
Dynamically enable window occlusion 1
426+
1733323285058 geckodriver INFO Listening on 127.0.0.1:50576
427+
1733323288116 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "50577" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\HP\\AppData\\Local\\Temp\\rust_mozprofilekYL3mF"
428+
console.warn: services.settings: Ignoring preference override of remote settings server
429+
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
430+
Dynamically enable window occlusion 0
431+
1733323288932 Marionette INFO Marionette enabled
432+
1733323289105 Marionette INFO Listening on port 50585
433+
WebDriver BiDi listening on ws://127.0.0.1:50577
434+
Read port: 50585
435+
1733323289340 RemoteAgent WARN TLS certificate errors will be ignored for this session
436+
1733323305082 Marionette INFO Stopped listening on port 50585
437+
JavaScript warning: https://www.gstatic.com/recaptcha/releases/pPK749sccDmVW_9DSeTMVvh2/recaptcha__en.js, line 171: Script terminated by timeout at:
438+
p</N</Y.U.onmessage@https://www.gstatic.com/recaptcha/releases/pPK749sccDmVW_9DSeTMVvh2/recaptcha__en.js:171:131
439+
440+
Dynamically enable window occlusion 1
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
"""
2-
Using fixtures in a plain way
2+
Using fixtures by using class
33
"""
44
import pytest
55
from selenium.webdriver.common.by import By
66

7-
@pytest.mark.usefixtures("setup") # Ενημερώνουμε ότι το fixture θα χρησιμοποιηθεί από την κλάση
7+
8+
@pytest.mark.usefixtures("setup") # Fixture name "setu" will be used from the class.
89
class Test_GG_Site:
910

10-
def test_search_term__wordpress(self): # Το "setup" είναι το fixture
11+
def test_search_term__wordpress(self):
1112
self.driver.find_element(By.XPATH, "//input[@id='s']").send_keys('wordpress')
1213
self.driver.find_element(By.XPATH, "//span[@class='ignition-icons ignition-icons-search']").click()
1314

14-
1515
def test_search_term__seo(self):
1616
self.driver.find_element(By.XPATH, "//input[@id='s']").send_keys('seo')
1717
self.driver.find_element(By.XPATH, "//span[@class='ignition-icons ignition-icons-search']").click()

Pytest_Framework/test_ggeorgiougr_site2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import pytest
55
from selenium.webdriver.common.by import By
66

7-
@pytest.mark.usefixtures("setup") # Ενημερώνουμε ότι το fixture θα χρησιμοποιηθεί από την κλάση
7+
8+
@pytest.mark.usefixtures("setup") # Fixture name "setu" will be used from the class.
89
class Test_GG_Site2:
910

1011
def test_search_term__html(self):

0 commit comments

Comments
 (0)