Skip to content

Commit 70754a5

Browse files
committed
feat: lab4
1 parent fbbe21f commit 70754a5

File tree

5 files changed

+1275
-0
lines changed

5 files changed

+1275
-0
lines changed

lab4/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Lab4
2+
3+
## Introduction
4+
5+
In this lab, you will write tests in `main_test.js`. You can learn how to use [Puppeteer](https://pptr.dev/) to tests a web UI.
6+
7+
## Preparation (Important!!!)
8+
9+
1. Sync fork your branch (e.g., `SQLab:312XXXXXX`)
10+
2. `git checkout -b lab4` (**NOT** your student ID !!!)
11+
12+
## Requirement
13+
14+
1. (100%) Goto https://pptr.dev/, type `chipi chipi chapa chapa` into the search box, click on **1st** result in the **Docs** section, and print the title.
15+
16+
For the detailed steps and hints, please check the slide of this lab.
17+
18+
You can run `validate.sh` in your local to test if you satisfy the requirements.
19+
20+
Please note that you must not alter files other than `main_test.js`. You will get 0 points if
21+
22+
1. you modify other files to achieve requirements.
23+
2. you can't pass all CI on your PR.
24+
25+
## Submission
26+
27+
You need to open a pull request to your branch (e.g. 312XXXXXX, your student number) and contain the code that satisfies the abovementioned requirements.
28+
29+
Moreover, please submit the URL of your PR to E3. Your submission will only be accepted when you present at both places.

lab4/main_test.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const puppeteer = require('puppeteer');
2+
3+
(async () => {
4+
// Launch the browser and open a new blank page
5+
const browser = await puppeteer.launch();
6+
const page = await browser.newPage();
7+
8+
// Navigate the page to a URL
9+
await page.goto('https://pptr.dev/');
10+
11+
// Hints:
12+
// Click search button
13+
// Type into search box
14+
// Wait for search result
15+
// Get the `Docs` result section
16+
// Click on first result in `Docs` section
17+
// Locate the title
18+
// Print the title
19+
20+
// Close the browser
21+
await browser.close();
22+
})();

0 commit comments

Comments
 (0)