https://github.com/gedex/simflow
Simply define and run your flows in Chrome.
https://github.com/gedex/simflow
automation chrome flow headless-chrome nodejs-cli web
Last synced: 8 months ago
JSON representation
Simply define and run your flows in Chrome.
- Host: GitHub
- URL: https://github.com/gedex/simflow
- Owner: gedex
- License: other
- Created: 2018-12-23T19:04:03.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-17T11:57:00.000Z (almost 7 years ago)
- Last Synced: 2025-04-01T01:03:48.252Z (9 months ago)
- Topics: automation, chrome, flow, headless-chrome, nodejs-cli, web
- Language: JavaScript
- Size: 183 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
simflow
=======
Simply define and run your flows in Chrome.
[![NPM Version][npm-image]][npm-url]
[![Build][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
## Install
```
npm i -g simflow
```
## Usage
```
simflow [options...]
```
Flows are defined in JSON config file.
### Example
This example demonstrates a simple flow of searching GitHub project and take
a sreenshot of search results.
* Create `example-gh-simflow.json`:
```json
{
"url": "https://github.com",
"references": {
"searchField": "[name='q']",
"searchButton": "[type='submit']"
},
"flows": {
"search": [
"Goto '/search'",
"See searchField",
"Type in searchField 'simflow'",
"See searchButton",
"Click searchButton",
"Wait page { to: 'reload' }",
"Save screenshot as 'search-results.png'",
"Save page as 'search-results.html'"
]
}
}
```
* Run `search` flow from `example-gh-simflow.json` config file:
```
simflow search -c ./example-gh-simflow.json
```
## Config
*This is under heavy development and structure may changes.*
| Key | Type | Description |
| --- | ---- | ----------- |
| `url` | `string` | **Required**. Base URL. New page opens this URL. Defined path (i.e., `Goto /path`) in steps section uses this base URL. |
| `references` | `object` | List of references to be used in steps of a flow. |
| `flows` | `objects` | **Required**. Flow names mapped to array of steps. Named flows are passed to `simflow` as args. |
### Step
Step is a string with grammar defined in a [PEG](https://en.wikipedia.org/wiki/Parsing_expression_grammar) file [`lib/step.pegjs`](./lib/step.pegjs).
Some example of steps:
```
// Use reference.
Click namedSelector
Click namedSelector@frameName
// Use literal string for selector.
Click '.header h1'@'frameName'
Type into namedSelector "hello world"
Press 'Enter'
// Step arguments.
Press 'Enter' { delay: 1000 }
Save screenshot as './screenshots/filename.png' { fullPage: true }
Save page as './pages/index.pdf' { output: 'pdf' }
```
[npm-image]: https://img.shields.io/npm/v/simflow.svg
[npm-url]: https://npmjs.org/package/simflow
[travis-image]: https://img.shields.io/travis/gedex/simflow/master.svg?label=linux
[travis-url]: https://travis-ci.org/gedex/simflow
[coveralls-image]: https://img.shields.io/coveralls/gedex/simflow/master.svg
[coveralls-url]: https://coveralls.io/r/gedex/simflow?branch=master