@jahia/cypress 8.3.0 → 8.4.0
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/CHANGELOG.md +8 -0
- package/ci.startup.sh +11 -2
- package/dist/utils/ContentHelper.d.ts +30 -0
- package/dist/utils/ContentHelper.js +44 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +1 -1
- package/src/utils/ContentHelper.ts +56 -0
- package/src/utils/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @jahia/cypress Changelog
|
|
2
2
|
|
|
3
|
+
## 8.4.0
|
|
4
|
+
|
|
5
|
+
* Added `addPage` to create a page from a test, so each project no longer needs its own copy. It sets the page template and title, and leaves the page content to the caller: areas, content nodes and extra languages are passed in. (#245)
|
|
6
|
+
|
|
7
|
+
## 8.3.1
|
|
8
|
+
|
|
9
|
+
* Fixed CI startup so it fails immediately when an image cannot be pulled, instead of hanging until the job times out. The job log now shows the registry error instead of an unanswered confirmation prompt. (#243)
|
|
10
|
+
|
|
3
11
|
## 8.3.0
|
|
4
12
|
|
|
5
13
|
### New Features
|
package/ci.startup.sh
CHANGED
|
@@ -31,10 +31,19 @@ if [[ "${JAHIA_CLUSTER_ENABLED}" == "true" || ${JAHIA_CLUSTER_ENABLED} == true
|
|
|
31
31
|
export CLUSTER_PROFILE="--profile cluster"
|
|
32
32
|
fi
|
|
33
33
|
|
|
34
|
+
# Both docker-compose calls below read from /dev/null on purpose. docker-compose v1 answers an
|
|
35
|
+
# unusable image (wrong name, wrong registry, missing docker login) with an interactive
|
|
36
|
+
# confirmation prompt instead of an error. In CI nothing ever answers it, so the job hangs until
|
|
37
|
+
# it times out. With stdin closed the prompt fails immediately and the real registry error is
|
|
38
|
+
# reported, and the exit code is checked so the startup does not silently continue.
|
|
34
39
|
echo "$(date +'%d %B %Y - %k:%M') == Starting environment =="
|
|
35
|
-
docker-compose ${CLUSTER_PROFILE} up -d --renew-anon-volumes $(docker-compose config --services | grep -v "cypress")
|
|
40
|
+
if ! docker-compose ${CLUSTER_PROFILE} up -d --renew-anon-volumes $(docker-compose config --services | grep -v "cypress") < /dev/null; then
|
|
41
|
+
echo "$(date +'%d %B %Y - %k:%M') == STARTUP FAILURE, unable to start the environment. Check the image names, the registry and the docker login above =="
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
36
45
|
if [[ "$1" != "notests" ]]; then
|
|
37
46
|
docker ps -a
|
|
38
47
|
docker stats --no-stream
|
|
39
|
-
docker-compose up --abort-on-container-exit cypress
|
|
48
|
+
docker-compose up --abort-on-container-exit cypress < /dev/null
|
|
40
49
|
fi
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApolloOptions } from '../support';
|
|
2
|
+
export type AddPageOptions = {
|
|
3
|
+
/** Path or identifier of the node the page is added under. */
|
|
4
|
+
parentPathOrId: string;
|
|
5
|
+
/** JCR name of the page node — the last segment of its path. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Value of `j:templateName`. Required: `jnt:page` declares it mandatory. */
|
|
8
|
+
template: string;
|
|
9
|
+
/** Value of `jcr:title`. Set without `language`, it is stored unlocalized and read back in every language. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Language of `title`. */
|
|
12
|
+
language?: string;
|
|
13
|
+
/** Extra properties, set alongside the ones this helper derives. */
|
|
14
|
+
properties?: any[];
|
|
15
|
+
/** Nodes added under the page, in `addNode`'s `InputJCRNode` shape. */
|
|
16
|
+
children?: any[];
|
|
17
|
+
/** Mixins applied to the page node. */
|
|
18
|
+
mixins?: string[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Add a `jnt:page`, deriving `j:templateName` from `template` and `jcr:title` from
|
|
22
|
+
* `title`/`language`. Everything else — `properties`, `children`, `mixins` — reaches `addNode`
|
|
23
|
+
* untouched: the helper imposes no page structure, so a caller that needs an area, a text node
|
|
24
|
+
* or a second title language passes it in.
|
|
25
|
+
*
|
|
26
|
+
* @param options the page to add
|
|
27
|
+
* @param apolloOptions options forwarded to `cy.apollo`
|
|
28
|
+
* @returns the `addNode` mutation result
|
|
29
|
+
*/
|
|
30
|
+
export declare const addPage: (options: AddPageOptions, apolloOptions?: ApolloOptions) => Cypress.Chainable;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.addPage = void 0;
|
|
13
|
+
var JCRHelper_1 = require("./JCRHelper");
|
|
14
|
+
/**
|
|
15
|
+
* Add a `jnt:page`, deriving `j:templateName` from `template` and `jcr:title` from
|
|
16
|
+
* `title`/`language`. Everything else — `properties`, `children`, `mixins` — reaches `addNode`
|
|
17
|
+
* untouched: the helper imposes no page structure, so a caller that needs an area, a text node
|
|
18
|
+
* or a second title language passes it in.
|
|
19
|
+
*
|
|
20
|
+
* @param options the page to add
|
|
21
|
+
* @param apolloOptions options forwarded to `cy.apollo`
|
|
22
|
+
* @returns the `addNode` mutation result
|
|
23
|
+
*/
|
|
24
|
+
var addPage = function (options, apolloOptions) {
|
|
25
|
+
if (apolloOptions === void 0) { apolloOptions = {}; }
|
|
26
|
+
var parentPathOrId = options.parentPathOrId, name = options.name, template = options.template, title = options.title, language = options.language, _a = options.properties, properties = _a === void 0 ? [] : _a, _b = options.children, children = _b === void 0 ? [] : _b, _c = options.mixins, mixins = _c === void 0 ? [] : _c;
|
|
27
|
+
var pageProperties = __spreadArray(__spreadArray([], properties, true), [{ name: 'j:templateName', type: 'STRING', value: template }], false);
|
|
28
|
+
if (title !== undefined) {
|
|
29
|
+
var titleProperty = { name: 'jcr:title', type: 'STRING', value: title };
|
|
30
|
+
if (language !== undefined) {
|
|
31
|
+
titleProperty.language = language;
|
|
32
|
+
}
|
|
33
|
+
pageProperties.push(titleProperty);
|
|
34
|
+
}
|
|
35
|
+
return (0, JCRHelper_1.addNode)({
|
|
36
|
+
parentPathOrId: parentPathOrId,
|
|
37
|
+
name: name,
|
|
38
|
+
primaryNodeType: 'jnt:page',
|
|
39
|
+
properties: pageProperties,
|
|
40
|
+
children: children,
|
|
41
|
+
mixins: mixins
|
|
42
|
+
}, apolloOptions);
|
|
43
|
+
};
|
|
44
|
+
exports.addPage = addPage;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {ApolloOptions} from '../support';
|
|
2
|
+
import {addNode} from './JCRHelper';
|
|
3
|
+
|
|
4
|
+
export type AddPageOptions = {
|
|
5
|
+
/** Path or identifier of the node the page is added under. */
|
|
6
|
+
parentPathOrId: string;
|
|
7
|
+
/** JCR name of the page node — the last segment of its path. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Value of `j:templateName`. Required: `jnt:page` declares it mandatory. */
|
|
10
|
+
template: string;
|
|
11
|
+
/** Value of `jcr:title`. Set without `language`, it is stored unlocalized and read back in every language. */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** Language of `title`. */
|
|
14
|
+
language?: string;
|
|
15
|
+
/** Extra properties, set alongside the ones this helper derives. */
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
properties?: any [];
|
|
18
|
+
/** Nodes added under the page, in `addNode`'s `InputJCRNode` shape. */
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
children?: any [];
|
|
21
|
+
/** Mixins applied to the page node. */
|
|
22
|
+
mixins?: string [];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Add a `jnt:page`, deriving `j:templateName` from `template` and `jcr:title` from
|
|
27
|
+
* `title`/`language`. Everything else — `properties`, `children`, `mixins` — reaches `addNode`
|
|
28
|
+
* untouched: the helper imposes no page structure, so a caller that needs an area, a text node
|
|
29
|
+
* or a second title language passes it in.
|
|
30
|
+
*
|
|
31
|
+
* @param options the page to add
|
|
32
|
+
* @param apolloOptions options forwarded to `cy.apollo`
|
|
33
|
+
* @returns the `addNode` mutation result
|
|
34
|
+
*/
|
|
35
|
+
export const addPage = (options: AddPageOptions, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
|
|
36
|
+
const {parentPathOrId, name, template, title, language, properties = [], children = [], mixins = []} = options;
|
|
37
|
+
|
|
38
|
+
const pageProperties = [...properties, {name: 'j:templateName', type: 'STRING', value: template}];
|
|
39
|
+
if (title !== undefined) {
|
|
40
|
+
const titleProperty: Record<string, string> = {name: 'jcr:title', type: 'STRING', value: title};
|
|
41
|
+
if (language !== undefined) {
|
|
42
|
+
titleProperty.language = language;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
pageProperties.push(titleProperty);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return addNode({
|
|
49
|
+
parentPathOrId: parentPathOrId,
|
|
50
|
+
name: name,
|
|
51
|
+
primaryNodeType: 'jnt:page',
|
|
52
|
+
properties: pageProperties,
|
|
53
|
+
children: children,
|
|
54
|
+
mixins: mixins
|
|
55
|
+
}, apolloOptions);
|
|
56
|
+
};
|
package/src/utils/index.ts
CHANGED