We will be using Playwright to build our end-to-end (E2E) test. Playwright is a cross-browser, cross-platform and cross-language tool for creating end-to-end tests for your web browser.
We can write the E2E test files using JavaScript, Python or Java.
Note: Make sure both the frontend and backend app are running (refer to exercise 7 for instructions) before you start the E2E tests.
Note: Remember to delete all the To Do List Items before you run the E2E tests below.
(Pro-Tip: Try restarting the "Backend App".)
Skip to the portion for your preferred programming language:
Running the End-to-End Test (via Test Explorer)
-
Click on the "Testing" icon on the left sidebar.
-
Open up all the tests in
Playwright
>js
>tests
-
On the row with
js
label, click on the "Play" button to run the unit tests. -
You should see a bunch of green ticks to signify that all the tests are passing.
You can view & edit the E2E test files (files with *.spec.js
extension) in End-to-End Tests
> tests
.
-
Click on the "Testing" icon on the left sidebar to open the "Test Explorer".
You'll notice that the End-to-End Tests are not loaded yet.
-
We will need to configure the Python testing in VSCode.
Press
ctrl
+shift
+p
(windows) /cmd
+shift
+p
(macOS) to bring up the Command Palette.Next, type:
pytest
You should see this option show up in the Command Palette:
-
In the list of workspaces, select the "End-to-End Tests".
-
Next select the "pytest" Test Framework
-
Next select the "Root directory" as the directory containing the tests.
-
You should see the Python tests appear in the "Test Explorer".
-
Open up all the tests in
Python Tests
>py
>test_todo_app.py
-
On the row with
py
label, click on the "Play" button to run the unit tests. -
You should see a bunch of green ticks to signify that all the tests are passing.
Running the End-to-End Test (via Test Explorer)
-
Click on the "Testing" icon on the left sidebar.
-
Open up all the tests in
Java Test
>todolist-java
-
On the row with
todolist-java
label, click on the "Play" button to run the E2E tests. -
You should see a bunch of green ticks to signify that all the tests are passing.
You can view & edit the E2E test files in End-to-End Tests
workspace. Under the src
directory.