graphdb-workbench-tests 2.8.2 → 2.8.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.
@@ -387,7 +387,7 @@ describe('Graphs config', () => {
387
387
  VisualGraphSteps.editConfig(graphConfigName);
388
388
  // And I open the expand query wizard tab
389
389
  VisualGraphSteps.openConfigWizardTab(2);
390
- VisualGraphSteps.getConfigWizardTab(2).should('have.class', 'active');
390
+ VisualGraphSteps.getConfigWizardTab(2).should('be.visible').and('have.class', 'active');
391
391
  // When I click cancel without changing the query
392
392
  VisualGraphSteps.cancelSaveConfig();
393
393
  // Then I expect a confirmation for leaving the page
@@ -1,6 +1,7 @@
1
1
  import {VisualGraphSteps} from "../../../steps/visual-graph-steps";
2
2
  import {ApplicationSteps} from "../../../steps/application-steps";
3
3
  import {LicenseStubs} from "../../../stubs/license-stubs";
4
+ import {AutocompleteStubs} from "../../../stubs/autocomplete/autocomplete-stubs";
4
5
 
5
6
  const FILE_TO_IMPORT = 'wine.rdf';
6
7
  const VALID_RESOURCE = 'USRegion';
@@ -30,7 +31,7 @@ describe('Visual graph screen validation', () => {
30
31
  VisualGraphSteps.getSearchField().should('be.visible').type('http://');
31
32
 
32
33
  // Verify that a message with a redirection to the autocomplete section is displayed.
33
- cy.get('.autocomplete-toast a').should('contain', 'Autocomplete is OFF')
34
+ VisualGraphSteps.getAutocompleteToast().should('contain', 'Autocomplete is OFF')
34
35
  .and('contain', 'Go to Setup -> Autocomplete').click();
35
36
  // The link in notification should redirect to the autocomplete page
36
37
  cy.url().should('include', '/autocomplete');
@@ -54,8 +55,16 @@ describe('Visual graph screen validation', () => {
54
55
  });
55
56
 
56
57
  it('Test search for a valid resource', () => {
58
+ AutocompleteStubs.spyAutocompleteStatus();
57
59
  VisualGraphSteps.visit();
58
- cy.wait('@get-license');
60
+ // Verify autocomplete is ON, because sometimes in CI it is OFF and fails when searching for Resource
61
+ cy.wait('@autocompleteStatus')
62
+ .its('response.body')
63
+ .should('equal', true);
64
+ cy.wait('@get-license')
65
+ .its('response.statusCode')
66
+ .should('equal', 200);
67
+ VisualGraphSteps.verifyPageLoaded();
59
68
  VisualGraphSteps.searchForResourceAndOpen(VALID_RESOURCE, VALID_RESOURCE);
60
69
  // Verify redirection to existing visual graph
61
70
  cy.url().should('match', /USRegion$/);
@@ -3,25 +3,30 @@ import HomeSteps from '../../steps/home-steps';
3
3
  const FILE_TO_IMPORT = 'wine.rdf';
4
4
 
5
5
  describe('RDF resource search', () => {
6
-
6
+ let repositoryId;
7
7
  beforeEach(() => {
8
8
  cy.viewport(1280, 1000);
9
+ repositoryId = '23repo' + Date.now();
10
+ cy.createRepository({id: repositoryId});
11
+ cy.initializeRepository(repositoryId);
12
+ cy.enableAutocomplete(repositoryId);
13
+ });
14
+
15
+ afterEach(() => {
16
+ cy.deleteRepository(repositoryId);
9
17
  });
10
18
 
11
19
  it('Search button should not be present when no repo is selected', () => {
12
20
  HomeSteps.visitAndWaitLoader();
21
+ // Given the page has loaded the license label (otherwise locally test passes after the loader disappears and before other elements are rendered)
22
+ HomeSteps.getLicenseAsLabel().should('be.visible');
13
23
  cy.get('.search-rdf-btn').should('not.exist');
14
24
  cy.get('.search-rdf-input').should('not.exist');
15
25
  });
16
26
 
17
27
  it('Search should be made from home page search when repo is set and on home page', () => {
18
- const repositoryId = '23repo' + Date.now();
19
- cy.createRepository({id: repositoryId});
20
- cy.initializeRepository(repositoryId);
21
- cy.enableAutocomplete(repositoryId);
22
- cy.presetRepository(repositoryId);
23
-
24
28
  // When I visit home page with selected repository
29
+ cy.presetRepository(repositoryId);
25
30
  HomeSteps.visitAndWaitLoader();
26
31
  // Search rdf button should be visible
27
32
  cy.get('.search-rdf-btn').should('be.visible');
@@ -35,18 +40,11 @@ describe('RDF resource search', () => {
35
40
  cy.get('#search-resource-input-home > #search-resource-box > .clear-icon').click();
36
41
  // // The input should be cleared
37
42
  cy.get('#search-resource-input-home > #search-resource-box > input').should('have.value', '');
38
-
39
- cy.deleteRepository(repositoryId);
40
43
  });
41
44
 
42
45
  it('Search should be present when repo is set', () => {
43
- const repositoryId = '23repo' + Date.now();
44
- cy.createRepository({id: repositoryId});
45
- cy.initializeRepository(repositoryId);
46
- cy.enableAutocomplete(repositoryId);
47
- cy.presetRepository(repositoryId);
48
-
49
46
  // When I visit not home page with selected repository
47
+ cy.presetRepository(repositoryId);
50
48
  cy.visit('/graphs');
51
49
  cy.get('.ot-splash').should('not.be.visible');
52
50
  cy.get('.ot-loader-new-content').should('not.exist');
@@ -78,17 +76,11 @@ describe('RDF resource search', () => {
78
76
  cy.get('.search-rdf-input search-resource-input .view-res-input').type('{esc}');
79
77
  // Search box should not be visible
80
78
  cy.get('.search-rdf-input').should('not.be.visible');
81
-
82
- cy.deleteRepository(repositoryId);
83
79
  });
84
80
 
85
81
  it('Search should be persisted on page reload', () => {
86
- const repositoryId = '23repo' + Date.now();
87
- cy.createRepository({id: repositoryId});
88
- cy.initializeRepository(repositoryId);
89
- cy.enableAutocomplete(repositoryId);
82
+ // Given I've selected a repository and visit the page
90
83
  cy.presetRepository(repositoryId);
91
-
92
84
  cy.visit('/graphs', {
93
85
  onBeforeLoad(win) {
94
86
  cy.stub(win, 'open').as('window.open');
@@ -128,18 +120,12 @@ describe('RDF resource search', () => {
128
120
  // Search box should not be visible
129
121
  cy.get('.search-rdf-input').should('not.be.visible');
130
122
  });
131
-
132
- cy.deleteRepository(repositoryId);
133
123
  });
134
124
 
135
125
  it('Should test RDF resource search box', () => {
136
- //Prepare repository, autocomplete and import data.
137
- const repositoryId = 'repository-' + Date.now();
138
- cy.createRepository({id: repositoryId});
139
- cy.initializeRepository(repositoryId);
126
+ //Prepare repository and import data.
140
127
  cy.presetRepository(repositoryId);
141
128
  cy.importServerFile(repositoryId, FILE_TO_IMPORT);
142
- cy.enableAutocomplete(repositoryId);
143
129
  HomeSteps.visitAndWaitLoader();
144
130
 
145
131
  //Verify that the main resource search box is focused
@@ -179,7 +165,6 @@ describe('RDF resource search', () => {
179
165
  getVisualButton().click();
180
166
  cy.get("#auto_0").should('be.visible').click();
181
167
  cy.get('@window.open').should('be.calledWith', 'graphs-visualizations?uri=http%3A%2F%2Fwww.w3.org%2FTR%2F2003%2FPR-owl-guide-20031209%2Fwine%23Dry');
182
- cy.deleteRepository(repositoryId);
183
168
  });
184
169
  });
185
170
 
@@ -21,8 +21,12 @@ describe('Plugins view', () => {
21
21
  });
22
22
 
23
23
  it('Should allow to enable and disable the plugins', () => {
24
- cy.wait('@get-license');
25
- cy.wait('@get-plugins');
24
+ cy.wait('@get-license')
25
+ .its('response.statusCode')
26
+ .should('equal', 200);
27
+ cy.wait('@get-plugins')
28
+ .its('response.statusCode')
29
+ .should('equal', 200);
26
30
  PluginsSteps.waitUntilPluginsPageIsLoaded();
27
31
 
28
32
  // Verify initial status is ON
@@ -8,6 +8,7 @@ describe('RDF Rank view', () => {
8
8
  repositoryId = 'rdfrank-' + Date.now();
9
9
  cy.createRepository({id: repositoryId});
10
10
  cy.presetRepository(repositoryId);
11
+ RdfRankSteps.visit();
11
12
  });
12
13
 
13
14
  afterEach(() => {
@@ -15,7 +16,6 @@ describe('RDF Rank view', () => {
15
16
  });
16
17
 
17
18
  it('Should allow to enable the RDF rank', () => {
18
- RdfRankSteps.visit();
19
19
  RdfRankSteps.waitUntilRdfRankPageIsLoaded();
20
20
 
21
21
  RdfRankSteps.getRdfStatusHeader().should('be.visible').and('contain', repositoryId);
@@ -31,7 +31,6 @@ describe('RDF Rank view', () => {
31
31
  });
32
32
 
33
33
  it('Should allow to enable the RDF rank with graphs and predicates filters', () => {
34
- RdfRankSteps.visit();
35
34
  RdfRankSteps.waitUntilRdfRankPageIsLoaded();
36
35
 
37
36
  RdfRankSteps.computeRdfRank();
@@ -68,6 +68,7 @@ describe('Sparql editor', () => {
68
68
  cy.pasteIntoCodeMirror('.CodeMirror', query);
69
69
  // Then I expect the prefixes to be added automatically
70
70
  cy.get('.CodeMirror').then((codeMirrorElement) => {
71
+ expect(codeMirrorElement[0].CodeMirror).to.exist;
71
72
  const codeMirror = codeMirrorElement[0].CodeMirror;
72
73
  // Wait, so that Yasqe can have time to replace the existing query with the new one
73
74
  cy.waitUntil(() => {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "2.8.2",
9
+ "version": "2.8.3",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "cypress": "^13.3.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
@@ -11,8 +11,16 @@ export class AutocompleteSteps {
11
11
  // No active loader
12
12
  cy.get('.ot-loader').should('not.exist');
13
13
 
14
+ // Repository is active
15
+ cy.get('.repository-errors').should('not.be.visible');
16
+
14
17
  // No warnings should be present
15
- this.getAutocompletePage().find('.alert-warning').should('not.be.visible');
18
+ this.getAutocompletePage().should(($autocomplete) => {
19
+ // Ensure the container exists and is visible
20
+ expect($autocomplete).to.be.visible;
21
+ // Assert no warning exists inside the container
22
+ expect($autocomplete.find('.alert-warning')).to.not.be.visible;
23
+ });
16
24
 
17
25
  this.getAutocompleteIndex().should('be.visible');
18
26
  }
@@ -13,6 +13,12 @@ export class PluginsSteps {
13
13
 
14
14
  // No active loader
15
15
  cy.get('.ot-loader').should('not.exist');
16
+
17
+ // Repository is active
18
+ cy.get('.repository-errors').should('not.be.visible');
19
+
20
+ // No plugins errors
21
+ cy.get('.no-plugins-match-alert').should('not.be.visible');
16
22
  }
17
23
 
18
24
  static getPluginByName(name) {
@@ -15,6 +15,9 @@ export class RdfRankSteps {
15
15
  // No active loader
16
16
  cy.get('.ot-loader').should('not.exist');
17
17
 
18
+ // Repository is active
19
+ cy.get('.repository-errors').should('not.be.visible');
20
+
18
21
  this.getRdfRankPage().find('.alert-warning').should('not.be.visible');
19
22
 
20
23
  this.getFilteringSwitch().scrollIntoView().should('be.visible');
@@ -7,6 +7,10 @@ export class VisualGraphSteps {
7
7
  cy.visit(VIEW_URL);
8
8
  }
9
9
 
10
+ static verifyPageLoaded() {
11
+ cy.get('.repository-errors').should('not.be.visible');
12
+ }
13
+
10
14
  static openUSRegionUri() {
11
15
  cy.visit('/graphs-visualizations?uri=http:%2F%2Fwww.w3.org%2FTR%2F2003%2FPR-owl-guide-20031209%2Fwine%23USRegion');
12
16
  }
@@ -63,9 +67,14 @@ export class VisualGraphSteps {
63
67
 
64
68
  static searchFor(resource, fullName) {
65
69
  this.getSearchField().type(resource);
70
+ this.getAutocompleteToast().should('not.exist');
66
71
  cy.get('.result-item.active').should('contain', fullName).click();
67
72
  }
68
73
 
74
+ static getAutocompleteToast() {
75
+ return cy.get('.autocomplete-toast a');
76
+ }
77
+
69
78
  static getGraphVisualizationNodes() {
70
79
  return this.getGraphVisualizationPane().find('.node-wrapper');
71
80
  }
@@ -0,0 +1,7 @@
1
+ import {Stubs} from "../stubs";
2
+
3
+ export class AutocompleteStubs extends Stubs {
4
+ static spyAutocompleteStatus() {
5
+ cy.intercept('GET', '/rest/autocomplete/enabled').as('autocompleteStatus');
6
+ }
7
+ }