@jahia/cypress 1.1.0 → 1.1.3
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/dist/page-object/moonstone/collapsible.d.ts +6 -0
- package/dist/page-object/moonstone/collapsible.js +46 -0
- package/dist/page-object/moonstone/index.d.ts +1 -0
- package/dist/page-object/moonstone/index.js +1 -0
- package/dist/support/apollo/apollo.d.ts +3 -4
- package/dist/support/provisioning/index.d.ts +1 -0
- package/dist/support/provisioning/index.js +1 -0
- package/dist/support/provisioning/installBundle.js +1 -4
- package/dist/support/provisioning/runProvisioningScript.d.ts +8 -8
- package/dist/support/provisioning/runProvisioningScript.js +14 -3
- package/dist/support/registerSupport.js +1 -0
- package/dist/support/repeatUntil.d.ts +1 -2
- package/jahia-cypress.iml +11 -0
- package/package.json +1 -1
- package/src/page-object/moonstone/collapsible.ts +24 -0
- package/src/page-object/moonstone/index.ts +1 -0
- package/src/support/apollo/apollo.ts +3 -3
- package/src/support/provisioning/index.ts +1 -0
- package/src/support/provisioning/installBundle.ts +2 -5
- package/src/support/provisioning/runProvisioningScript.ts +22 -8
- package/src/support/registerSupport.ts +3 -2
- package/src/support/repeatUntil.ts +1 -1
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -11
- package/.graphqlconfig +0 -16
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
exports.__esModule = true;
|
|
18
|
+
exports.Collapsible = void 0;
|
|
19
|
+
var baseComponent_1 = require("../baseComponent");
|
|
20
|
+
var Collapsible = /** @class */ (function (_super) {
|
|
21
|
+
__extends(Collapsible, _super);
|
|
22
|
+
function Collapsible() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
Collapsible.prototype.collapse = function () {
|
|
26
|
+
var _this = this;
|
|
27
|
+
this.get().children('div').then(function ($child) {
|
|
28
|
+
if ($child.hasClass('moonstone-collapsible_content_expanded')) {
|
|
29
|
+
_this.get().find('.moonstone-collapsible_button').click();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return this;
|
|
33
|
+
};
|
|
34
|
+
Collapsible.prototype.expand = function () {
|
|
35
|
+
var _this = this;
|
|
36
|
+
this.get().children('div').then(function ($child) {
|
|
37
|
+
if ($child.hasClass('moonstone-collapsible_content_collapsed')) {
|
|
38
|
+
_this.get().find('.moonstone-collapsible_button').click().scrollIntoView();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return this;
|
|
42
|
+
};
|
|
43
|
+
Collapsible.defaultSelector = '.moonstone-collapsible';
|
|
44
|
+
return Collapsible;
|
|
45
|
+
}(baseComponent_1.BaseComponent));
|
|
46
|
+
exports.Collapsible = Collapsible;
|
|
@@ -12,6 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
exports.__esModule = true;
|
|
13
13
|
__exportStar(require("./accordion"), exports);
|
|
14
14
|
__exportStar(require("./button"), exports);
|
|
15
|
+
__exportStar(require("./collapsible"), exports);
|
|
15
16
|
__exportStar(require("./dropdown"), exports);
|
|
16
17
|
__exportStar(require("./menu"), exports);
|
|
17
18
|
__exportStar(require("./pagination"), exports);
|
|
@@ -7,12 +7,11 @@ declare global {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
declare type FileQueryOptions = Partial<QueryOptions> & {
|
|
10
|
+
export declare type FileQueryOptions = Partial<QueryOptions> & {
|
|
11
11
|
queryFile?: string;
|
|
12
12
|
};
|
|
13
|
-
declare type FileMutationOptions = Partial<MutationOptions> & {
|
|
13
|
+
export declare type FileMutationOptions = Partial<MutationOptions> & {
|
|
14
14
|
mutationFile?: string;
|
|
15
15
|
};
|
|
16
|
-
declare type ApolloOptions = (QueryOptions | MutationOptions | FileQueryOptions | FileMutationOptions) & Partial<Cypress.Loggable>;
|
|
16
|
+
export declare type ApolloOptions = (QueryOptions | MutationOptions | FileQueryOptions | FileMutationOptions) & Partial<Cypress.Loggable>;
|
|
17
17
|
export declare const apollo: (apollo: ApolloClient<any>, options: ApolloOptions) => void;
|
|
18
|
-
export {};
|
|
@@ -12,3 +12,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
exports.__esModule = true;
|
|
13
13
|
__exportStar(require("./executeGroovy"), exports);
|
|
14
14
|
__exportStar(require("./runProvisioningScript"), exports);
|
|
15
|
+
__exportStar(require("./installBundle"), exports);
|
|
@@ -4,10 +4,7 @@ exports.__esModule = true;
|
|
|
4
4
|
exports.installBundle = void 0;
|
|
5
5
|
/// <reference types="cypress" />
|
|
6
6
|
var installBundle = function (bundleFile) {
|
|
7
|
-
cy.runProvisioningScript({
|
|
8
|
-
fileContent: '- installBundle: "' + bundleFile + '"',
|
|
9
|
-
type: 'application/yaml'
|
|
10
|
-
}, [{
|
|
7
|
+
cy.runProvisioningScript([{ installBundle: bundleFile }], [{
|
|
11
8
|
fileName: bundleFile,
|
|
12
9
|
type: 'text/plain'
|
|
13
10
|
}]);
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
declare global {
|
|
3
3
|
namespace Cypress {
|
|
4
4
|
interface Chainable<Subject> {
|
|
5
|
-
runProvisioningScript(script: FormFile, files?: FormFile[], jahiaServer?: JahiaServer): Chainable<any>;
|
|
5
|
+
runProvisioningScript(script: FormFile | StringDictionary[], files?: FormFile[], jahiaServer?: JahiaServer): Chainable<any>;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
declare type
|
|
9
|
+
export declare type StringDictionary = {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
12
|
+
export declare type FormFile = {
|
|
10
13
|
fileName?: string;
|
|
11
14
|
fileContent?: string;
|
|
12
15
|
type?: string;
|
|
13
16
|
encoding?: Cypress.Encodings;
|
|
14
|
-
replacements?:
|
|
15
|
-
[key: string]: string;
|
|
16
|
-
};
|
|
17
|
+
replacements?: StringDictionary;
|
|
17
18
|
};
|
|
18
|
-
declare type JahiaServer = {
|
|
19
|
+
export declare type JahiaServer = {
|
|
19
20
|
url: string;
|
|
20
21
|
username: string;
|
|
21
22
|
password: string;
|
|
22
23
|
};
|
|
23
|
-
export declare const runProvisioningScript: (script: FormFile, files?: FormFile[], jahiaServer?: JahiaServer, options?: Cypress.Loggable) => void;
|
|
24
|
-
export {};
|
|
24
|
+
export declare const runProvisioningScript: (script: FormFile | StringDictionary[], files?: FormFile[], jahiaServer?: JahiaServer, options?: Cypress.Loggable) => void;
|
|
@@ -15,7 +15,7 @@ function append(formFile, formData, key) {
|
|
|
15
15
|
if (formFile.fileContent) {
|
|
16
16
|
formData.append(key, processContent(formFile), formFile.fileName);
|
|
17
17
|
}
|
|
18
|
-
else {
|
|
18
|
+
else if (formFile.fileName) {
|
|
19
19
|
cy.fixture(formFile.fileName, (formFile.encoding ? formFile.encoding : 'binary')).then(function (content) {
|
|
20
20
|
if (typeof content === 'object') {
|
|
21
21
|
formFile.fileContent = JSON.stringify(content);
|
|
@@ -32,11 +32,22 @@ var serverDefaults = {
|
|
|
32
32
|
username: 'root',
|
|
33
33
|
password: Cypress.env('SUPER_USER_PASSWORD')
|
|
34
34
|
};
|
|
35
|
+
function isFormFile(script) {
|
|
36
|
+
return Boolean(script.fileContent || script.fileName);
|
|
37
|
+
}
|
|
35
38
|
var runProvisioningScript = function (script, files, jahiaServer, options) {
|
|
36
39
|
if (jahiaServer === void 0) { jahiaServer = serverDefaults; }
|
|
37
40
|
if (options === void 0) { options = { log: true }; }
|
|
38
41
|
var formData = new FormData();
|
|
39
|
-
|
|
42
|
+
if (isFormFile(script)) {
|
|
43
|
+
append(script, formData, "script");
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
append({
|
|
47
|
+
fileContent: JSON.stringify(script),
|
|
48
|
+
type: 'application/json'
|
|
49
|
+
}, formData, "script");
|
|
50
|
+
}
|
|
40
51
|
if (files) {
|
|
41
52
|
files.forEach(function (f) {
|
|
42
53
|
append(f, formData, "file");
|
|
@@ -50,7 +61,7 @@ var runProvisioningScript = function (script, files, jahiaServer, options) {
|
|
|
50
61
|
autoEnd: false,
|
|
51
62
|
name: 'runProvisioningScript',
|
|
52
63
|
displayName: 'provScript',
|
|
53
|
-
message: "Run " + (script.fileName ? script.fileName : 'inline script'),
|
|
64
|
+
message: "Run " + (isFormFile(script) && script.fileName ? script.fileName : 'inline script') + " towards server: " + jahiaServer.url,
|
|
54
65
|
consoleProps: function () {
|
|
55
66
|
return {
|
|
56
67
|
Script: script,
|
|
@@ -16,6 +16,7 @@ var registerSupport = function () {
|
|
|
16
16
|
Cypress.Commands.add('apollo', { prevSubject: 'optional' }, apollo_1.apollo);
|
|
17
17
|
Cypress.Commands.add('runProvisioningScript', provisioning_1.runProvisioningScript);
|
|
18
18
|
Cypress.Commands.add('executeGroovy', provisioning_1.executeGroovy);
|
|
19
|
+
Cypress.Commands.add('installBundle', provisioning_1.installBundle);
|
|
19
20
|
Cypress.Commands.add('login', login_1.login);
|
|
20
21
|
Cypress.Commands.add('logout', logout_1.logout);
|
|
21
22
|
Cypress.Commands.add('repeatUntil', repeatUntil_1.repeatUntil);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="cypress" />
|
|
2
|
-
declare type RepeatUntilOptions = {
|
|
2
|
+
export declare type RepeatUntilOptions = {
|
|
3
3
|
attempts: number;
|
|
4
4
|
callback: () => void;
|
|
5
5
|
delay: number;
|
|
@@ -12,4 +12,3 @@ declare global {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
export declare const repeatUntil: (selector: string, options?: Partial<RepeatUntilOptions>) => void;
|
|
15
|
-
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$">
|
|
6
|
+
<sourceFolder url="file://$MODULE_DIR$/fixtures/groovy/admin" isTestSource="false" />
|
|
7
|
+
</content>
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
</component>
|
|
11
|
+
</module>
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {BaseComponent} from "../baseComponent"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Collapsible extends BaseComponent {
|
|
5
|
+
static defaultSelector = '.moonstone-collapsible'
|
|
6
|
+
|
|
7
|
+
collapse(): Collapsible {
|
|
8
|
+
this.get().children('div').then(($child) => {
|
|
9
|
+
if ($child.hasClass('moonstone-collapsible_content_expanded')) {
|
|
10
|
+
this.get().find('.moonstone-collapsible_button').click()
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
return this
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
expand(): Collapsible {
|
|
17
|
+
this.get().children('div').then(($child) => {
|
|
18
|
+
if ($child.hasClass('moonstone-collapsible_content_collapsed')) {
|
|
19
|
+
this.get().find('.moonstone-collapsible_button').click().scrollIntoView()
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
return this
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -15,9 +15,9 @@ declare global {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
type FileQueryOptions = Partial<QueryOptions> & { queryFile?: string }
|
|
19
|
-
type FileMutationOptions = Partial<MutationOptions> & { mutationFile?: string }
|
|
20
|
-
type ApolloOptions = (QueryOptions | MutationOptions | FileQueryOptions | FileMutationOptions) & Partial<Cypress.Loggable>;
|
|
18
|
+
export type FileQueryOptions = Partial<QueryOptions> & { queryFile?: string }
|
|
19
|
+
export type FileMutationOptions = Partial<MutationOptions> & { mutationFile?: string }
|
|
20
|
+
export type ApolloOptions = (QueryOptions | MutationOptions | FileQueryOptions | FileMutationOptions) & Partial<Cypress.Loggable>;
|
|
21
21
|
|
|
22
22
|
function isQuery(options: ApolloOptions): options is QueryOptions {
|
|
23
23
|
return (<QueryOptions>options).query !== undefined;
|
|
@@ -15,11 +15,8 @@ declare global {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const installBundle = function (bundleFile: string): void {
|
|
18
|
-
cy.runProvisioningScript({
|
|
19
|
-
fileContent: '- installBundle: "' + bundleFile + '"',
|
|
20
|
-
type: 'application/yaml'
|
|
21
|
-
}, [{
|
|
18
|
+
cy.runProvisioningScript([{ installBundle: bundleFile }], [{
|
|
22
19
|
fileName: bundleFile,
|
|
23
20
|
type: 'text/plain'
|
|
24
21
|
}])
|
|
25
|
-
}
|
|
22
|
+
}
|
|
@@ -9,20 +9,22 @@ declare global {
|
|
|
9
9
|
namespace Cypress {
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
11
|
interface Chainable<Subject> {
|
|
12
|
-
runProvisioningScript(script: FormFile, files?: FormFile[], jahiaServer?: JahiaServer): Chainable<any>
|
|
12
|
+
runProvisioningScript(script: FormFile | StringDictionary[], files?: FormFile[], jahiaServer?: JahiaServer): Chainable<any>
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
type
|
|
17
|
+
export type StringDictionary = { [key: string]: string }
|
|
18
|
+
|
|
19
|
+
export type FormFile = {
|
|
18
20
|
fileName?: string,
|
|
19
21
|
fileContent?: string,
|
|
20
22
|
type?: string,
|
|
21
23
|
encoding?: Cypress.Encodings
|
|
22
|
-
replacements?:
|
|
24
|
+
replacements?: StringDictionary
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
type JahiaServer = {
|
|
27
|
+
export type JahiaServer = {
|
|
26
28
|
url: string;
|
|
27
29
|
username: string;
|
|
28
30
|
password: string
|
|
@@ -40,7 +42,7 @@ function processContent(formFile: FormFile) {
|
|
|
40
42
|
function append(formFile: FormFile, formData: FormData, key: string) {
|
|
41
43
|
if (formFile.fileContent) {
|
|
42
44
|
formData.append(key, processContent(formFile), formFile.fileName);
|
|
43
|
-
} else {
|
|
45
|
+
} else if (formFile.fileName) {
|
|
44
46
|
cy.fixture(formFile.fileName, (formFile.encoding ? formFile.encoding : 'binary')).then(content => {
|
|
45
47
|
if (typeof content === 'object') {
|
|
46
48
|
formFile.fileContent = JSON.stringify(content);
|
|
@@ -58,10 +60,22 @@ const serverDefaults: JahiaServer = {
|
|
|
58
60
|
password: Cypress.env('SUPER_USER_PASSWORD')
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
function isFormFile(script: FormFile | StringDictionary[]): script is FormFile {
|
|
64
|
+
return Boolean((script as FormFile).fileContent || (script as FormFile).fileName);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const runProvisioningScript = (script: FormFile | StringDictionary[], files?: FormFile[], jahiaServer: JahiaServer = serverDefaults, options: Cypress.Loggable = {log:true}): void => {
|
|
62
68
|
const formData = new FormData()
|
|
63
69
|
|
|
64
|
-
|
|
70
|
+
if (isFormFile(script)) {
|
|
71
|
+
append(script, formData, "script")
|
|
72
|
+
} else {
|
|
73
|
+
append({
|
|
74
|
+
fileContent: JSON.stringify(script),
|
|
75
|
+
type: 'application/json'
|
|
76
|
+
}, formData, "script");
|
|
77
|
+
}
|
|
78
|
+
|
|
65
79
|
if (files) {
|
|
66
80
|
files.forEach((f) => {
|
|
67
81
|
append(f, formData, "file")
|
|
@@ -77,7 +91,7 @@ export const runProvisioningScript = (script: FormFile, files?: FormFile[], jahi
|
|
|
77
91
|
autoEnd: false,
|
|
78
92
|
name: 'runProvisioningScript',
|
|
79
93
|
displayName: 'provScript',
|
|
80
|
-
message: `Run ${script.fileName ? script.fileName : 'inline script'}`,
|
|
94
|
+
message: `Run ${isFormFile(script) && script.fileName ? script.fileName : 'inline script'} towards server: ${jahiaServer.url}`,
|
|
81
95
|
consoleProps: () => {
|
|
82
96
|
return {
|
|
83
97
|
Script: script,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {apollo, apolloClient} from "./apollo"
|
|
2
|
-
import {executeGroovy, runProvisioningScript} from "./provisioning"
|
|
2
|
+
import {executeGroovy, runProvisioningScript, installBundle} from "./provisioning"
|
|
3
3
|
import {login} from "./login"
|
|
4
4
|
import {logout} from "./logout"
|
|
5
5
|
import installLogsCollector from 'cypress-terminal-report/src/installLogsCollector'
|
|
@@ -12,6 +12,7 @@ export const registerSupport = (): void => {
|
|
|
12
12
|
|
|
13
13
|
Cypress.Commands.add('runProvisioningScript', runProvisioningScript)
|
|
14
14
|
Cypress.Commands.add('executeGroovy', executeGroovy)
|
|
15
|
+
Cypress.Commands.add('installBundle', installBundle)
|
|
15
16
|
|
|
16
17
|
Cypress.Commands.add('login', login)
|
|
17
18
|
Cypress.Commands.add('logout', logout)
|
|
@@ -20,4 +21,4 @@ export const registerSupport = (): void => {
|
|
|
20
21
|
Cypress.Commands.overwrite('fixture', fixture)
|
|
21
22
|
|
|
22
23
|
installLogsCollector()
|
|
23
|
-
}
|
|
24
|
+
}
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules
|
package/.eslintrc.json
DELETED
package/.graphqlconfig
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Untitled GraphQL Schema",
|
|
3
|
-
"schemaPath": "schema.graphql",
|
|
4
|
-
"extensions": {
|
|
5
|
-
"endpoints": {
|
|
6
|
-
"Default GraphQL Endpoint": {
|
|
7
|
-
"url": "http://localhost:8080/modules/graphql",
|
|
8
|
-
"headers": {
|
|
9
|
-
"user-agent": "JS GraphQL",
|
|
10
|
-
"Authorization": "Basic cm9vdDpyb290MTIzNA=="
|
|
11
|
-
},
|
|
12
|
-
"introspect": true
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|