graphdb-workbench-tests 3.2.0 → 3.3.0-TR2

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.
Files changed (46) hide show
  1. package/cypress-security.config.js +12 -5
  2. package/e2e-legacy/explore/class-relationships/class-relationships.spec.js +1 -1
  3. package/e2e-legacy/home/cookie-policy.spec.js +8 -8
  4. package/e2e-legacy/home/rdf-resource-search.spec.js +12 -0
  5. package/e2e-legacy/setup/rdf-rank/rdf-rank.spec.js +2 -4
  6. package/e2e-legacy/setup/settings/my-settings.spec.js +46 -58
  7. package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +8 -3
  8. package/e2e-legacy/sparql-editor/actions/inferred-sameas.spec.js +3 -3
  9. package/e2e-legacy/sparql-editor/saved-query/readonly-query.spec.js +13 -16
  10. package/e2e-legacy/sparql-editor/yasqe-themes.spec.js +54 -0
  11. package/e2e-legacy/ttyg/agent-list.spec.js +1 -2
  12. package/e2e-legacy/ttyg/agent-select-menu.spec.js +1 -2
  13. package/e2e-legacy/ttyg/chat-list.spec.js +1 -2
  14. package/e2e-legacy/ttyg/chat-panel.spec.js +1 -2
  15. package/e2e-legacy/ttyg/clone-agent.spec.js +1 -2
  16. package/e2e-legacy/ttyg/create-agent.spec.js +2 -3
  17. package/e2e-legacy/ttyg/create-chat.spec.js +1 -2
  18. package/e2e-legacy/ttyg/delete-agent.spec.js +1 -2
  19. package/e2e-legacy/ttyg/edit-agent.spec.js +1 -2
  20. package/e2e-legacy/ttyg/ttyg-permission.spec.js +2 -6
  21. package/e2e-legacy/ttyg/ttyg-view.spec.js +1 -2
  22. package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +16 -7
  23. package/e2e-security/setup/users-and-access/graphql-user.spec.js +6 -3
  24. package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +1 -0
  25. package/e2e-security/setup/users-and-access/turn-on-security-and-password-change.spec.js +3 -3
  26. package/e2e-security/setup/users-and-access/user-and-access.spec.js +8 -8
  27. package/fixtures/ttyg/agent/get-similarity-indexes-for-another-repo.json +5 -3
  28. package/fixtures/ttyg/agent/get-similarity-indexes.json +17 -8
  29. package/npm-shrinkwrap.json +47 -47
  30. package/package.json +1 -1
  31. package/steps/application-steps.js +7 -5
  32. package/steps/class-views-steps.js +2 -3
  33. package/steps/home-steps.js +37 -29
  34. package/steps/login-steps.js +13 -4
  35. package/steps/repository-steps.js +4 -0
  36. package/steps/setup/rdf-rank-steps.js +0 -4
  37. package/steps/setup/user-and-access-steps.js +6 -10
  38. package/steps/sparql-editor-steps.js +5 -0
  39. package/steps/toaster-steps.js +18 -6
  40. package/steps/yasgui/yasqe-steps.js +6 -0
  41. package/stubs/repositories/repositories-stubs.js +151 -76
  42. package/support/e2e.js +3 -0
  43. package/support/repository-commands.js +9 -0
  44. package/support/settings-commands.js +16 -0
  45. package/stubs/repositories-stub.js +0 -73
  46. /package/e2e-legacy/graphql/{graphql-endpoint-management-with-selected-repository.spec.jsx → graphql-endpoint-management-with-selected-repository.spec.js} +0 -0
@@ -1,10 +1,10 @@
1
- import {LicenseWidgetSteps} from "./widgets/license-widget-steps";
2
- import {RepositoryErrorsWidgetSteps} from "./widgets/repository-errors-widget-steps";
3
- import {ActiveRepositoryWidgetSteps} from "./widgets/active-repository-widget-steps";
4
- import {SavedSparqlQueriesWidgetSteps} from "./widgets/saved-sparql-queries-widget-steps";
5
- import {RepositorySteps} from "./repository-steps";
6
- import {BaseSteps} from "./base-steps";
7
- import {EnvironmentStubs} from "../stubs/environment-stubs";
1
+ import {LicenseWidgetSteps} from './widgets/license-widget-steps';
2
+ import {RepositoryErrorsWidgetSteps} from './widgets/repository-errors-widget-steps';
3
+ import {ActiveRepositoryWidgetSteps} from './widgets/active-repository-widget-steps';
4
+ import {SavedSparqlQueriesWidgetSteps} from './widgets/saved-sparql-queries-widget-steps';
5
+ import {RepositorySteps} from './repository-steps';
6
+ import {BaseSteps} from './base-steps';
7
+ import {EnvironmentStubs} from '../stubs/environment-stubs';
8
8
 
