summaryrefslogtreecommitdiffstats
path: root/public/cypress/support/ruleEngineCommands.ts
diff options
context:
space:
mode:
authorStone, Avi (as206k) <as206k@att.com>2018-04-12 16:36:39 +0300
committerStone, Avi (as206k) <as206k@att.com>2018-04-12 16:36:39 +0300
commit9b2ceb347a3371819fcad6bbe2268203afecaf4e (patch)
treefbb5ea2c147d71dfeeec0882b215423e7b7206b4 /public/cypress/support/ruleEngineCommands.ts
parent72dc8e3298d3e4315cdd9717b778671cb0b625bc (diff)
DCAE-D fe initial commit
DCAE-D fe initial commit Change-Id: Ica8ccb7c7ef769c969664d1e168d205eb9fc67f2 Issue-ID: SDC-1218 Signed-off-by: Stone, Avi (as206k) <as206k@att.com>
Diffstat (limited to 'public/cypress/support/ruleEngineCommands.ts')
-rw-r--r--public/cypress/support/ruleEngineCommands.ts71
1 files changed, 71 insertions, 0 deletions
diff --git a/public/cypress/support/ruleEngineCommands.ts b/public/cypress/support/ruleEngineCommands.ts
new file mode 100644
index 0000000..2142e7f
--- /dev/null
+++ b/public/cypress/support/ruleEngineCommands.ts
@@ -0,0 +1,71 @@
+declare namespace Cypress {
+ interface Chainable {
+ emptyRuleEngine: typeof emptyRuleEngine;
+ httpTargetTree: typeof httpTargetTree;
+ doneSaveRule: typeof doneSaveRule;
+ httpTransalte: typeof httpTransalte;
+ }
+}
+
+function emptyRuleEngine(targetFiled) {
+ cy.server();
+ cy
+ .route({
+ method: 'GET',
+ url: `${Cypress.env(
+ 'backendUrl'
+ )}/rule-editor/rule/6d436c07-8006-4335-8c84-d65b4740f8d6/map/n.1517823219961.0/${targetFiled}`,
+ response: {}
+ })
+ .as('serverRuleList')
+ .route({
+ method: 'GET',
+ url: Cypress.env('backendUrl') + '/rule-editor/list-events-by-versions',
+ response: 'fixture:list-events-by-version'
+ })
+ .as('serverEventsAndVersion');
+}
+
+function httpTargetTree() {
+ cy.server();
+ cy
+ .route({
+ method: 'GET',
+ url:
+ Cypress.env('backendUrl') + '/rule-editor/definition/4.1/syslogFields',
+ response: 'fixture:syslogTargetTree'
+ })
+ .as('targetData');
+}
+
+function doneSaveRule() {
+ cy.server();
+ cy
+ .route({
+ method: 'POST',
+ url:
+ Cypress.env('backendUrl') +
+ '/rule-editor/rule/6d436c07-8006-4335-8c84-d65b4740f8d6/map/n.1517823219961.0/Type1',
+ response: 'fixture:doneSaveSimpleCopy'
+ })
+ .as('doneSaveCopyRule');
+}
+
+function httpTransalte() {
+ cy.server();
+ cy
+ .route({
+ method: 'GET',
+ url:
+ Cypress.env('backendUrl') +
+ '/rule-editor/rule/translate/6d436c07-8006-4335-8c84-d65b4740f8d6/map/n.1517823219961.0/Type1',
+ response: 'fixture:TranslateSimpleCopy'
+ })
+ .as('TranslateSimpleCopy');
+}
+
+// Add cypress commands
+Cypress.Commands.add('emptyRuleEngine', emptyRuleEngine);
+Cypress.Commands.add('httpTargetTree', httpTargetTree);
+Cypress.Commands.add('doneSaveRule', doneSaveRule);
+Cypress.Commands.add('httpTransalte', httpTransalte);