@jahia/cypress 3.17.2 → 3.17.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.
@@ -1,6 +1,9 @@
1
1
  import { BaseComponent } from '../baseComponent';
2
2
  export declare class Menu extends BaseComponent {
3
3
  static defaultSelector: string;
4
+ submenu(item: string, menu: string): Menu;
5
+ shouldHaveItem(item: string): void;
6
+ shouldNotHaveItem(item: string): void;
4
7
  select(item: string): Menu;
5
8
  selectByRole(item: string): Menu;
6
9
  }
@@ -17,21 +17,28 @@ var __extends = (this && this.__extends) || (function () {
17
17
  exports.__esModule = true;
18
18
  exports.Menu = void 0;
19
19
  var baseComponent_1 = require("../baseComponent");
20
+ var utils_1 = require("../utils");
20
21
  var Menu = /** @class */ (function (_super) {
21
22
  __extends(Menu, _super);
22
23
  function Menu() {
23
24
  return _super !== null && _super.apply(this, arguments) || this;
24
25
  }
26
+ Menu.prototype.submenu = function (item, menu) {
27
+ this.get().find('.moonstone-menuItem').contains(item).should('be.visible').realHover();
28
+ return utils_1.getComponentByRole(Menu, menu);
29
+ };
30
+ Menu.prototype.shouldHaveItem = function (item) {
31
+ this.get().find('.moonstone-menuItem').contains(item).should('be.visible');
32
+ };
33
+ Menu.prototype.shouldNotHaveItem = function (item) {
34
+ this.get().find('.moonstone-menuItem').contains(item).should('not.exist');
35
+ };
25
36
  Menu.prototype.select = function (item) {
26
- // eslint-disable-next-line cypress/no-unnecessary-waiting
27
- cy.wait(500);
28
- this.get().find('.moonstone-menuItem').should('contain', item).contains(item).trigger('click');
37
+ this.get().find('.moonstone-menuItem').contains(item).should('be.visible').trigger('click');
29
38
  return this;
30
39
  };
31
40
  Menu.prototype.selectByRole = function (item) {
32
- // eslint-disable-next-line cypress/no-unnecessary-waiting
33
- cy.wait(500);
34
- this.get().find(".moonstone-menuItem[data-sel-role=\"" + item + "\"]").trigger('click');
41
+ this.get().find(".moonstone-menuItem[data-sel-role=\"" + item + "\"]").should('be.visible').trigger('click');
35
42
  return this;
36
43
  };
37
44
  Menu.defaultSelector = '.moonstone-menu:not(.moonstone-hidden)';
@@ -1 +1,2 @@
1
1
  import 'cypress-wait-until';
2
+ import 'cypress-real-events';
@@ -1,3 +1,4 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
3
  require("cypress-wait-until");
4
+ require("cypress-real-events");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/cypress",
3
- "version": "3.17.2",
3
+ "version": "3.17.3",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "lint": "eslint src -c .eslintrc.json --ext .ts"
@@ -18,11 +18,11 @@
18
18
  "@jahia/eslint-config": "^1.1.0",
19
19
  "@typescript-eslint/eslint-plugin": "^4.29.3",
20
20
  "@typescript-eslint/parser": "^4.29.3",
21
+ "cross-fetch": "^3.1.5",
21
22
  "cypress": "^12.2.0",
22
23
  "cypress-wait-until": "^1.7.2",
23
24
  "eslint": "^7.32.0",
24
25
  "eslint-plugin-cypress": "^2.11.3",
25
- "cross-fetch": "^3.1.5",
26
26
  "eslint-plugin-jest": "^27.2.1",
27
27
  "eslint-plugin-react": "^7.32.2",
28
28
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@apollo/client": "^3.4.9",
33
+ "cypress-real-events": "^1.11.0",
33
34
  "graphql": "^15.5.0",
34
35
  "graphql-tag": "^2.11.0"
35
36
  }
@@ -1,19 +1,29 @@
1
1
  import {BaseComponent} from '../baseComponent';
2
+ import {getComponentByRole} from '../utils';
2
3
 
3
4
  export class Menu extends BaseComponent {
4
5
  static defaultSelector = '.moonstone-menu:not(.moonstone-hidden)'
5
6
 
7
+ submenu(item: string, menu: string): Menu {
8
+ this.get().find('.moonstone-menuItem').contains(item).should('be.visible').realHover();
9
+ return getComponentByRole(Menu, menu);
10
+ }
11
+
12
+ shouldHaveItem(item: string):void {
13
+ this.get().find('.moonstone-menuItem').contains(item).should('be.visible');
14
+ }
15
+
16
+ shouldNotHaveItem(item: string):void {
17
+ this.get().find('.moonstone-menuItem').contains(item).should('not.exist');
18
+ }
19
+
6
20
  select(item: string): Menu {
7
- // eslint-disable-next-line cypress/no-unnecessary-waiting
8
- cy.wait(500);
9
- this.get().find('.moonstone-menuItem').should('contain', item).contains(item).trigger('click');
21
+ this.get().find('.moonstone-menuItem').contains(item).should('be.visible').trigger('click');
10
22
  return this;
11
23
  }
12
24
 
13
25
  selectByRole(item: string): Menu {
14
- // eslint-disable-next-line cypress/no-unnecessary-waiting
15
- cy.wait(500);
16
- this.get().find(`.moonstone-menuItem[data-sel-role="${item}"]`).trigger('click');
26
+ this.get().find(`.moonstone-menuItem[data-sel-role="${item}"]`).should('be.visible').trigger('click');
17
27
  return this;
18
28
  }
19
29
  }
@@ -1 +1,2 @@
1
1
  import 'cypress-wait-until';
2
+ import 'cypress-real-events';
package/tsconfig.json CHANGED
@@ -6,7 +6,12 @@
6
6
  "declaration": true,
7
7
  "moduleResolution": "node",
8
8
  "allowSyntheticDefaultImports": true,
9
- "esModuleInterop": true
9
+ "esModuleInterop": true,
10
+ "types": [
11
+ "cypress",
12
+ "node",
13
+ "cypress-real-events"
14
+ ]
10
15
  },
11
16
  "include": [
12
17
  "./src/**/*"