Skip to content

Commit 16ce7ee

Browse files
committed
Initial test
Setup
1 parent 0fe1f8e commit 16ce7ee

File tree

2,274 files changed

+444885
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,274 files changed

+444885
-0
lines changed
3.07 KB
Binary file not shown.

conftest.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import pytest, logging
2+
from playwright.sync_api import sync_playwright
3+
4+
#This file configures Playwright settings and fixtures:
5+
# Configure logging
6+
7+
logging.basicConfig(level=logging.INFO)
8+
#logger = logging.getLogger(__name__)
9+
10+
11+
# Create a logger
12+
logger = logging.getLogger("pytest")
13+
14+
#usage pytest.logger.info("Test execution started")
15+
16+
# Make the logger available to all tests
17+
def pytest_configure():
18+
# Attach the logger to the pytest namespace
19+
pytest.logger = logger
20+
21+
22+
23+
@pytest.fixture(scope="session")
24+
def browser():
25+
with sync_playwright() as p:
26+
# Launch the browser (Chromium by default)
27+
browser = p.chromium.launch(headless=False)
28+
yield browser
29+
browser.close()
30+
31+
@pytest.fixture
32+
def page(browser):
33+
# Create a new page for each test
34+
page = browser.new_page()
35+
yield page
36+
page.close()
37+
38+
# Shared settings for all tests
39+
@pytest.fixture(autouse=True)
40+
def setup(page):
41+
# Set a base URL (optional)
42+
page.set_default_timeout(10000) # Set default timeout
43+
#page.goto("http://127.0.0.1:3000") # Replace with your base URL
44+
page.goto("https://fakestore.testelka.pl/")
45+
46+
'''Configure Browsers (Optional)
47+
To run tests on multiple browsers (like Chromium, Firefox, and WebKit),
48+
you can parameterize the browser fixture:'''
49+
50+
@pytest.fixture(scope="session", params=["chromium", "firefox", "webkit"])
51+
def browser(request):
52+
with sync_playwright() as p:
53+
# Launch the selected browser
54+
if request.param == "chromium":
55+
browser = p.chromium.launch(headless=False)
56+
elif request.param == "firefox":
57+
browser = p.firefox.launch(headless=False)
58+
elif request.param == "webkit":
59+
browser = p.webkit.launch(headless=False)
60+
yield browser
61+
browser.close()
62+
63+
64+
@pytest.fixture(autouse=True)
65+
def trace_test(page):
66+
# Start tracing
67+
page.context.tracing.start(screenshots=True, snapshots=True)
68+
69+
yield
70+
71+
# Stop tracing and save the trace
72+
page.context.tracing.stop(path="trace.zip")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Metadata-Version: 2.4
2+
Name: fakestoreplaywright
3+
Version: 1.0.0
4+
Summary: Test automation practise:
5+
Author-email: Your Name <your.email@example.com>
6+
License-Expression: ISC
7+
Requires-Python: >=3.8
8+
Requires-Dist: playwright
9+
Requires-Dist: pytest
10+
Requires-Dist: pytest-playwright
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pyproject.toml
2+
fakestoreplaywright.egg-info/PKG-INFO
3+
fakestoreplaywright.egg-info/SOURCES.txt
4+
fakestoreplaywright.egg-info/dependency_links.txt
5+
fakestoreplaywright.egg-info/requires.txt
6+
fakestoreplaywright.egg-info/top_level.txt
7+
tests/test_launch_fakestore.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
playwright
2+
pytest
3+
pytest-playwright
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
playwright
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */
2+
3+
/* Greenlet object interface */
4+
5+
#ifndef Py_GREENLETOBJECT_H
6+
#define Py_GREENLETOBJECT_H
7+
8+
9+
#include <Python.h>
10+
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif
14+
15+
/* This is deprecated and undocumented. It does not change. */
16+
#define GREENLET_VERSION "1.0.0"
17+
18+
#ifndef GREENLET_MODULE
19+
#define implementation_ptr_t void*
20+
#endif
21+
22+
typedef struct _greenlet {
23+
PyObject_HEAD
24+
PyObject* weakreflist;
25+
PyObject* dict;
26+
implementation_ptr_t pimpl;
27+
} PyGreenlet;
28+
29+
#define PyGreenlet_Check(op) (op && PyObject_TypeCheck(op, &PyGreenlet_Type))
30+
31+
32+
/* C API functions */
33+
34+
/* Total number of symbols that are exported */
35+
#define PyGreenlet_API_pointers 12
36+
37+
#define PyGreenlet_Type_NUM 0
38+
#define PyExc_GreenletError_NUM 1
39+
#define PyExc_GreenletExit_NUM 2
40+
41+
#define PyGreenlet_New_NUM 3
42+
#define PyGreenlet_GetCurrent_NUM 4
43+
#define PyGreenlet_Throw_NUM 5
44+
#define PyGreenlet_Switch_NUM 6
45+
#define PyGreenlet_SetParent_NUM 7
46+
47+
#define PyGreenlet_MAIN_NUM 8
48+
#define PyGreenlet_STARTED_NUM 9
49+
#define PyGreenlet_ACTIVE_NUM 10
50+
#define PyGreenlet_GET_PARENT_NUM 11
51+
52+
#ifndef GREENLET_MODULE
53+
/* This section is used by modules that uses the greenlet C API */
54+
static void** _PyGreenlet_API = NULL;
55+
56+
# define PyGreenlet_Type \
57+
(*(PyTypeObject*)_PyGreenlet_API[PyGreenlet_Type_NUM])
58+
59+
# define PyExc_GreenletError \
60+
((PyObject*)_PyGreenlet_API[PyExc_GreenletError_NUM])
61+
62+
# define PyExc_GreenletExit \
63+
((PyObject*)_PyGreenlet_API[PyExc_GreenletExit_NUM])
64+
65+
/*
66+
* PyGreenlet_New(PyObject *args)
67+
*
68+
* greenlet.greenlet(run, parent=None)
69+
*/
70+
# define PyGreenlet_New \
71+
(*(PyGreenlet * (*)(PyObject * run, PyGreenlet * parent)) \
72+
_PyGreenlet_API[PyGreenlet_New_NUM])
73+
74+
/*
75+
* PyGreenlet_GetCurrent(void)
76+
*
77+
* greenlet.getcurrent()
78+
*/
79+
# define PyGreenlet_GetCurrent \
80+
(*(PyGreenlet * (*)(void)) _PyGreenlet_API[PyGreenlet_GetCurrent_NUM])
81+
82+
/*
83+
* PyGreenlet_Throw(
84+
* PyGreenlet *greenlet,
85+
* PyObject *typ,
86+
* PyObject *val,
87+
* PyObject *tb)
88+
*
89+
* g.throw(...)
90+
*/
91+
# define PyGreenlet_Throw \
92+
(*(PyObject * (*)(PyGreenlet * self, \
93+
PyObject * typ, \
94+
PyObject * val, \
95+
PyObject * tb)) \
96+
_PyGreenlet_API[PyGreenlet_Throw_NUM])
97+
98+
/*
99+
* PyGreenlet_Switch(PyGreenlet *greenlet, PyObject *args)
100+
*
101+
* g.switch(*args, **kwargs)
102+
*/
103+
# define PyGreenlet_Switch \
104+
(*(PyObject * \
105+
(*)(PyGreenlet * greenlet, PyObject * args, PyObject * kwargs)) \
106+
_PyGreenlet_API[PyGreenlet_Switch_NUM])
107+
108+
/*
109+
* PyGreenlet_SetParent(PyObject *greenlet, PyObject *new_parent)
110+
*
111+
* g.parent = new_parent
112+
*/
113+
# define PyGreenlet_SetParent \
114+
(*(int (*)(PyGreenlet * greenlet, PyGreenlet * nparent)) \
115+
_PyGreenlet_API[PyGreenlet_SetParent_NUM])
116+
117+
/*
118+
* PyGreenlet_GetParent(PyObject* greenlet)
119+
*
120+
* return greenlet.parent;
121+
*
122+
* This could return NULL even if there is no exception active.
123+
* If it does not return NULL, you are responsible for decrementing the
124+
* reference count.
125+
*/
126+
# define PyGreenlet_GetParent \
127+
(*(PyGreenlet* (*)(PyGreenlet*)) \
128+
_PyGreenlet_API[PyGreenlet_GET_PARENT_NUM])
129+
130+
/*
131+
* deprecated, undocumented alias.
132+
*/
133+
# define PyGreenlet_GET_PARENT PyGreenlet_GetParent
134+
135+
# define PyGreenlet_MAIN \
136+
(*(int (*)(PyGreenlet*)) \
137+
_PyGreenlet_API[PyGreenlet_MAIN_NUM])
138+
139+
# define PyGreenlet_STARTED \
140+
(*(int (*)(PyGreenlet*)) \
141+
_PyGreenlet_API[PyGreenlet_STARTED_NUM])
142+
143+
# define PyGreenlet_ACTIVE \
144+
(*(int (*)(PyGreenlet*)) \
145+
_PyGreenlet_API[PyGreenlet_ACTIVE_NUM])
146+
147+
148+
149+
150+
/* Macro that imports greenlet and initializes C API */
151+
/* NOTE: This has actually moved to ``greenlet._greenlet._C_API``, but we
152+
keep the older definition to be sure older code that might have a copy of
153+
the header still works. */
154+
# define PyGreenlet_Import() \
155+
{ \
156+
_PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \
157+
}
158+
159+
#endif /* GREENLET_MODULE */
160+
161+
#ifdef __cplusplus
162+
}
163+
#endif
164+
#endif /* !Py_GREENLETOBJECT_H */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pip
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright 2010 Pallets
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
3. Neither the name of the copyright holder nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)