An open API service indexing awesome lists of open source software.

https://github.com/cerberus/pup

An example of puppeteer project with prescript
https://github.com/cerberus/pup

puppeteer typescript

Last synced: 4 months ago
JSON representation

An example of puppeteer project with prescript

Awesome Lists containing this project

README

        

## Pup

An example puppeteer project with prescript

simple

### Highlights

🔥 Hot Steps Replacement: Reload test-code without rerunning from first-step.

👥 Test-parallelization: Run your tests in parallel and grouping to a report.

🤖 No Javascript skill Required: Simple and readable to implement a test-case. (But required for adding additional actions)

### Setup
Clone & fulfill cookie configs in `.env` file.
```
cp .env.template .env
```
Install packages.
```
npm ci
```

### Development process
Run `tsc` to automatically compile ts to js when the file is updated.
```
npm run build:watch
```
Open a new terminal tab and run the test file. (e.g. `src/__tests__/google/search/desktop.ts`)
```
npm run dev dist/__tests__/google/search/desktop.js
```
an example source code:
```ts
app
.init()
.goto('https://www.google.com')
.search('input[name=q]', 'google')
```
after run the command above..
```
## Loading test and generating test plan...
Step 1. Init
Step 1.1. Create page
Deferred Step 1.2. Close browser
Step 2. Goto https://www.google.com
Step 3. Search input[name=q] google
Step 3.1. Type input[name=q] google
Step 3.2. Enter
* Test plan generated successfully!
```
See more how to use [prescript](https://prescript.netlify.com) and enjoy : )

### Use querySelector to debug
```
document.querySelector('')
```

### Use xPath to debug
```
document.evaluate('', document, null, XPathResult.ANY_TYPE, null).iterateNext()
```

### Use querySelectorAll to expect
```
document.querySelectorAll('')
```

### Test Parallelization

Run all test files

```
npm run test:all
```

Run all test files with generating a report

```
npm run test:report
```

`allure-results` will be created.

### Generating report (html)

After run `npm run test:report`. To preview allure report by coding
```
npm run serve:report
```

Build an `allure-report` for uploading.

```
npm run gen:report
```

### References
- [puppeteer](https://pptr.dev)
- [prescript](https://prescript.netlify.com)