Skip to content

Commit 4d1b528

Browse files
authored
Merge pull request #133 from FlowTestAI/update-cli-pkg
Add readme and license to cli package for publishing
2 parents d27ecb7 + 28fe5d4 commit 4d1b528

18 files changed

Lines changed: 674 additions & 7 deletions

packages/flowtest-cli/LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Sajal Jain
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/flowtest-cli/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# flowtestai-cli
2+
3+
With FlowTestAI CLI, you can now run your end to end flows, constructed using FlowTestAI, directly from command line.
4+
5+
This makes it easier to run your tests in different environments, automate your testing process, and integrate your tests with your continuous integration and deployment workflows.
6+
7+
## Installation
8+
9+
To install the FlowTestAI CLI, use the node package manager of your choice, such as NPM:
10+
11+
```bash
12+
npm install -g flowtestai
13+
```
14+
15+
## Getting started
16+
17+
Navigate to the root directory of your collection, and then run:
18+
19+
```bash
20+
flow run help
21+
```
22+
23+
This command will give you various options you can use to run a flow. You can also run a single flow by specifying its filename with the `--file` or `-f` option:
24+
25+
```bash
26+
flow run -f test.flow
27+
```
28+
29+
Or run a requests inside a subfolder:
30+
31+
```bash
32+
flow run -f folder/subfolder/test.flow
33+
```
34+
35+
If you need to use an environment, you can specify it with the `--env` or `-e` option:
36+
37+
```bash
38+
flow run -f test.flow -e environments/test.env
39+
```
40+
41+
If you need to publish the results of your flow runs for further analysis, you can specify the `-s` option. Request your access key pairs from https://flowtest-ai.vercel.app/ and then run export $FLOWTEST_ACCESS_ID and $FLOWTEST_ACCESS_KEY before publishing:
42+
43+
```bash
44+
flow run -f test.flow -e environments/test.env -s
45+
```
46+
47+
## Demo
48+
49+
![demo1](assets/demo1.png)
50+
![demo2](assets/demo2.png)
51+
52+
## Support
53+
54+
If you encounter any issues or have any feedback or suggestions, please raise them on our [GitHub repository](https://github.com/FlowTestAI/FlowTest)
55+
56+
Thank you for using FlowTestAI CLI!
57+
58+
## Changelog
59+
60+
See [https://github.com/FlowTestAI/FlowTest/releases](https://github.com/FlowTestAI/FlowTest/releases)
61+
62+
## License
63+
64+
[MIT](LICENSE.md)
1.56 MB
Loading
1.13 MB
Loading

packages/flowtest-cli/bin/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const yargs = require('yargs/yargs');
44
const { hideBin } = require('yargs/helpers');
55
const chalk = require('chalk');
6-
const readFile = require('../../flowtest-electron/src/utils/filemanager/readfile');
7-
const { serialize } = require('../../flowtest-electron/src/utils/flowparser/parser');
6+
const readFile = require('../utils/readfile');
7+
const { serialize } = require('../utils/flowparser/parser');
88
const { Graph } = require('../graph/Graph');
99
const { cloneDeep } = require('lodash');
1010
const dotenv = require('dotenv');

packages/flowtest-cli/graph/Graph.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ const requestNode = require('./compute/requestNode');
77
const setVarNode = require('./compute/setvarnode');
88
const chalk = require('chalk');
99
const path = require('path');
10-
const readFile = require('../../flowtest-electron/src/utils/filemanager/readfile');
11-
const { serialize } = require('../../flowtest-electron/src/utils/flowparser/parser');
1210
const Node = require('./compute/node');
1311
const { LogLevel } = require('./GraphLogger');
12+
const readFile = require('../utils/readfile');
13+
const { serialize } = require('../utils/flowparser/parser');
1414

1515
class nestedFlowNode extends Node {
1616
constructor(nodes, edges, startTime, timeout, initialEnvVars, logger) {

packages/flowtest-cli/package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
{
2-
"name": "flowtest-cli",
3-
"version": "1.0.0",
2+
"name": "flowtestai",
3+
"version": "1.0.2",
44
"description": "CLI to run flow from command line",
55
"main": "bin/index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},
99
"bin": {
10-
"flow": "./bin/index.js"
10+
"flow": "bin/index.js"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/FlowTestAI/FlowTest/issues"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/FlowTestAI/FlowTest.git"
1118
},
1219
"author": "Sajal Jain <jsajal1993@gmail.com>",
1320
"license": "MIT",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { Node } = require('./Node');
2+
3+
class AssertNode extends Node {
4+
constructor() {
5+
super('assertNode');
6+
}
7+
8+
serialize(id, data, metadata) {
9+
return {
10+
id,
11+
type: this.type,
12+
data,
13+
...metadata,
14+
};
15+
}
16+
17+
deserialize(node) {
18+
const id = node.id;
19+
const data = node.data;
20+
delete node.id;
21+
delete node.data;
22+
const metadata = node;
23+
24+
return {
25+
id,
26+
data,
27+
metadata,
28+
};
29+
}
30+
}
31+
32+
module.exports = {
33+
AssertNode,
34+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { Node } = require('./Node');
2+
3+
class AuthNode extends Node {
4+
constructor() {
5+
super('authNode');
6+
}
7+
8+
serialize(id, data, metadata) {
9+
return {
10+
id,
11+
type: this.type,
12+
data,
13+
...metadata,
14+
};
15+
}
16+
17+
deserialize(node) {
18+
const id = node.id;
19+
const data = node.data;
20+
delete node.id;
21+
delete node.data;
22+
const metadata = node;
23+
24+
return {
25+
id,
26+
data,
27+
metadata,
28+
};
29+
}
30+
}
31+
32+
module.exports = {
33+
AuthNode,
34+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { Node } = require('./Node');
2+
3+
class DelayNode extends Node {
4+
constructor() {
5+
super('delayNode');
6+
}
7+
8+
serialize(id, data, metadata) {
9+
return {
10+
id,
11+
type: this.type,
12+
data,
13+
...metadata,
14+
};
15+
}
16+
17+
deserialize(node) {
18+
const id = node.id;
19+
const data = node.data;
20+
delete node.id;
21+
delete node.data;
22+
const metadata = node;
23+
24+
return {
25+
id,
26+
data,
27+
metadata,
28+
};
29+
}
30+
}
31+
32+
module.exports = {
33+
DelayNode,
34+
};

0 commit comments

Comments
 (0)