graphdb-workbench-tests 3.0.1-TR1 → 3.0.2-TR1

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/cypress.config.js CHANGED
@@ -9,6 +9,10 @@ module.exports = defineConfig({
9
9
  defaultCommandTimeout: 40000,
10
10
  numTestsKeptInMemory: 10,
11
11
  e2e: {
12
+ retries: {
13
+ runMode: 2,
14
+ openMode: 0
15
+ },
12
16
  // We've imported your old cypress plugins here.
13
17
  // You may want to clean this up later by importing these.
14
18
  setupNodeEvents(on, config) {
@@ -194,7 +194,8 @@
194
194
  "actions": {
195
195
  "replace_node": "Replace node",
196
196
  "delete_node": "Delete node",
197
- "cannot_delete_node": "You cannot remove more than half of the healthy nodes at the same time",
197
+ "cannot_delete_node": "The current node cannot be removed",
198
+ "cannot_replace_node": "You cannot replace this node",
198
199
  "add_node": "Add node",
199
200
  "add_node_tooltip": "Add node to current cluster",
200
201
  "cancel": "Cancel",
@@ -208,6 +209,11 @@
208
209
  },
209
210
  "field_placeholders": {
210
211
  "location": "http://my-hostname:7200"
212
+ },
213
+ "copy_to_clipboard": {
214
+ "copied": {
215
+ "tooltip": "IRI copied"
216
+ }
211
217
  }
212
218
  }
213
219
  },
@@ -2467,6 +2473,9 @@
2467
2473
  "dates": {
2468
2474
  "today": "Today",
2469
2475
  "yesterday": "Yesterday"
2476
+ },
2477
+ "messages": {
2478
+ "copied_to_clipboard": "Copied to clipboard"
2470
2479
  }
2471
2480
  },
2472
2481
  "common.confirm.delete": "Confirm delete",
@@ -2505,6 +2514,7 @@
2505
2514
  "common.show_all": "Show all",
2506
2515
  "common.hide": "Hide",
2507
2516
  "common.learn_more_in_documentation": "Learn more in the GraphDB documentation",
2517
+ "click.to": "Click to",
2508
2518
  "paginator.first.page.label": "First",
2509
2519
  "paginator.last.page.label": "Last",
2510
2520
  "deactivate": "deactivate",
@@ -217,7 +217,12 @@ describe('Graphs config', () => {
217
217
  VisualGraphSteps.getGraphConfigSearchPanelName().should('contain', graphConfigName);
218
218
  });
219
219
 
220
- it('Should create graph config with fixed node', () => {
220
+ it('Should create graph config with fixed node', {
221
+ retries: {
222
+ runMode: 1,
223
+ openMode: 0
224
+ }
225
+ }, () => {
221
226
  cy.enableAutocomplete(repositoryId);
222
227
  // Given I have started a create config wizard
223
228
  startCreateConfigWizard();
@@ -147,7 +147,12 @@ describe('Visual graph screen validation', () => {
147
147
  });
148
148
  });
149
149
 
150
- it('Test search for a valid resource with links', () => {
150
+ it('Test search for a valid resource with links', {
151
+ retries: {
152
+ runMode: 1,
153
+ openMode: 0
154
+ }
155
+ }, () => {
151
156
  VisualGraphSteps.openUSRegionUri();
152
157
  // Check include inferred
153
158
  VisualGraphSteps.toggleInferredStatements(true);
@@ -102,11 +102,11 @@ describe('Graphql: edit endpoint settings', () => {
102
102
  "langValidate": null,
103
103
  "langImplicit": null,
104
104
  "langDefaultNameFetch": "NONE",
105
- "langAppendDefaultNameFetch": "true",
105
+ "langAppendDefaultNameFetch": true,
106
106
  "includeInferred": true,
107
107
  "expandOwlSameAs": true,
108
108
  "enableMutations": null,
109
- "defaultRole": "defaultRole",
109
+ "defaultRole": "Default",
110
110
  "enableGraphQLExplain": true,
111
111
  "exposeSomlInGraphQL": false,
112
112
  "disabledChecks": null,
@@ -2,6 +2,7 @@ import HomeSteps from '../../steps/home-steps';
2
2
  import {EnvironmentStubs} from "../../stubs/environment-stubs";
3
3
  import {SecurityStubs} from "../../stubs/security-stubs";
4
4
  import {SettingsSteps} from "../../steps/setup/settings-steps";
5
+ import {LicenseStubs} from "../../stubs/license-stubs";
5
6
 
6
7
  Cypress.env('set_default_user_data', false);
7
8
 
@@ -9,6 +10,7 @@ describe('Cookie policy', () => {
9
10
  beforeEach(() => {
10
11
  cy.setDefaultUserData(false);
11
12
  cy.viewport(1280, 1000);
13
+ LicenseStubs.stubFreeLicense();
12
14
  });
13
15
 
14
16
  afterEach(() => cy.setDefaultUserData());
@@ -39,7 +41,12 @@ describe('Cookie policy', () => {
39
41
  HomeSteps.getCookieConsentPopup().should('not.exist');
40
42
  });
41
43
 
42
- it('Should NOT show cookie policy to user when tracking is not applicable', () => {
44
+ it('Should NOT show cookie policy to user when tracking is not applicable', {
45
+ retries: {
46
+ runMode: 1,
47
+ openMode: 0
48
+ }
49
+ }, () => {
43
50
  SettingsSteps.visit();
44
51
  SettingsSteps.getCookiePolicyButton().should('not.exist');
45
52
  });
@@ -66,4 +66,28 @@ describe('Autocomplete ', () => {
66
66
  .should('be.visible')
67
67
  .and('not.be.disabled');
68
68
  });
69
+
70
+ it('should allow add and edit of autocomplete label', () => {
71
+ // Given I'm on the Autocomplete page
72
+ AutocompleteSteps.visit();
73
+ cy.wait('@get-license');
74
+ AutocompleteSteps.waitUntilAutocompletePageIsLoaded();
75
+ // The table should not contain this label
76
+ AutocompleteSteps.getAutocompleteLabels().should('not.contain.text', 'http://xmlns.com/foaf/0.1/name');
77
+
78
+ // When I add a label
79
+ AutocompleteSteps.addLabelAndLanguage('http://xmlns.com/foaf/0.1/name', 'fr');
80
+ // Then the list should have my new label
81
+ AutocompleteSteps.getAutocompleteLabels().should('contain.text', 'http://xmlns.com/foaf/0.1/name');
82
+
83
+ // When I edit the new label
84
+ AutocompleteSteps.editLabelOnRow(0);
85
+ AutocompleteSteps.typeLabelIri('http://purl.org/dc/elements/1.1/title');
86
+ AutocompleteSteps.saveLabel();
87
+ // Then the list should no longer have the old label
88
+ AutocompleteSteps.getAutocompleteLabels().should('not.contain.text', 'http://xmlns.com/foaf/0.1/name');
89
+ // And instead have the edited label
90
+ AutocompleteSteps.getAutocompleteLabels().should('contain.text', 'http://purl.org/dc/elements/1.1/title');
91
+ AutocompleteSteps.getAutocompleteLabels().should('contain.text', 'fr');
92
+ });
69
93
  });
@@ -248,40 +248,6 @@ describe('User and Access', () => {
248
248
  }
249
249
  });
250
250
  });
251
- });
252
-
253
- context('GraphQL only and Free Access', () => {
254
- let repositoryId1;
255
- let repositoryId2;
256
- let repositoryId3;
257
- const graphqlUser = 'graphqlUser';
258
-
259
- beforeEach(() => {
260
- cy.viewport(1280, 1000);
261
- RepositoriesStubs.spyGetRepositories();
262
- repositoryId1 = 'user-access-repo1-' + Date.now();
263
- repositoryId2 = 'user-access-repo2-' + Date.now();
264
- repositoryId3 = 'user-access-repo3-' + Date.now();
265
- cy.createRepository({id: repositoryId1});
266
- cy.createRepository({id: repositoryId2});
267
- cy.createRepository({id: repositoryId3});
268
- cy.presetRepository(repositoryId1);
269
- UserAndAccessSteps.visit();
270
- // Users table should be visible
271
- UserAndAccessSteps.getUsersTable().should('be.visible');
272
- });
273
-
274
- afterEach(() => {
275
- cy.loginAsAdmin().then(()=> {
276
- cy.deleteRepository(repositoryId1, true);
277
- cy.deleteRepository(repositoryId2, true);
278
- cy.deleteRepository(repositoryId3, true);
279
- cy.deleteUser(graphqlUser, true);
280
- cy.switchOffFreeAccess(true);
281
- cy.switchOffSecurity(true);
282
- });
283
-
284
- });
285
251
 
286
252
  it('Can have Free Access and GraphQL working together', () => {
287
253
  cy.wait('@getRepositories');
@@ -318,6 +284,10 @@ describe('User and Access', () => {
318
284
  runChecks(checks);
319
285
  }
320
286
  });
287
+ // Turn free access off
288
+ cy.loginAsAdmin().then(()=> {
289
+ cy.switchOffFreeAccess(true);
290
+ });
321
291
  });
322
292
  });
323
293
 
@@ -8,9 +8,11 @@ import {SaveQueryDialog} from "../../../steps/yasgui/save-query-dialog";
8
8
  describe('Edit saved queries', () => {
9
9
 
10
10
  let repositoryId;
11
+ let savedQueryName;
11
12
 
12
13
  beforeEach(() => {
13
14
  repositoryId = 'sparql-editor-' + Date.now();
15
+ savedQueryName = SavedQuery.generateQueryName();
14
16
  QueryStubs.stubQueryCountResponse();
15
17
  cy.createRepository({id: repositoryId});
16
18
  cy.presetRepository(repositoryId);
@@ -21,12 +23,12 @@ describe('Edit saved queries', () => {
21
23
  });
22
24
 
23
25
  afterEach(() => {
26
+ cy.deleteSavedQuery(savedQueryName);
24
27
  cy.deleteRepository(repositoryId);
25
28
  });
26
29
 
27
30
  it('Should prevent saving query with duplicated name', () => {
28
31
  // Given I have created a query
29
- const savedQueryName = SavedQuery.generateQueryName();
30
32
  SavedQuery.create(savedQueryName);
31
33
  // When I open the saved queries popup
32
34
  YasguiSteps.showSavedQueries();
@@ -48,21 +50,35 @@ describe('Edit saved queries', () => {
48
50
  YasguiSteps.showSavedQueries();
49
51
  SavedQueriesDialog.editQueryByName(savedQueryName);
50
52
  SaveQueryDialog.getQueryField().should('have.value', 'select $s $p $o');
53
+ // Then I close the dialog
54
+ SaveQueryDialog.closeSaveQueryDialog();
55
+ });
56
+
57
+ // TODO skipped until .env can be updated with BE version, which includes the API changes
58
+ it.skip('should allow renaming saved query', () => {
59
+ // Given I have created a query
60
+ SavedQuery.create(savedQueryName);
61
+ // When I open the saved queries popup
62
+ YasguiSteps.showSavedQueries();
63
+ // And I edit the saved query
64
+ SavedQueriesDialog.editQueryByName(savedQueryName);
65
+ // Then the save query dialog should be opened
66
+ SaveQueryDialog.getQueryNameField().should('have.value', savedQueryName);
67
+ SaveQueryDialog.getQueryField().should('have.value', 'select *');
68
+ SaveQueryDialog.getIsPublicField().should('be.checked');
51
69
  // When I change the query name
52
- // TODO: This currently won't work. The legacy implementation in the WB does the following:
53
- // * First POST to create a new query with the new name
54
- // * Then DELETE the query with the old name
55
- // This is quite hackish and would require maintaining some state in the WB which is awkward.
56
- // Better approach would be to think of a way to delegate this to the backend api for the edit.
57
- // YasguiSteps.clearQueryNameField();
58
- // savedQueryName = generateQueryName();
59
- // YasguiSteps.writeQueryName(savedQueryName);
60
- // YasguiSteps.saveQuery();
61
- // // Then a new query should be created
62
- // YasguiSteps.getSaveQueryDialog().should('not.exist');
63
- // YasguiSteps.showSavedQueries();
64
- // YasguiSteps.editQueryByName(savedQueryName);
65
- // YasguiSteps.getQueryNameField().should('have.value', savedQueryName);
66
- // YasguiSteps.getQueryField().should('have.value', 'select $s $p $o');
70
+ SaveQueryDialog.clearQueryNameField();
71
+ savedQueryName = SavedQuery.generateQueryName();
72
+ SaveQueryDialog.writeQueryName(savedQueryName);
73
+ // And try to save the query
74
+ SaveQueryDialog.saveQuery();
75
+ // Then the query should be updated
76
+ SaveQueryDialog.getSaveQueryDialog().should('not.exist');
77
+ YasguiSteps.showSavedQueries();
78
+ SavedQueriesDialog.editQueryByName(savedQueryName);
79
+ SaveQueryDialog.getQueryNameField().should('have.value', savedQueryName);
80
+ SaveQueryDialog.getQueryField().should('have.value', 'select *');
81
+ // Then I close the dialog
82
+ SaveQueryDialog.closeSaveQueryDialog();
67
83
  });
68
84
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.0.1-TR1",
3
+ "version": "3.0.2-TR1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.0.1-TR1",
9
+ "version": "3.0.2-TR1",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "cypress": "^14.0.3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.0.1-TR1",
3
+ "version": "3.0.2-TR1",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
package/plugins/index.js CHANGED
@@ -12,6 +12,7 @@
12
12
  // the project's config changing)
13
13
 
14
14
  const del = require('del');
15
+ const retryTracker = {};
15
16
 
16
17
  module.exports = (on, config) => {
17
18
  // `on` is used to hook into various events Cypress emits
@@ -29,17 +30,69 @@ module.exports = (on, config) => {
29
30
  }
30
31
  });
31
32
 
32
- // keep only the videos for the failed specs
33
33
  on('after:spec', (spec, results) => {
34
+ // Retry tracking
35
+ if (!retryTracker.flaky) {
36
+ retryTracker.flaky = {};
37
+ }
38
+
39
+ if (!retryTracker.broken) {
40
+ retryTracker.broken = {};
41
+ }
42
+
43
+ results.tests.forEach((test) => {
44
+ const title = test.title.join(' ');
45
+ const attempts = test.attempts.length;
46
+ const retries = attempts - 1;
47
+
48
+ if (retries < 1) {
49
+ return;
50
+ }
51
+
52
+ if (test.state === 'passed') {
53
+ retryTracker.flaky[title] = retries;
54
+ }
55
+
56
+ if (test.state === 'failed') {
57
+ retryTracker.broken[title] = retries;
58
+ }
59
+ });
60
+
61
+ // Video cleanup
34
62
  if (results && results.video) {
35
- // Do we have failures for any retry attempts?
36
- const failures = results.tests.some((test) => {
37
- return test.attempts.some((attempt) => attempt.state === 'failed');
38
- });
63
+ const failures = results.tests.some((test) =>
64
+ test.attempts.some((attempt) => attempt.state === 'failed')
65
+ );
39
66
  if (!failures) {
40
- // delete the video if the spec passed and no tests retried
41
67
  return del(results.video);
42
68
  }
43
69
  }
44
70
  });
71
+
72
+ on('after:run', () => {
73
+ const { flaky = {}, broken = {} } = retryTracker;
74
+
75
+ const printGroup = (label, group) => {
76
+ const entries = Object.entries(group);
77
+ if (entries.length === 0) {
78
+ return;
79
+ }
80
+
81
+ console.log(`\n ${label} (${entries.length}):`);
82
+ entries.forEach(([name, retry]) => {
83
+ console.log(` * ${name}`);
84
+ console.log(` ↪ retried ${retry} time(s), total runs: ${retry + 1}`);
85
+ });
86
+ };
87
+
88
+ if (Object.keys(flaky).length === 0 && Object.keys(broken).length === 0) {
89
+ console.log('\n======================================== Retry Summary ========================================\n️ [PASS] No retried tests!\n====================================================================================================\n');
90
+ return;
91
+ }
92
+
93
+ console.log('\n======================================== Retry Summary ========================================');
94
+ printGroup('[WARNING] Flaky tests', flaky);
95
+ printGroup('[FAIL] Broken tests', broken);
96
+ console.log('====================================================================================================\n');
97
+ });
45
98
  };
@@ -57,11 +57,42 @@ export class AutocompleteSteps {
57
57
  return this.getAutocompletePage().find('#wb-autocomplete-addLabel');
58
58
  }
59
59
 
60
+ static addLabelAndLanguage(label, language) {
61
+ this.getAddLabelButton().click();
62
+ this.typeLabelIri(label);
63
+ this.typeLabelLanguages(language);
64
+ this.saveLabel();
65
+ }
66
+
67
+ static typeLabelIri(iri) {
68
+ this.getAddLabelForm().find('#wb-autocomplete-iri').click().clear().type(iri);
69
+ }
70
+
71
+ static typeLabelLanguages(languages) {
72
+ this.getAddLabelForm().find('#wb-autocomplete-languages').click().type(languages);
73
+ }
74
+
60
75
  static getAutocompleteLabels() {
61
76
  return this.getAutocompletePage().find('#wb-autocomplete-labels');
62
77
  }
63
78
 
79
+ static getTableRows() {
80
+ return cy.get('.wb-autocomplete-labels-row');
81
+ }
82
+
64
83
  static getSuccessStatusElement() {
65
84
  return cy.get('.autocomplete-status').find('.tag.tag-success.ng-binding');
66
85
  }
86
+
87
+ static getAddLabelForm() {
88
+ return cy.get('#addLabelForm');
89
+ }
90
+
91
+ static saveLabel() {
92
+ cy.get('#wb-autocomplete-savegraph-submit').click();
93
+ }
94
+
95
+ static editLabelOnRow(rowIndex) {
96
+ this.getTableRows().eq(rowIndex).find('.actions-bar .icon-edit').click();
97
+ }
67
98
  }
@@ -13,7 +13,7 @@ Cypress.Commands.add('uploadGraphqlSchema', (repositoryId, schemaPath, schemaId
13
13
  url: `${REPOSITORIES_URL}${repositoryId}/graphql/manage/endpoints/import`,
14
14
  headers: {'Content-type': 'text/yaml'},
15
15
  body: schema
16
- }).should((response) => expect(response.status).to.equal(200));
16
+ }).should((response) => expect(response.status).to.equal(201));
17
17
  waitForGraphqlSchema(repositoryId, schemaId);
18
18
  });
19
19
  });
@@ -1,3 +1,5 @@
1
+ const DELETE_SAVED_QUERY_URL = '/rest/sparql/saved-queries';
2
+
1
3
  Cypress.Commands.add('pasteQuery', (query) => {
2
4
  // Setting the textarea and the calling setValue seems to work
3
5
  // more reliably then other strategies (see history)
@@ -12,6 +14,24 @@ Cypress.Commands.add('executeQuery', () => {
12
14
  getLoader().should('not.exist');
13
15
  });
14
16
 
17
+ Cypress.Commands.add('deleteSavedQuery', (savedQueryName, secured = false) => {
18
+ const url = DELETE_SAVED_QUERY_URL + '?name=' + savedQueryName;
19
+ let headers = {'Content-Type': 'application/json'};
20
+ if (secured) {
21
+ const authHeader = Cypress.env('adminToken');
22
+ headers = {...headers,
23
+ 'Authorization': authHeader
24
+ }
25
+ }
26
+ return cy.request({
27
+ method: 'DELETE',
28
+ url: url,
29
+ headers,
30
+ // Prevent Cypress from failing the test on non-2xx status codes
31
+ failOnStatusCode: false
32
+ });
33
+ });
34
+
15
35
  Cypress.Commands.add('verifyResultsPageLength', (resultLength) => {
16
36
  getResultsWrapper().should('be.visible');
17
37
  getTableResultRows()