1
1
# Part 1: Getting started
2
2
3
- Part 1 of the workshop explains how to set up a Python test automation project with pytest and Playwright.
3
+ Part 1 of the tutorial explains how to set up a Python test automation project with pytest and Playwright.
4
4
5
5
6
6
## What is Playwright?
@@ -24,7 +24,7 @@ from the docs.
24
24
25
25
## Our web search test
26
26
27
- For this workshop , we will walk through one test scenario for DuckDuckGo searching.
27
+ For this tutorial , we will walk through one test scenario for DuckDuckGo searching.
28
28
[ DuckDuckGo] ( https://duckduckgo.com/ ) is a search engine like Google or Yahoo.
29
29
30
30
The steps for a basic DuckDuckGo search are:
@@ -46,14 +46,14 @@ It is also important to try a test manually before attempting to automate it.
46
46
## Test project setup
47
47
48
48
Let's set up the test project!
49
- For this workshop , we will build a new project from the ground up.
49
+ For this tutorial , we will build a new project from the ground up.
50
50
The GitHub repository should be used exclusively as a reference for example code.
51
51
52
- Create a directory named ` tau- playwright-workshop ` for the project:
52
+ Create a directory named ` playwright-python-tutorial ` for the project:
53
53
54
54
``` bash
55
- $ mkdir tau- playwright-workshop
56
- $ cd tau- playwright-workshop
55
+ $ mkdir playwright-python-tutorial
56
+ $ cd playwright-python-tutorial
57
57
```
58
58
59
59
Inside this project, create a [ Python virtual environment] ( https://docs.python.org/3/tutorial/venv.html )
@@ -72,7 +72,7 @@ Python has two incompatible major versions: 2 and 3.
72
72
Although Python 2 end-of-life was January 1, 2020, many machines still run it.
73
73
For example, macOS comes bundled with Python 2.7.18.
74
74
Sometimes, the ` python ` executable may point to Python 2 instead of 3.
75
- To be precise about versions and executables, we will use the ` python3 ` and ` pip3 ` commands explicitly in this workshop .
75
+ To be precise about versions and executables, we will use the ` python3 ` and ` pip3 ` commands explicitly in this tutorial .
76
76
77
77
After creating a virtual environment, you must "activate" it.
78
78
On macOS or Linux, use the following command:
@@ -97,6 +97,11 @@ $ pip3 install pytest
97
97
$ pip3 install pytest-playwright
98
98
```
99
99
100
+ > If you want to run the tests from this repository instead of creating a fresh project,
101
+ > install the dependencies from the ` requirements.txt ` file using this command:
102
+ >
103
+ > ` $ pip3 install -r requirements.txt `
104
+
100
105
By itself, Playwright is simply a library for browser automation.
101
106
We need a test framework like pytest if we want to automate tests.
102
107
The [ ` pytest-playwright ` ] ( https://playwright.dev/python/docs/test-runners )
@@ -114,18 +119,19 @@ greenlet==1.1.2
114
119
idna==3.3
115
120
iniconfig==1.1.1
116
121
packaging==21.3
117
- playwright==1.17.0
122
+ playwright==1.19.1
118
123
pluggy==1.0.0
119
124
py==1.11.0
120
- pyee==8.2.2
125
+ pyee==8.1.0
121
126
pyparsing==3.0.6
122
- pytest==6.2.5
127
+ pytest==7.0.1
123
128
pytest-base-url==1.4.2
124
- pytest-playwright==0.2.2
129
+ pytest-playwright==0.2.3
125
130
python-slugify==5.0.2
126
131
requests==2.26.0
127
132
text-unidecode==1.3
128
133
toml==0.10.2
134
+ tomli==2.0.1
129
135
urllib3==1.26.7
130
136
websockets==10.1
131
137
```
0 commit comments