Skip to content

Commit

Permalink
[apache#877] Apply UI linting to cypress module
Browse files Browse the repository at this point in the history
  • Loading branch information
aamirxshaikh committed Dec 24, 2022
1 parent 7bd5f3e commit 289d269
Show file tree
Hide file tree
Showing 98 changed files with 2,548 additions and 2,255 deletions.
1 change: 0 additions & 1 deletion ui/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dist

# Remove these in the future to lint additional modules
# Please also see .prettierignore
cypress
deployment
projects
src/app/_enums
Expand Down
1 change: 0 additions & 1 deletion ui/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dist

# Remove these in the future to format additional modules
# Please also see .eslintignore
cypress
deployment
projects
src/app/_enums
Expand Down
56 changes: 31 additions & 25 deletions ui/cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,56 @@
~ limitations under the License.
~
-->

# End2End tests with cypress

This folder contains a WIP framework for automated E2E tests of StreamPipes.

## How to run the tests?

1. Set up and install a clean StreamPipes instance.
2. Run Cypress (Use one of the three options):
* Open cypress UI:

- Open cypress UI:
```bash
npm run test-cypress-open
```
* Run smoke tests (tests with suffix .smoke.spec.ts )
- Run smoke tests (tests with suffix .smoke.spec.ts )
```bash
npm run test-cypress-smoke
npm run test-cypress-smoke
```
* Run whole test suite (tests with suffix .spec.ts )
- Run whole test suite (tests with suffix .spec.ts )
```bash
npm run test-cypress-all
```

**User**: [email protected] **Password**: admin

>**Note:** To configure the base URL set the environment variable CYPRESS_BASE_URL (e.g. CYPRESS_BASE_URL=http://localhost:8082)
> **Note:** To configure the base URL set the environment variable CYPRESS_BASE_URL (e.g. CYPRESS_BASE_URL=http://localhost:8082)
## Design guidlines
* Before each test the whole system is cleaned to have a fresh environment
* Each test sets up its own test environment (e.g. upload files)
* There should not be any dependencies between tests
* Ensure that all services required for the test are running (e.g. external data sources, external databases, ...)

- Before each test the whole system is cleaned to have a fresh environment
- Each test sets up its own test environment (e.g. upload files)
- There should not be any dependencies between tests
- Ensure that all services required for the test are running (e.g. external data sources, external databases, ...)

## Automated test runs
* Each night the whole test suite is run within github actions
* See:
* To add a test to the test suite add the suffix .spec.ts
* Each PR triggers the smoke tests to detect errors before the branch is merged into the development
* Add suffix .smoke.spec.ts to add test to the smoke tests
* When no suffix is available the test must be triggered manually

- Each night the whole test suite is run within github actions
- See:
- To add a test to the test suite add the suffix .spec.ts
- Each PR triggers the smoke tests to detect errors before the branch is merged into the development
- Add suffix .smoke.spec.ts to add test to the smoke tests
- When no suffix is available the test must be triggered manually

## Directories
* **fixtures**:
* Files that are required for tests
* **plugins**:
* Cypress plugins can be added here
* **support**:
* Contains code for the StreamPipes test framework (e.g. model, utils functions, ...)
* **tests**:
* Contains the actual test cases grouped by streampipes modules (e.g. connect, pipeline editor, ...)

- **fixtures**:
- Files that are required for tests
- **plugins**:
- Cypress plugins can be added here
- **support**:
- Contains code for the StreamPipes test framework (e.g. model, utils functions, ...)
- **tests**:
- Contains the actual test cases grouped by streampipes modules (e.g. connect, pipeline editor, ...)
12 changes: 7 additions & 5 deletions ui/cypress/fixtures/dataDownloadDialog/input.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[{"timestamp": 1623871499055, "v1": 4.1, "v2": "abc", "v3": true, "v4": 1},
{"timestamp": 1623871500059, "v1": 4.2, "v2": "abc", "v3": false, "v4": 2},
{"timestamp": 1623871507091, "v1": 4.3, "v4": 3},
{"timestamp": 1623871508093, "v1": 4.4, "v2": "abc", "v3": true, "v4": 4},
{"timestamp": 1623871508095, "v1": 4.5, "v4": 5}]
[
{ "timestamp": 1623871499055, "v1": 4.1, "v2": "abc", "v3": true, "v4": 1 },
{ "timestamp": 1623871500059, "v1": 4.2, "v2": "abc", "v3": false, "v4": 2 },
{ "timestamp": 1623871507091, "v1": 4.3, "v4": 3 },
{ "timestamp": 1623871508093, "v1": 4.4, "v2": "abc", "v3": true, "v4": 4 },
{ "timestamp": 1623871508095, "v1": 4.5, "v4": 5 }
]
32 changes: 31 additions & 1 deletion ui/cypress/fixtures/dataDownloadDialog/testJson.json
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
[{"timestamp": 1623871499055,"v1": 4.099999904632568,"v2": "abc","v3": true,"v4": 1.0},{"timestamp": 1623871500059,"v1": 4.199999809265137,"v2": "abc","v3": false,"v4": 2.0},{"timestamp": 1623871507091,"v1": 4.300000190734863,"v2": null,"v3": null,"v4": 3.0},{"timestamp": 1623871508093,"v1": 4.400000095367432,"v2": "abc","v3": true,"v4": 4.0},{"timestamp": 1623871508095,"v1": 4.5,"v2": null,"v3": null,"v4": 5.0}]
[
{
"timestamp": 1623871499055,
"v1": 4.099999904632568,
"v2": "abc",
"v3": true,
"v4": 1.0
},
{
"timestamp": 1623871500059,
"v1": 4.199999809265137,
"v2": "abc",
"v3": false,
"v4": 2.0
},
{
"timestamp": 1623871507091,
"v1": 4.300000190734863,
"v2": null,
"v3": null,
"v4": 3.0
},
{
"timestamp": 1623871508093,
"v1": 4.400000095367432,
"v2": "abc",
"v3": true,
"v4": 4.0
},
{ "timestamp": 1623871508095, "v1": 4.5, "v2": null, "v3": null, "v4": 5.0 }
]
12 changes: 7 additions & 5 deletions ui/cypress/fixtures/datalake/missingData.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[{"timestamp": 1667904471000, "v1": 4.1, "v2": "abc", "v3": true, "v4": 1},
{"timestamp": 1667904472000, "v1": 4.2, "v2": "abc", "v3": false, "v4": 2},
{"timestamp": 1667904473000, "v1": 4.3},
{"timestamp": 1667904474000, "v1": 4.4, "v2": "abc", "v3": true, "v4": 4},
{"timestamp": 1667904475000, "v1": 4.5, "v4": 5}]
[
{ "timestamp": 1667904471000, "v1": 4.1, "v2": "abc", "v3": true, "v4": 1 },
{ "timestamp": 1667904472000, "v1": 4.2, "v2": "abc", "v3": false, "v4": 2 },
{ "timestamp": 1667904473000, "v1": 4.3 },
{ "timestamp": 1667904474000, "v1": 4.4, "v2": "abc", "v3": true, "v4": 4 },
{ "timestamp": 1667904475000, "v1": 4.5, "v4": 5 }
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"type": "code-input",
"selector": "jsFunction",
"value": "function process(event) {\n return event;"
}],
"output":
{
"type": "append"
}
}
],
"output": {
"type": "append"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"type": "code-input",
"selector": "jsFunction",
"value": "function process(event) {\n event.plusone = event.numberlist + 1;\n return event;"
}],
"output":
{
"type": "append",
"config": [
{
"runtimeName": "plusone",
"runtimeType": "Float"
}
]
}
}
],
"output": {
"type": "append",
"config": [
{
"runtimeName": "plusone",
"runtimeType": "Float"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"value": "4"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"value": "True"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"value": "False"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "numerical_filter",
"config": [
{"type": "drop-down", "selector": "number-mapping", "value": "randomnumber"},
{"type": "radio", "selector": "operation", "value": "\\>"},
{"type": "input", "selector": "value", "value": "50"}
]
}
"name": "numerical_filter",
"config": [
{
"type": "drop-down",
"selector": "number-mapping",
"value": "randomnumber"
},
{ "type": "radio", "selector": "operation", "value": "\\>" },
{ "type": "input", "selector": "value", "value": "50" }
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"value": "check"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "text_filter",
"config": [
{"type": "drop-down", "selector": "text", "value": "randomchar"},
{"type": "radio", "selector": "operation", "value": "MATCHES"},
{"type": "input", "selector": "keyword", "value": "c"}
]
}
"name": "text_filter",
"config": [
{ "type": "drop-down", "selector": "text", "value": "randomchar" },
{ "type": "radio", "selector": "operation", "value": "MATCHES" },
{ "type": "input", "selector": "keyword", "value": "c" }
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "text_filter",
"config": [
{"type": "drop-down", "selector": "text", "value": "randomchar"},
{"type": "radio", "selector": "operation", "value": "CONTAINS"},
{"type": "input", "selector": "keyword", "value": "app"}
]
}
"name": "text_filter",
"config": [
{ "type": "drop-down", "selector": "text", "value": "randomchar" },
{ "type": "radio", "selector": "operation", "value": "CONTAINS" },
{ "type": "input", "selector": "keyword", "value": "app" }
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"value": "50"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "boolean_counter",
"config": [
{"type": "drop-down", "selector": "field", "value": "booleanToCount"},
{"type": "radio", "selector": "flank", "value": "BOTH"}
]
}
"name": "boolean_counter",
"config": [
{ "type": "drop-down", "selector": "field", "value": "booleanToCount" },
{ "type": "radio", "selector": "flank", "value": "BOTH" }
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "boolean_inverter",
"config": [
{"type": "drop-down", "selector": "invert-field", "value": "booleanToInvert"}
]
}
"name": "boolean_inverter",
"config": [
{
"type": "drop-down",
"selector": "invert-field",
"value": "booleanToInvert"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "count_array",
"config": [
{"type": "drop-down", "selector": "array-field", "value": "arrayProperty"}
]
}
"name": "count_array",
"config": [
{ "type": "drop-down", "selector": "array-field", "value": "arrayProperty" }
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[{"timestamp": 1623871499055, "arrayProperty": [1,2,4,4]},
{"timestamp": 1623871500059, "arrayProperty": [1,4]},
{"timestamp": 1623871507091, "arrayProperty": [1,3,3,3,4]},
{"timestamp": 1623871508093, "arrayProperty": [1]}]
[
{ "timestamp": 1623871499055, "arrayProperty": [1, 2, 4, 4] },
{ "timestamp": 1623871500059, "arrayProperty": [1, 4] },
{ "timestamp": 1623871507091, "arrayProperty": [1, 3, 3, 3, 4] },
{ "timestamp": 1623871508093, "arrayProperty": [1] }
]
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "field_hasher",
"config": [
{"type": "drop-down", "selector": "property-mapping", "value": "sensorId"},
{"type": "radio", "selector": "hash-algorithm", "value": "SHA1"}
]
"name": "field_hasher",
"config": [
{
"type": "drop-down",
"selector": "property-mapping",
"value": "sensorId"
},
{ "type": "radio", "selector": "hash-algorithm", "value": "SHA1" }
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "field_hasher",
"config": [
{"type": "drop-down", "selector": "property-mapping", "value": "sensorId"},
{"type": "radio", "selector": "hash-algorithm", "value": "MD5"}
]
"name": "field_hasher",
"config": [
{
"type": "drop-down",
"selector": "property-mapping",
"value": "sensorId"
},
{ "type": "radio", "selector": "hash-algorithm", "value": "MD5" }
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "field_mapper",
"config": [
{"type": "checkbox", "selector": "value1", "value": "check"},
{"type": "checkbox", "selector": "value2", "value": "check"},
{"type": "input", "selector": "fieldName", "value": "hashedField"}
]
"name": "field_mapper",
"config": [
{ "type": "checkbox", "selector": "value1", "value": "check" },
{ "type": "checkbox", "selector": "value2", "value": "check" },
{ "type": "input", "selector": "fieldName", "value": "hashedField" }
]
}
Loading

0 comments on commit 289d269

Please sign in to comment.