graphdb-workbench-tests 3.2.0 → 3.2.1

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.
@@ -0,0 +1,54 @@
1
+ import {QueryStubs} from '../../stubs/yasgui/query-stubs.js';
2
+ import SparqlSteps from '../../steps/sparql-steps.js';
3
+ import {YasqeSteps} from '../../steps/yasgui/yasqe-steps.js';
4
+
5
+ describe('YASQE Themes', () => {
6
+
7
+ let repositoryId;
8
+ const THEME_PERSISTENCE_KEY = 'ls.workbench-settings';
9
+ beforeEach(() => {
10
+ cy.removeLocalStorage(THEME_PERSISTENCE_KEY);
11
+ repositoryId = 'yasqe-theme-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ cy.enableAutocomplete(repositoryId);
16
+ });
17
+
18
+ afterEach(() => {
19
+ cy.deleteRepository(repositoryId);
20
+ cy.removeLocalStorage(THEME_PERSISTENCE_KEY);
21
+ });
22
+
23
+ it('should apply the default theme if theme is not persisted in local store', () => {
24
+ // GIVEN: No theme is persisted.
25
+ cy.removeLocalStorage(THEME_PERSISTENCE_KEY);
26
+ // WHEN: A page is visited with ontotext-yasgui-web-component rendered in it.
27
+ SparqlSteps.visit();
28
+ YasqeSteps.getYasqe().should('be.visible');
29
+ // THEN the default theme should be applied.
30
+ YasqeSteps.getCodeMirrorEl().should('have.class', 'cm-s-default');
31
+ });
32
+
33
+ it('should apply the default theme if the light theme is persisted in local store', () => {
34
+ // GIVEN: light theme is persisted to local store
35
+ cy.setLocalStorage(THEME_PERSISTENCE_KEY, JSON.stringify({"theme":"default-theme","mode":"light"}));
36
+
37
+ // WHEN: A page is visited with ontotext-yasgui-web-component rendered in it.
38
+ SparqlSteps.visit();
39
+ YasqeSteps.getYasqe().should('be.visible');
40
+ // THEN the default theme should be applied.
41
+ YasqeSteps.getCodeMirrorEl().should('have.class', 'cm-s-default');
42
+ });
43
+
44
+ it('should apply the moxer theme if the dark theme is persisted in local store', () => {
45
+ // GIVEN: dark theme is persisted to local store
46
+ cy.setLocalStorage(THEME_PERSISTENCE_KEY, JSON.stringify({"theme":"default-theme","mode":"dark"}));
47
+
48
+ // WHEN: A page is visited with ontotext-yasgui-web-component rendered in it.
49
+ SparqlSteps.visit();
50
+ YasqeSteps.getYasqe().should('be.visible');
51
+ // THEN the moxer theme should be applied.
52
+ YasqeSteps.getCodeMirrorEl().should('have.class', 'cm-s-moxer');
53
+ });
54
+ });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.2.0",
9
+ "version": "3.2.1",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "@bahmutov/cypress-code-coverage": "^2.7.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -13,6 +13,10 @@ export class YasqeSteps {
13
13
  return YasqeSteps.getYasqe();
14
14
  }
15
15
 
16
+ static getCodeMirrorEl() {
17
+ return YasqeSteps.getEditor().find('.CodeMirror');
18
+ }
19
+
16
20
  static getCodeMirror() {
17
21
  return this.getEditor().find('.CodeMirror').then(($el) => {
18
22
  // @ts-ignore
@@ -109,12 +113,14 @@ export class YasqeSteps {
109
113
  * @return {Cypress.Chainable<unknown>}
110
114
  */
111
115
  static getQuery(delay = 0) {
116
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
112
117
  return cy.wait(delay).then(() => this.getCodeMirror()).then((cm) => {
113
118
  return cm.getValue();
114
119
  });
115
120
  }
116
121
 
117
122
  static getActiveTabQuery(delay = 0) {
123
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
118
124
  return cy.wait(delay).then(() => this.getActiveTabCodeMirror()).then((cm) => {
119
125
  return cm.getValue();
120
126
  });