You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains the example code for the Playwright workshop
4
+
for [TAU: The Homecoming](https://applitools.com/tau-homecoming/)
5
+
on December 1, 2021.
6
+
The workshop will be done in [Python](python.org).
4
7
8
+
This README contains full instructions for the workshop.
9
+
That way, you can still code along to learn Playwright even if you miss the main event!
5
10
6
-
## Workshop outline
7
11
8
-
1. Getting Started
12
+
## Workshop details
13
+
14
+
This section contains information about the workshop.
15
+
16
+
17
+
### Abstract
18
+
19
+
[Playwright](https://playwright.dev/python/)
20
+
is a hot new browser automation tool from Microsoft.
21
+
With bindings for .NET, Java, JavaScript, and Python, it’s a strong alternative to Selenium WebDriver for end-to-end web app testing.
22
+
23
+
This workshop will be an introduction to Playwright using [Python](python.org).
24
+
We will automate a test scenario together that performs a [DuckDuckGo](https://duckduckgo.com/) search.
25
+
As we code along the test together, we will learn:
26
+
27
+
* How to install and configure Playwright
28
+
* How to integrate Playwright with [pytest](pytest.org), Python’s leading test framework
29
+
* How to perform interactions through page objects
30
+
* How to conveniently run different browsers, capture videos, and run tests in parallel
31
+
32
+
Come prepared with Python 3.7 or higher installed on your machine.
33
+
By the end of the workshop, you will have a solid foundation in Playwright as well as a Python project you can extend with new tests!
34
+
35
+
36
+
### Prerequisites
37
+
38
+
To code along with this workshop, your machine must have Python 3.7 or higher.
39
+
You should also have a decent Python editor like
40
+
[Visual Studio Code](https://code.visualstudio.com/docs/languages/python)
41
+
or [PyCharm](https://www.jetbrains.com/pycharm/).
42
+
43
+
The command line shown in examples below is [bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)).
44
+
If you are using a different shell or a Windows command line, some commands may need to be different.
45
+
46
+
47
+
### Agenda
48
+
49
+
This workshop has five main parts:
50
+
51
+
1. Getting started
9
52
1. What is Playwright?
10
53
2. Our web search test
11
-
3. Installations
12
-
4. Test project setup
54
+
3. Test project setup
13
55
2. First steps with Playwright
56
+
1. Raw Playwright calls
14
57
3. Refactoring using page objects
58
+
1. The search page
15
59
4. Writing assertions
16
60
1. Checking the search field
17
61
2. Checking the result links
@@ -22,19 +66,212 @@ The Playwright Workshop for TAU: The Homecoming
22
66
3. Running tests in parallel
23
67
24
68
25
-
## Part 1: Getting started
69
+
### Example code branches
70
+
71
+
Each part has a corresponding branch in this repository containing the part's example code.
72
+
The branches allow you to check your progress at any point during the workshop.
73
+
The branch names are:
74
+
75
+
| Part | Branch |
76
+
| ------ | ------------------- |
77
+
| Start | 0-initial-project |
78
+
| Part 1 | 1-getting-started |
79
+
| Part 2 | 2-raw-playwright |
80
+
| Part 3 | 3-page-objects |
81
+
| Part 4 | 4-assertions |
82
+
| Part 5 | 5-playwright-tricks |
83
+
84
+
85
+
## Workshop parts
86
+
87
+
This section contains the instructions for completing the workshop.
88
+
You can code along with them either during the live workshop event or afterwards on your own.
89
+
90
+
91
+
### Part 1: Getting started
92
+
93
+
94
+
#### What is Playwright?
95
+
96
+
[Playwright](https://playwright.dev/python/) is a new library that can automate interactions with Chromium, Firefox, and WebKit browsers via a single API.
97
+
It is an open source project developed by Microsoft.
98
+
99
+
Playwright is a fantastic alternative to [Selenium WebDriver](https://www.selenium.dev/) for web UI testing.
100
+
Like Selenium WebDriver, Playwright has language bindings in multiple languages: Python, .NET, Java, and JavaScript.
101
+
Playwright also refines many of the pain points in Selenium WebDriver.
102
+
Some examples include:
103
+
104
+
* Playwright interactions automatically wait for elements to be ready.
105
+
* Playwright can use one browser instance with multiple browser contexts for isolation instead of requiring multiple instances.
106
+
* Playwright has device emulation for testing responsive web apps in mobile browsers.
0 commit comments