@jahia/cypress 4.2.0 → 4.3.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/ci.startup.sh CHANGED
@@ -27,12 +27,12 @@ if [[ -z ${JAHIA_LICENSE} ]]; then
27
27
  fi
28
28
 
29
29
  echo "$(date +'%d %B %Y - %k:%M') == Cluster enabled: ${JAHIA_CLUSTER_ENABLED} =="
30
- if [[ "${JAHIA_CLUSTER_ENABLED}" == "true" ]]; then
30
+ if [[ "${JAHIA_CLUSTER_ENABLED}" == "true" || ${JAHIA_CLUSTER_ENABLED} == true ]]; then
31
31
  export CLUSTER_PROFILE="--profile cluster"
32
32
  fi
33
33
 
34
34
  echo "$(date +'%d %B %Y - %k:%M') == Starting environment =="
35
- docker-compose up -d --renew-anon-volumes ${CLUSTER_PROFILE}
35
+ docker-compose ${CLUSTER_PROFILE} up -d --renew-anon-volumes
36
36
  if [[ "$1" != "notests" ]]; then
37
37
  docker ps -a
38
38
  docker stats --no-stream
@@ -33,8 +33,8 @@ var Menu = /** @class */ (function (_super) {
33
33
  this.get().find('.moonstone-menuItem').contains(item).should('be.visible');
34
34
  };
35
35
  Menu.prototype.shouldHaveRoleItem = function (role) {
36
- this.get().find(".moonstone-menuItem[data-sel-role=" + role + "]").scrollIntoView();
37
- this.get().find(".moonstone-menuItem[data-sel-role=" + role + "]").should('be.visible');
36
+ this.get().find(".moonstone-menuItem[data-sel-role=\"" + role + "\"]").scrollIntoView();
37
+ this.get().find(".moonstone-menuItem[data-sel-role=\"" + role + "\"]").should('be.visible');
38
38
  };
39
39
  Menu.prototype.shouldNotHaveItem = function (item) {
40
40
  this.get().find('.moonstone-menuItem').contains(item).should('not.exist');
@@ -2,10 +2,16 @@
2
2
  declare global {
3
3
  namespace Cypress {
4
4
  interface Chainable<Subject> {
5
- login(username?: string, password?: string, url?: string): Chainable<Cypress.Response<any>>;
5
+ login(username?: string, password?: string, config?: string | {
6
+ url?: string;
7
+ rememberMe?: boolean;
8
+ }): Chainable<Cypress.Response<any>>;
6
9
  loginAndStoreSession(username?: string, password?: string, url?: string): Chainable<Cypress.Response<any>>;
7
10
  }
8
11
  }
9
12
  }
10
- export declare const login: (username?: string, password?: string, url?: string) => void;
13
+ export declare const login: (username: string, password: string, config: string | {
14
+ url?: string;
15
+ rememberMe?: boolean;
16
+ }) => void;
11
17
  export declare const loginAndStoreSession: (username?: string, password?: string, url?: string) => void;
@@ -3,10 +3,12 @@
3
3
  exports.__esModule = true;
4
4
  exports.loginAndStoreSession = exports.login = void 0;
5
5
  /// <reference types="cypress" />
6
- var login = function (username, password, url) {
6
+ // Disable linter to keep as this for backward compatibility
7
+ // eslint-disable-next-line default-param-last
8
+ var login = function (username, password, config) {
9
+ var _a;
7
10
  if (username === void 0) { username = 'root'; }
8
11
  if (password === void 0) { password = Cypress.env('SUPER_USER_PASSWORD'); }
9
- if (url === void 0) { url = '/cms/login'; }
10
12
  Cypress.log({
11
13
  name: 'login',
12
14
  message: "Login with " + username,
@@ -16,10 +18,21 @@ var login = function (username, password, url) {
16
18
  };
17
19
  }
18
20
  });
21
+ var body = { username: username, password: password };
22
+ var url = '/cms/login';
23
+ if (typeof config === 'object') {
24
+ if (config.rememberMe) {
25
+ body.useCookie = 'on';
26
+ }
27
+ url = (_a = config.url) !== null && _a !== void 0 ? _a : url;
28
+ }
29
+ else {
30
+ url = config !== null && config !== void 0 ? config : url;
31
+ }
19
32
  cy.request({
20
33
  method: 'POST',
21
34
  form: true,
22
- body: { username: username, password: password },
35
+ body: body,
23
36
  followRedirect: false,
24
37
  log: false,
25
38
  url: url
@@ -6,9 +6,9 @@ export declare const addNode: (variables: {
6
6
  parentPathOrId: string;
7
7
  primaryNodeType: string;
8
8
  name: string;
9
- properties?: [];
10
- children?: [];
11
- mixins?: [];
9
+ properties?: any[];
10
+ children?: any[];
11
+ mixins?: string[];
12
12
  }) => Cypress.Chainable;
13
13
  export declare const addMixins: (pathOrId: string, mixins: string[]) => Cypress.Chainable;
14
14
  export declare const getNodeByPath: (path: string, properties?: string[], language?: string, childrenTypes?: string[], workspace?: Workspace) => Cypress.Chainable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/cypress",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "lint": "eslint src -c .eslintrc.json --ext .ts --max-warnings=0"
@@ -18,8 +18,8 @@ export class Menu extends BaseComponent {
18
18
  }
19
19
 
20
20
  shouldHaveRoleItem(role: string):void {
21
- this.get().find(`.moonstone-menuItem[data-sel-role=${role}]`).scrollIntoView();
22
- this.get().find(`.moonstone-menuItem[data-sel-role=${role}]`).should('be.visible');
21
+ this.get().find(`.moonstone-menuItem[data-sel-role="${role}"]`).scrollIntoView();
22
+ this.get().find(`.moonstone-menuItem[data-sel-role="${role}"]`).should('be.visible');
23
23
  }
24
24
 
25
25
  shouldNotHaveItem(item: string):void {
@@ -7,13 +7,14 @@ declare global {
7
7
  namespace Cypress {
8
8
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
9
  interface Chainable<Subject> {
10
- login(username?: string, password?: string, url?: string): Chainable<Cypress.Response<any>>
10
+ login(username?: string, password?: string, config?: string| {url?: string; rememberMe?: boolean}): Chainable<Cypress.Response<any>>
11
11
  loginAndStoreSession(username?: string, password?: string, url?: string): Chainable<Cypress.Response<any>>
12
12
  }
13
13
  }
14
14
  }
15
-
16
- export const login = (username = 'root', password: string = Cypress.env('SUPER_USER_PASSWORD'), url = '/cms/login'): void => {
15
+ // Disable linter to keep as this for backward compatibility
16
+ // eslint-disable-next-line default-param-last
17
+ export const login = (username = 'root', password: string = Cypress.env('SUPER_USER_PASSWORD'), config: string | { url?: string, rememberMe?: boolean }): void => {
17
18
  Cypress.log({
18
19
  name: 'login',
19
20
  message: `Login with ${username}`,
@@ -23,11 +24,22 @@ export const login = (username = 'root', password: string = Cypress.env('SUPER_U
23
24
  };
24
25
  }
25
26
  });
27
+ const body: {username: string, password: string, useCookie?: string} = {username, password};
28
+ let url = '/cms/login';
29
+ if (typeof config === 'object') {
30
+ if (config.rememberMe) {
31
+ body.useCookie = 'on';
32
+ }
33
+
34
+ url = config.url ?? url;
35
+ } else {
36
+ url = config ?? url;
37
+ }
26
38
 
27
39
  cy.request({
28
40
  method: 'POST',
29
41
  form: true,
30
- body: {username, password},
42
+ body,
31
43
  followRedirect: false,
32
44
  log: false,
33
45
  url
@@ -42,9 +42,11 @@ export const addNode = (variables: {
42
42
  parentPathOrId: string,
43
43
  primaryNodeType: string,
44
44
  name: string,
45
- properties?: [],
46
- children?: [],
47
- mixins?: []
45
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
+ properties?: any [],
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ children?: any [],
49
+ mixins?: string []
48
50
  }): Cypress.Chainable => {
49
51
  return cy.apollo({
50
52
  variables: variables,