9
9
  class HomeSteps extends BaseSteps {
10
10
 
@@ -34,8 +34,12 @@ class HomeSteps extends BaseSteps {
34
34
  return cy.get('.ot-loader-new-content').should('not.exist');
35
35
  }
36
36
 
37
+ static getLayout() {
38
+ return cy.get('.wb-layout');
39
+ }
40
+
37
41
  static getView() {
38
- return cy.get('.wb-layout');
42
+ return cy.get('#wb-home');
39
43
  }
40
44
 
41
45
  static getTutorialPanel() {
@@ -43,19 +47,19 @@ class HomeSteps extends BaseSteps {
43
47
  }
44
48
 
45
49
  static hideTutorial() {
46
- this.getTutorialPanel().find('.decline-tutorial').click();
50
+ this.getTutorialPanel().find('.decline-tutorial').click();
47
51
  }
48
52
 
49
53
  static showTutorialPanel() {
50
- this.getView().find('.show-tutorial').click();
54
+ this.getView().find('.show-tutorial').click();
51
55
  }
52
56
 
53
57
  static getNavigationMenu() {
54
- return this.getView().find('.wb-navbar');
58
+ return this.getLayout().find('.wb-navbar');
55
59
  }
56
60
 
57
61
  static getPageHeader() {
58
- return this.getView().find('.wb-header');
62
+ return this.getLayout().find('.wb-header');
59
63
  }
60
64
 
61
65
  // ===========================
@@ -63,7 +67,7 @@ class HomeSteps extends BaseSteps {
63
67
  // ===========================
64
68
 
65
69
  static getRDFSearchButton() {
66
- return this.getPageHeader().find('.rdf-search-button i');
70
+ return this.getPageHeader().find('.rdf-search-button i');
67
71
  }
68
72
 
69
73
  // ===========================
@@ -71,11 +75,11 @@ class HomeSteps extends BaseSteps {
71
75
  // ===========================
72
76
 
73
77
  static getRepositorySelector() {
74
- return this.getPageHeader().find('onto-repository-selector');
78
+ return this.getPageHeader().find('onto-repository-selector');
75
79
  }
76
80
 
77
81
  static getSelectedRepository() {
78
- return this.getRepositorySelector().find('.onto-dropdown-button');
82
+ return this.getRepositorySelector().find('.onto-dropdown-button');
79
83
  }
80
84
 
81
85
  // ===========================
@@ -83,11 +87,11 @@ class HomeSteps extends BaseSteps {
83
87
  // ===========================
84
88
 
85
89
  static getLanguageSelector() {
86
- return this.getPageHeader().find('onto-language-selector');
90
+ return this.getPageHeader().find('onto-language-selector');
87
91
  }
88
92
 
89
93
  static getSelectedLanguage() {
90
- return this.getLanguageSelector().find('.onto-dropdown-button');
94
+ return this.getLanguageSelector().find('.onto-dropdown-button');
91
95
  }
92
96
 
93
97
  // ===========================
@@ -95,7 +99,7 @@ class HomeSteps extends BaseSteps {
95
99
  // ===========================
96
100
 
97
101
  static getActiveRepositoryWidget() {
98
- return ActiveRepositoryWidgetSteps.getWidget();
102
+ return ActiveRepositoryWidgetSteps.getWidget();
99
103
  }
100
104
 
101
105
  // ===========================
@@ -103,7 +107,7 @@ class HomeSteps extends BaseSteps {
103
107
  // ===========================
104
108
 
105
109
  static getLicenseWidget() {
106
- return LicenseWidgetSteps.getWidget();
110
+ return LicenseWidgetSteps.getWidget();
107
111
  }
108
112
 
109
113
  // ===========================
@@ -111,7 +115,7 @@ class HomeSteps extends BaseSteps {
111
115
  // ===========================
112
116
 
113
117
  static getRepositoryErrorsWidget() {
114
- return RepositoryErrorsWidgetSteps.getWidget();
118
+ return RepositoryErrorsWidgetSteps.getWidget();
115
119
  }
116
120
 
117
121
  // ===========================
@@ -119,7 +123,7 @@ class HomeSteps extends BaseSteps {
119
123
  // ===========================
120
124
 
121
125
  static getSavedSparqlQueriesWidget() {
122
- return SavedSparqlQueriesWidgetSteps.getWidget();
126
+ return SavedSparqlQueriesWidgetSteps.getWidget();
123
127
  }
124
128
 
125
129
  // ===========================
@@ -127,22 +131,25 @@ class HomeSteps extends BaseSteps {
127
131
  // ===========================
128
132
 
129
133
  static getPageFooter() {
130
- return cy.get('.footer-component');
134
+ return cy.get('.footer-component');
131
135
  }
132
136
 
133
137
  // ==========================
134
138
 
135
139
  static selectSPARQLQueryToExecute(query) {
136
140
  cy.contains('ul.saved-queries li', query)
137
- .should('be.visible')
138
- .as('savedQueryItem');
141
+ .as('savedQueryItem')
142
+ .scrollIntoView();
143
+
144
+ cy.get('@savedQueryItem')
145
+ .should('be.visible');
139
146
 
140
147
  cy.get('@savedQueryItem')
141
148
  .trigger('hover');
142
149
 
143
150
  cy.get('@savedQueryItem')
144
151
  .find('.execute-saved-query')
145
- .click({ force: true });
152
+ .click({force: true});
146
153
  }
147
154
 
148
155
 
@@ -189,12 +196,12 @@ class HomeSteps extends BaseSteps {
189
196
  }
190
197
 
191
198
  static verifyCreateRepositoryLink() {
192
- cy.get('.card.repository-errors').should("be.visible")
199
+ cy.get('.card.repository-errors').should('be.visible')
193
200
  .within(() => {
194
201
  HomeSteps.getCreateRepositoryLink()
195
202
  .click()
196
203
  .url()
197
- .should('eq', Cypress.config("baseUrl") + '/repository/create?previous=%2F');
204
+ .should('eq', Cypress.config('baseUrl') + '/repository/create?previous=%2F');
198
205
  });
199
206
  cy.get('.big-logo').click();
200
207
  }
@@ -216,7 +223,7 @@ class HomeSteps extends BaseSteps {
216
223
  }
217
224
 
218
225
  static shouldHaveAutocompleteResult(uri) {
219
- return HomeSteps.getAutocompleteResultElement(uri).should("be.visible");
226
+ return HomeSteps.getAutocompleteResultElement(uri).should('be.visible');
220
227
  }
221
228
 
222
229
  static autocompleteText(text, uri) {
@@ -232,7 +239,7 @@ class HomeSteps extends BaseSteps {
232
239
 
233
240
  static verifyAutocompleteResourceLink(uri) {
234
241
  cy.get('#results-loader.ot-loader').should('not.exist');
235
- cy.get('.resource-info').should('be.visible').and("contain", uri);
242
+ cy.get('.resource-info').should('be.visible').and('contain', uri);
236
243
  }
237
244
 
238
245
  static getAutocompleteButton(type) {
@@ -338,4 +345,5 @@ class HomeSteps extends BaseSteps {
338
345
  return cy.get('[guide-selector="sub-menu-support"]');
339
346
  }
340
347
  }
348
+
341
349
  export default HomeSteps;
@@ -7,17 +7,26 @@ export class LoginSteps {
7
7
 
8
8
  static visitInProdMode() {
9
9
  cy.visit('/login', {
10
- onBeforeLoad: (win) => {
10
+ onBeforeLoad: () => {
11
11
  EnvironmentStubs.stubWbProdMode();
12
12
  }
13
13
  });
14
14
  }
15
15
 
16
+ static visitLoginPageWithReturnUrl(returnURL) {
17
+ const returnURLEncoded = encodeURIComponent(returnURL);
18
+ cy.visit(`/login?r=${returnURLEncoded}`);
19
+ }
20
+
21
+ static navigateToLoginPage() {
22
+ cy.get('onto-user-login').click();
23
+ }
24
+
16
25
  static loginWithUser(username, password) {
17
26
  cy.get('.login-form').should('be.visible');
18
- cy.get('#wb-login-username').type(username);
19
- cy.get('#wb-login-password').type(password);
20
- cy.get('#wb-login-submitLogin').click();
27
+ cy.getByTestId('username-input').type(username);
28
+ cy.getByTestId('password-input').type(password);
29
+ cy.getByTestId('submit-btn').click();
21
30
  }
22
31
 
23
32
  static logout() {
@@ -36,6 +36,10 @@ export class RepositorySteps {
36
36
  .should('be.visible');
37
37
  }
38
38
 
39
+ static verifyRepositoryIsSelected(repositoryId) {
40
+ return RepositorySteps.getRepositorySelection().should('contain', repositoryId);
41
+ }
42
+
39
43
  static getRepositoriesInDropdown() {
40
44
  return cy.get('.onto-dropdown-menu-item');
41
45
  }
@@ -120,8 +120,4 @@ export class RdfRankSteps extends BaseSteps {
120
120
  static getExcludedPredicatesFilter() {
121
121
  return this.getFilteringConfig().find('.excluded-predicates-filter');
122
122
  }
123
-
124
- static getToast() {
125
- return cy.get('#toast-container');
126
- }
127
123
  }
@@ -359,19 +359,15 @@ export class UserAndAccessSteps {
359
359
  }
360
360
 
361
361
  static clickFreeWriteAccessRepo(repoName) {
362
- cy.get('.repo-fields')
363
- .contains(repoName)
364
- .parent('.row')
365
- .find('.write')
366
- .realClick();
362
+ const repoRow = cy.get('.repo-fields').contains(repoName).parent('.row');
363
+ repoRow.scrollIntoView();
364
+ repoRow.find('.write').realClick();
367
365
  }
368
366
 
369
367
  static clickFreeGraphqlAccessRepo(repoName) {
370
- cy.get('.repo-fields')
371
- .contains(repoName)
372
- .parent('.row')
373
- .find('.graphql')
374
- .realClick();
368
+ const repoRow = cy.get('.repo-fields').contains(repoName).parent('.row');
369
+ repoRow.scrollIntoView();
370
+ repoRow.find('.graphql').realClick();
375
371
  }
376
372
 
377
373
  }
@@ -5,11 +5,16 @@ const VIEW_URL = '/sparql';
5
5
  export class SparqlEditorSteps {
6
6
  static visitSparqlEditorPage() {
7
7
  cy.visit(VIEW_URL);
8
+ }
9
+
10
+ static visitSparqlEditorPageAndWaitForEditor() {
11
+ SparqlEditorSteps.visitSparqlEditorPage();
8
12
  // Because we use angularjs less than 1.7.3 we use additional library ng-custom-element.umd.js to solve problem with property bindings
9
13
  // This library make additional call to ontotext-yasgui-web-component and the component that's way the component renders twice when page loaded.
10
14
  // This is bad because in tests cypress can find an element when it is rendered from first call and try to click it for example.
11
15
  // If time of clicking such element is when second call to the component is done then exception that element is detached will be thrown.
12
16
  // We will wait a little , to give a chance page is loaded correctly before test start.
17
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
13
18
  cy.wait(1000);
14
19
  YasqeSteps.waitUntilQueryIsVisible();
15
20
  }
@@ -1,24 +1,28 @@
1
1
  export class ToasterSteps {
2
2
  static getToast() {
3
- return cy.get('#toast-container');
3
+ return cy.get('.toast');
4
4
  }
5
5
 
6
6
  static verifyTitle(title) {
7
- ToasterSteps.getToast()
7
+ return ToasterSteps.getToast()
8
8
  .find('.toast-title')
9
9
  .should('be.visible')
10
10
  .and('contain', title);
11
11
  }
12
12
 
13
13
  static verifySuccess(successMessage) {
14
- ToasterSteps.getToast()
14
+ return ToasterSteps.getToast()
15
15
  .should('exist')
16
16
  .find('.toast-message')
17
17
  .and('contain', successMessage);
18
18
  }
19
19
 
20
+ static getToasterMessage() {
21
+ return ToasterSteps.getToast().find('.toast-message')
22
+ }
23
+
20
24
  static verifyWarning(warningMessage) {
21
- ToasterSteps.getToast()
25
+ return ToasterSteps.getToast()
22
26
  .find('.toast-warning')
23
27
  .should('be.visible')
24
28
  .find('.toast-message')
@@ -26,9 +30,17 @@ export class ToasterSteps {
26
30
  }
27
31
 
28
32
  static verifyError(errorMessage) {
29
- ToasterSteps.getToast()
30
- .find('.toast-error')
33
+ return ToasterSteps.getToast()
34
+ .should('be.visible')
35
+ .and('have.class', 'toast-error')
36
+ .find('.toast-message')
37
+ .and('contain', errorMessage);
38
+ }
39
+
40
+ static verifyNewToasterError(errorMessage) {
41
+ return ToasterSteps.getToast()
31
42
  .should('be.visible')
43
+ .and('have.class', 'toast error')
32
44
  .find('.toast-message')
33
45
  .and('contain', errorMessage);
34
46
  }
@@ -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
  });
@@ -1,6 +1,6 @@
1
- import {Stubs} from "../stubs";
2
- import {REPOSITORIES_URL} from "../../support/repository-commands";
3
- import {RepositoriesStub} from "../repositories-stub";
1
+ import {Stubs} from '../stubs';
2
+ import {REPOSITORIES_URL} from '../../support/repository-commands';
3
+ import {GlobalOperationsStatusesStub} from '../global-operations-statuses-stub.js';
4
4
 
5
5
  export class RepositoriesStubs extends Stubs {
6
6
  static stubRepositories(withDelay = 0, fixture = '/repositories/get-repositories.json') {
@@ -16,7 +16,7 @@ export class RepositoriesStubs extends Stubs {
16
16
  }
17
17
 
18
18
  static spyGetActiveLocations() {
19
- cy.intercept('GET', '/rest/locations/active').as('getActiveLocations');
19
+ cy.intercept('GET', '/rest/locations/active').as('getActiveLocations');
20
20
  }
21
21
 
22
22
  static stubLocations(withDelay = 0) {
@@ -35,52 +35,52 @@ export class RepositoriesStubs extends Stubs {
35
35
  this.interceptRepository(repositoryId, 200);
36
36
  }
37
37
 
38
- static stubGetRepositoryConfig(repositoryId, fixture = '/repositories/get-repository-config.json', widthDelay = 0) {
38
+ static stubGetRepositoryConfig(repositoryId, fixture = '/repositories/get-repository-config.json') {
39
39
  RepositoriesStubs.stubQueryResponse(`/rest/repositories/${repositoryId}`, fixture, 'get-repository-config');
40
40
  }
41
41
 
42
42
  static getFixtureParams() {
43
43
  return {
44
- "propertiesFile": {
45
- "name": "propertiesFile",
46
- "label": "JDBC properties file",
47
- "value": "repositories/ontop/ontop_jdbc.properties"
44
+ propertiesFile: {
45
+ name: 'propertiesFile',
46
+ label: 'JDBC properties file',
47
+ value: 'repositories/ontop/ontop_jdbc.properties',
48
48
  },
49
- "lensesFile": {
50
- "name": "lensesFile",
51
- "label": "Lenses file",
52
- "value": ""
49
+ lensesFile: {
50
+ name: 'lensesFile',
51
+ label: 'Lenses file',
52
+ value: '',
53
53
  },
54
- "isShacl": {
55
- "name": "isShacl",
56
- "label": "Enable SHACL validation",
57
- "value": "false"
54
+ isShacl: {
55
+ name: 'isShacl',
56
+ label: 'Enable SHACL validation',
57
+ value: 'false',
58
58
  },
59
- "owlFile": {
60
- "name": "owlFile",
61
- "label": "Ontology file",
62
- "value": ""
59
+ owlFile: {
60
+ name: 'owlFile',
61
+ label: 'Ontology file',
62
+ value: '',
63
63
  },
64
- "member": {
65
- "name": "member",
66
- "label": "FedX repo members",
67
- "value": []
64
+ member: {
65
+ name: 'member',
66
+ label: 'FedX repo members',
67
+ value: [],
68
68
  },
69
- "constraintFile": {
70
- "name": "constraintFile",
71
- "label": "Constraint file",
72
- "value": ""
69
+ constraintFile: {
70
+ name: 'constraintFile',
71
+ label: 'Constraint file',
72
+ value: '',
73
73
  },
74
- "obdaFile": {
75
- "name": "obdaFile",
76
- "label": "OBDA or R2RML file",
77
- "value": "repositories/ontop/university-complete.obda"
74
+ obdaFile: {
75
+ name: 'obdaFile',
76
+ label: 'OBDA or R2RML file',
77
+ value: 'repositories/ontop/university-complete.obda',
78
+ },
79
+ dbMetadataFile: {
80
+ name: 'dbMetadataFile',
81
+ label: 'DB metadata file',
82
+ value: '',
78
83
  },
79
- "dbMetadataFile": {
80
- "name": "dbMetadataFile",
81
- "label": "DB metadata file",
82
- "value": ""
83
- }
84
84
  };
85
85
  }
86
86
 
@@ -88,14 +88,14 @@ export class RepositoriesStubs extends Stubs {
88
88
  cy.intercept(`${REPOSITORIES_URL}/${id}?location=`, {
89
89
  statusCode,
90
90
  body: {
91
- "id": id,
92
- "title": "",
93
- "type": "ontop",
94
- "sesameType": "graphdb:OntopRepository",
95
- "location": "",
96
- "hostName": "localhost",
97
- "params": { ...this.getFixtureParams(), ...extraParams }
98
- }
91
+ id: id,
92
+ title: '',
93
+ type: 'ontop',
94
+ sesameType: 'graphdb:OntopRepository',
95
+ location: '',
96
+ hostName: 'localhost',
97
+ params: {...this.getFixtureParams(), ...extraParams},
98
+ },
99
99
  });
100
100
  }
101
101
 
@@ -103,33 +103,39 @@ export class RepositoriesStubs extends Stubs {
103
103
  cy.intercept(REPOSITORIES_URL + '/all', {
104
104
  statusCode: 200,
105
105
  body: {
106
- "": [
106
+ '': [
107
107
  {
108
- "id": repositoryId,
109
- "title": "",
110
- "uri": "http://address:5423/repositories/ontop",
111
- "externalUrl": "http://address:5423/repositories/ontop",
112
- "local": true,
113
- "type": "ontop",
114
- "sesameType": "graphdb:OntopRepository",
115
- "location": "",
116
- "readable": true,
117
- "writable": true,
118
- "unsupported": false,
119
- "state": "ACTIVE"
120
- }
121
- ]
122
- }
108
+ id: repositoryId,
109
+ title: '',
110
+ uri: 'http://address:5423/repositories/ontop',
111
+ externalUrl: 'http://address:5423/repositories/ontop',
112
+ local: true,
113
+ type: 'ontop',
114
+ sesameType: 'graphdb:OntopRepository',
115
+ location: '',
116
+ readable: true,
117
+ writable: true,
118
+ unsupported: false,
119
+ state: 'ACTIVE',
120
+ },
121
+ ],
122
+ },
123
123
  }).as('getMockRepositories');
124
124
 
125
125
  cy.intercept(`${REPOSITORIES_URL}/${repositoryId}/restart?location=*`, {
126
126
  statusCode: 200,
127
- body: {}
127
+ body: {},
128
128
  }).as('restartRepository');
129
129
 
130
- RepositoriesStub.stubBaseEndpoints(repositoryId, [{
131
- "type": "literal",
132
- "value": "http://jena.apache.org/ARQ/function/aggregate#"
130
+ RepositoriesStubs.stubBaseEndpoints(repositoryId, [{
131
+ prefix: {
132
+ type: 'literal',
133
+ value: 'agg',
134
+ },
135
+ namespace: {
136
+ type: 'literal',
137
+ value: 'http://jena.apache.org/ARQ/function/aggregate#',
138
+ },
133
139
  }]);
134
140
  }
135
141
 
@@ -137,17 +143,86 @@ export class RepositoriesStubs extends Stubs {
137
143
  cy.intercept(`${REPOSITORIES_URL}/ontop/jdbc-properties?driverType=*`, {
138
144
  statusCode: 200,
139
145
  body: {
140
- "id": repositoryId,
141
- "title": "",
142
- "type": "ontop",
143
- "sesameType": "graphdb:OntopRepository",
144
- "location": "",
145
- "hostName": "localhost",
146
- "driverClass": "postgresql",
147
- "params": this.getFixtureParams()
148
- }
146
+ id: repositoryId,
147
+ title: '',
148
+ type: 'ontop',
149
+ sesameType: 'graphdb:OntopRepository',
150
+ location: '',
151
+ hostName: 'localhost',
152
+ driverClass: 'postgresql',
153
+ params: this.getFixtureParams(),
154
+ },
149
155
  }).as('saveChanges');
150
156
 
151
- cy.intercept(`/rest/repositories/${repositoryId}`, { statusCode: 200 });
157
+ cy.intercept(`/rest/repositories/${repositoryId}`, {statusCode: 200});
158
+ }
159
+
160
+ static stubOntopRepository(repositoryId) {
161
+ const alRepositoryResponse = {
162
+ '': [{
163
+ 'id': repositoryId,
164
+ 'title': '',
165
+ 'uri': `http://b:9000/repositories/${repositoryId}`,
166
+ 'externalUrl': `http://b:9000/repositories/${repositoryId}`,
167
+ 'local': true,
168
+ 'type': 'ontop',
169
+ 'sesameType': 'graphdb:OntopRepository',
170
+ 'location': '',
171
+ 'readable': true,
172
+ 'writable': true,
173
+ 'unsupported': false,
174
+ 'state': 'RUNNING',
175
+ }],
176
+ };
177
+
178
+ cy.intercept('GET', '/rest/repositories/all', {
179
+ statusCode: 200,
180
+ body: alRepositoryResponse,
181
+ }).as('all-repositories');
182
+ }
183
+
184
+ /**
185
+ * @param {string} repositoryId
186
+ * @param {[]}namespaces - An instance of array object have to be:
187
+ * {
188
+ * "prefix" : {
189
+ * "type" : "literal",
190
+ * "value" : "agg"
191
+ * },
192
+ * "namespace" : {
193
+ * "type" : "literal",
194
+ * "value" : "http://jena.apache.org/ARQ/function/aggregate#"
195
+ * }
196
+ * }
197
+ */
198
+ static stubNameSpaces(repositoryId, namespaces = []) {
199
+ const namespacesResponse = {
200
+ 'head': {
201
+ 'vars': [
202
+ 'prefix',
203
+ 'namespace',
204
+ ],
205
+ },
206
+ 'results': {
207
+ 'bindings': namespaces,
208
+ },
209
+ };
210
+ cy.intercept('GET', `/repositories/${repositoryId}/namespaces`, {
211
+ statusCode: 200,
212
+ body: namespacesResponse,
213
+ }).as('namespaces-response');
214
+ }
215
+
216
+ static stubAutocomplete() {
217
+ cy.intercept(`/rest/autocomplete/enabled`, {
218
+ statusCode: 200,
219
+ body: {},
220
+ });
221
+ }
222
+
223
+ static stubBaseEndpoints(repositoryId, namespaces) {
224
+ RepositoriesStubs.stubNameSpaces(repositoryId, namespaces);
225
+ RepositoriesStubs.stubAutocomplete();
226
+ GlobalOperationsStatusesStub.stubNoOperationsResponse('starwars');
152
227
  }
153
228
  }
package/support/e2e.js CHANGED
@@ -37,6 +37,9 @@ installLogsCollector();
37
37
 
38
38
  // We don't want any tests to hit real Google
39
39
  beforeEach(() => {
40
+ // Ensure no pre-set repository leaks between specs
41
+ cy.unsetRepository();
42
+
40
43
  LicenseStubs.stubGoogleCalls();
41
44
  // This env variable is set globally in the cypress.config.js and
42
45
  // can be changed from within the spec files if needed like this