@onehat/ui 0.3.283 → 0.3.285
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Components/Editor/Editor.js +0 -1
- package/src/Functions/Cypress/button_functions.js +84 -0
- package/src/Functions/Cypress/common_functions.js +108 -0
- package/src/Functions/Cypress/crud_functions.js +694 -0
- package/src/Functions/Cypress/dom_functions.js +43 -0
- package/src/Functions/Cypress/form_functions.js +506 -0
- package/src/Functions/Cypress/grid_functions.js +269 -0
- package/src/Functions/Cypress/navigation_functions.js +70 -0
- package/src/Functions/Cypress/utilities.js +109 -0
package/package.json
CHANGED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
getDomNode,
|
|
4
|
+
getDomNodes,
|
|
5
|
+
} from './dom_functions.js';
|
|
6
|
+
import _ from 'lodash';
|
|
7
|
+
const $ = Cypress.$;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export function clickAddButton(parentSelectors) {
|
|
11
|
+
return clickButton(parentSelectors, 'addBtn');
|
|
12
|
+
}
|
|
13
|
+
export function clickSaveButton(parentSelectors) {
|
|
14
|
+
return clickButton(parentSelectors, 'saveBtn');
|
|
15
|
+
}
|
|
16
|
+
export function clickEditButton(parentSelectors) {
|
|
17
|
+
return clickButton(parentSelectors, 'editBtn');
|
|
18
|
+
}
|
|
19
|
+
export function clickDeleteButton(parentSelectors) {
|
|
20
|
+
return clickButton(parentSelectors, 'deleteBtn');
|
|
21
|
+
}
|
|
22
|
+
export function clickDuplicateButton(parentSelectors) {
|
|
23
|
+
return clickButton(parentSelectors, 'duplicateBtn');
|
|
24
|
+
}
|
|
25
|
+
export function clickReloadButton(parentSelectors) {
|
|
26
|
+
return clickButton(parentSelectors, 'reloadPageBtn');
|
|
27
|
+
}
|
|
28
|
+
export function clickCloseButton(parentSelectors) {
|
|
29
|
+
return clickButton(parentSelectors, 'closeBtn');
|
|
30
|
+
}
|
|
31
|
+
export function clickCancelButton(parentSelectors) {
|
|
32
|
+
return clickButton(parentSelectors, 'cancelBtn');
|
|
33
|
+
}
|
|
34
|
+
export function clickOkButton(parentSelectors) {
|
|
35
|
+
return clickButton(parentSelectors, 'okBtn');
|
|
36
|
+
}
|
|
37
|
+
export function clickYesButton(parentSelectors) {
|
|
38
|
+
return clickButton(parentSelectors, 'yesBtn');
|
|
39
|
+
}
|
|
40
|
+
export function clickNoButton(parentSelectors) {
|
|
41
|
+
return clickButton(parentSelectors, 'noBtn');
|
|
42
|
+
}
|
|
43
|
+
export function clickXButton(parentSelectors) {
|
|
44
|
+
return clickButton(parentSelectors, 'xBtn');
|
|
45
|
+
}
|
|
46
|
+
export function clickTrigger(parentSelectors) {
|
|
47
|
+
return clickButton(parentSelectors, 'trigger');
|
|
48
|
+
}
|
|
49
|
+
export function clickToEditButton(parentSelectors) {
|
|
50
|
+
return clickButton(parentSelectors, 'toEditBtn');
|
|
51
|
+
}
|
|
52
|
+
export function clickToEditButtonIfExists(parentSelectors) {
|
|
53
|
+
return clickButtonIfExists(parentSelectors, 'toEditBtn');
|
|
54
|
+
}
|
|
55
|
+
export function clickToViewButton(parentSelectors) {
|
|
56
|
+
return clickButton(parentSelectors, 'toViewBtn');
|
|
57
|
+
}
|
|
58
|
+
export function clickToViewButtonIfExists(parentSelectors) {
|
|
59
|
+
return clickButtonIfExists(parentSelectors, 'toViewBtn');
|
|
60
|
+
}
|
|
61
|
+
export function toFullMode(parentSelectors) {
|
|
62
|
+
return clickButton(parentSelectors, 'fullModeBtn');
|
|
63
|
+
}
|
|
64
|
+
export function toSideMode(parentSelectors) {
|
|
65
|
+
return clickButton(parentSelectors, 'sideModeBtn');
|
|
66
|
+
}
|
|
67
|
+
export function clickButton(parentSelectors, name) {
|
|
68
|
+
if (_.isString(parentSelectors)) {
|
|
69
|
+
parentSelectors = [parentSelectors];
|
|
70
|
+
}
|
|
71
|
+
return getDomNode([...parentSelectors, name])
|
|
72
|
+
// .scrollIntoView()
|
|
73
|
+
.click({ force: true });
|
|
74
|
+
}
|
|
75
|
+
export function clickButtonIfExists(parentSelectors, name) {
|
|
76
|
+
if (_.isString(parentSelectors)) {
|
|
77
|
+
parentSelectors = [parentSelectors];
|
|
78
|
+
}
|
|
79
|
+
return getDomNode([...parentSelectors, name]).then((node) => {
|
|
80
|
+
if (node) {
|
|
81
|
+
node.click();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getDomNode,
|
|
3
|
+
getDomNodes,
|
|
4
|
+
} from './dom_functions.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export function markForPageReload() {
|
|
8
|
+
// See https://github.com/cypress-io/cypress/issues/1805#issuecomment-525482440
|
|
9
|
+
cy.window()
|
|
10
|
+
.then((win) => {
|
|
11
|
+
win.beforeReload = true;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function waitForPageReload() {
|
|
15
|
+
// See https://github.com/cypress-io/cypress/issues/1805#issuecomment-525482440
|
|
16
|
+
cy.window({ timeout: 30000 })
|
|
17
|
+
.should('not.have.prop', 'beforeReload');
|
|
18
|
+
}
|
|
19
|
+
export function waitForNavigationTo(url) {
|
|
20
|
+
return cy.location('pathname', { timeout: 30000 })
|
|
21
|
+
.should('include', url);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// __ ___ ____
|
|
27
|
+
// / |/ /__ ______________ _____ ____ / __ )____ _ __
|
|
28
|
+
// / /|_/ / _ \/ ___/ ___/ __ `/ __ `/ _ \/ __ / __ \| |/_/
|
|
29
|
+
// / / / / __(__ |__ ) /_/ / /_/ / __/ /_/ / /_/ /> <
|
|
30
|
+
// /_/ /_/\___/____/____/\__,_/\__, /\___/_____/\____/_/|_|
|
|
31
|
+
// /____/
|
|
32
|
+
export function clickMessageBoxDefaultButton() {
|
|
33
|
+
getDomNode(['AlertDialogue', 'okBtn'])
|
|
34
|
+
.click();
|
|
35
|
+
}
|
|
36
|
+
export function verifyNoErrorBox() {
|
|
37
|
+
getDomNode('ErrorMessage', { timeout: 1000 })
|
|
38
|
+
.should('not.exist', 'Error dialogue popped up.');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// export function verifyNoErrorMessage() {
|
|
44
|
+
// // cy.wait(1000);
|
|
45
|
+
// cy.get('input[data-testid="ErrorMessage"]').should('not.exist');
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// export function checkForErrors() {
|
|
49
|
+
// cy.get('html')
|
|
50
|
+
// .first()
|
|
51
|
+
// .then((el) => {
|
|
52
|
+
// const result = hasError(el[0].innerHTML);
|
|
53
|
+
// expect(result).to.eq(false, 'Page has errors!' + (result && result.title));
|
|
54
|
+
// });
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
// // Helpers for checkForErrors()
|
|
58
|
+
// function hasError(html) {
|
|
59
|
+
// return hasNotice(html) || hasWarning(html) || hasException(html);
|
|
60
|
+
// }
|
|
61
|
+
// function hasNotice(html) {
|
|
62
|
+
// const result = /<b>Notice<\/b> \(/is.test(html);
|
|
63
|
+
// if (result) {
|
|
64
|
+
// // Try to determine error message
|
|
65
|
+
// const re = /<b>Notice<\/b> \([\d]+\)<\/a>: ([^\[]+)\[([^\]]+)\]/is,
|
|
66
|
+
// result2 = html.match(re);
|
|
67
|
+
// return {
|
|
68
|
+
// title: result2[1],
|
|
69
|
+
// line: result2[2],
|
|
70
|
+
// };
|
|
71
|
+
// }
|
|
72
|
+
// return false;
|
|
73
|
+
// }
|
|
74
|
+
// function hasWarning(html) {
|
|
75
|
+
// const result = /<b>Warning<\/b> \(/is.test(html);
|
|
76
|
+
// if (result) {
|
|
77
|
+
// // Try to determine error message
|
|
78
|
+
// const re = /<b>Warning<\/b> \([\d]+\)<\/a>: ([^\[]+)\[([^\]]+)\]/is,
|
|
79
|
+
// result2 = html.match(re);
|
|
80
|
+
// return {
|
|
81
|
+
// title: result2[1],
|
|
82
|
+
// line: result2[2],
|
|
83
|
+
// };
|
|
84
|
+
// }
|
|
85
|
+
// return false;
|
|
86
|
+
// }
|
|
87
|
+
// function hasException(html) {
|
|
88
|
+
// let result = /An Internal Error Has Occurred/is.test(html); // 'debug' mode is off
|
|
89
|
+
// if (result) {
|
|
90
|
+
// return {
|
|
91
|
+
// title: 'An Internal Error Has Occurred',
|
|
92
|
+
// line: null,
|
|
93
|
+
// };
|
|
94
|
+
// }
|
|
95
|
+
|
|
96
|
+
// result = /Exception/ism.test(html) && /stack-trace/is.test(html); // 'debug' mode is on
|
|
97
|
+
// if (result) {
|
|
98
|
+
// // Try to determine error message
|
|
99
|
+
// const re = /<h1 class="header-title">(.*)<\/h1>/is, // this is from DebugKit
|
|
100
|
+
// result2 = html.match(re);
|
|
101
|
+
// return {
|
|
102
|
+
// title: result2[1],
|
|
103
|
+
// line: result2[2],
|
|
104
|
+
// };
|
|
105
|
+
// }
|
|
106
|
+
|
|
107
|
+
// return false;
|
|
108
|
+
// }
|