aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/steps/general
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/cypress/support/steps/general')
-rw-r--r--vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts14
-rw-r--r--vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts32
2 files changed, 46 insertions, 0 deletions
diff --git a/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts b/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts
new file mode 100644
index 000000000..e3323a125
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts
@@ -0,0 +1,14 @@
+declare namespace Cypress {
+ interface Chainable {
+ clickOutside: typeof clickOutside,
+ }
+}
+
+function clickOutside(testByIdClickElement : string, testBeforeClickOutside : Function, testAfterClickOutside : Function) {
+ testBeforeClickOutside();
+ cy.getElementByDataTestsId(testByIdClickElement).click({force: true}).then(()=>{
+ testAfterClickOutside();
+ });
+}
+
+Cypress.Commands.add('clickOutside', clickOutside);
diff --git a/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts b/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts
new file mode 100644
index 000000000..ee5e95a3a
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts
@@ -0,0 +1,32 @@
+const { _ } = Cypress;
+
+declare namespace Cypress {
+ interface Chainable {
+ deepCompare: typeof deepCompare,
+ }
+}
+
+function deepCompare(actual : any, expected : any) {
+ if(actual !== null && expected !== null){
+ let diff : any[] = [];
+ Cypress._.mergeWith(actual, expected, function (objectValue, sourceValue, key, object, source) {
+ if ( !(_.isEqual(objectValue, sourceValue)) && (Object(objectValue) !== objectValue)) {
+ diff.push("key: " +key + ", expected: " + sourceValue + ", actual: " + objectValue);
+ }
+ });
+
+ Cypress._.mergeWith(expected, actual, function (objectValue, sourceValue, key, object, source) {
+ if ( !(_.isEqual(objectValue, sourceValue)) && (Object(objectValue) !== objectValue)) {
+ diff.push("key: " +key + ", expected: " + sourceValue + ", actual: " + objectValue);
+ }
+ });
+
+ if(diff.length > 0){
+ console.error("diff", diff);
+ cy.log("The object are not equals", diff);
+ expect(actual).equals(expected);
+ }
+ }
+}
+
+Cypress.Commands.add('deepCompare', deepCompare);