graphdb-workbench-tests 3.0.0-TR4 → 3.0.0-TR6

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 (30) hide show
  1. package/fixtures/graphdb-import/ontology-and-shapes.ttl +562 -0
  2. package/fixtures/graphdb-import/swapi-dataset.ttl +4393 -0
  3. package/fixtures/graphql/endpoints/graphql-endpoints-info.json +49 -0
  4. package/fixtures/graphql/endpoints/graphql-endpoints.json +17 -0
  5. package/fixtures/graphql/endpoints/graphql-swapi-endpoints.json +23 -0
  6. package/fixtures/graphql/endpoints/no-graphql-endpoints-info.json +3 -0
  7. package/fixtures/graphql/soml/swapi-schema-film-restricted.yaml +335 -0
  8. package/fixtures/graphql/soml/swapi-schema.yaml +857 -0
  9. package/fixtures/locale-en.json +173 -1
  10. package/integration/graphql/create-graphql-endpoint.spec.js +261 -0
  11. package/integration/graphql/graphql-endpoint-filtering.spec.js +69 -0
  12. package/integration/graphql/graphql-endpoint-management-view.spec.js +131 -0
  13. package/integration/import/import-server-files-batch-operations.spec.js +4 -3
  14. package/integration/import/import-server-files.spec.js +7 -7
  15. package/integration/import/import-view.spec.js +2 -1
  16. package/integration/sparql-editor/actions/show-saved-queries.spec.js +1 -1
  17. package/npm-shrinkwrap.json +2 -2
  18. package/package.json +1 -1
  19. package/steps/graphql/create-graphql-endpoint-steps.js +253 -0
  20. package/steps/graphql/graphql-endpoint-management-steps.js +84 -0
  21. package/steps/graphql/graphql-playground-steps.js +1 -1
  22. package/steps/import/import-test-constants.js +1 -0
  23. package/stubs/graphql/graphql-stubs.js +30 -4
  24. package/stubs/repositories/repositories-stubs.js +4 -0
  25. package/stubs/yasgui/query-stubs.js +2 -2
  26. package/support/import-commands.js +28 -0
  27. package/fixtures/graphql-editor/graphql-endpoints.json +0 -17
  28. /package/fixtures/{graphql-editor → graphql/editor}/countries-schema.json +0 -0
  29. /package/fixtures/{graphql-editor → graphql/editor}/rick-and-morty-schema.json +0 -0
  30. /package/fixtures/{graphql-editor → queries}/default-query-response.json +0 -0
@@ -1,5 +1,6 @@
1
1
  import {ImportServerFilesSteps} from "../../steps/import/import-server-files-steps";
2
2
  import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
3
+ import {SERVER_FILES_COUNT} from "../../steps/import/import-test-constants";
3
4
 
4
5
  describe('Import server files - Batch operations', () => {
5
6
 
@@ -11,7 +12,7 @@ describe('Import server files - Batch operations', () => {
11
12
  repositoryId = 'server-import-' + Date.now();
12
13
  cy.createRepository({id: repositoryId});
13
14
  ImportServerFilesSteps.visitServerImport(repositoryId);
14
- ImportServerFilesSteps.getResources().should('have.length', 18);
15
+ ImportServerFilesSteps.getResources().should('have.length', SERVER_FILES_COUNT);
15
16
  });
16
17
 
17
18
  afterEach(() => {
@@ -48,7 +49,7 @@ describe('Import server files - Batch operations', () => {
48
49
  // When I select All files from the menu
49
50
  ImportServerFilesSteps.selectAllResources();
50
51
  // Then I should see all files selected
51
- ImportServerFilesSteps.getSelectedResources().should('have.length', 18);
52
+ ImportServerFilesSteps.getSelectedResources().should('have.length', SERVER_FILES_COUNT);
52
53
  // When I select None from the menu
53
54
  ImportServerFilesSteps.deselectAllResources();
54
55
  // Then I should see no files selected
@@ -65,7 +66,7 @@ describe('Import server files - Batch operations', () => {
65
66
  // When I select Not Imported from the menu
66
67
  ImportServerFilesSteps.selectNotImportedResources();
67
68
  // Then I should see only not imported files selected
68
- ImportServerFilesSteps.getSelectedResources().should('have.length', 17);
69
+ ImportServerFilesSteps.getSelectedResources().should('have.length', SERVER_FILES_COUNT - 1);
69
70
  // Deselect all for the next step
70
71
  ImportServerFilesSteps.deselectAllResources();
71
72
  ImportServerFilesSteps.getSelectedResources().should('have.length', 0);
@@ -2,7 +2,7 @@ import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
2
2
  import {ImportServerFilesSteps} from "../../steps/import/import-server-files-steps";
3
3
  import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
4
4
  import {ImportResourceMessageDialog} from "../../steps/import/import-resource-message-dialog";
5
- import {ApplicationSteps} from "../../steps/application-steps";
5
+ import {SERVER_FILES_COUNT} from "../../steps/import/import-test-constants";
6
6
 
7
7
  describe('Import server files', () => {
8
8
 
@@ -14,7 +14,7 @@ describe('Import server files', () => {
14
14
  repositoryId = 'server-import-' + Date.now();
15
15
  cy.createRepository({id: repositoryId});
16
16
  ImportServerFilesSteps.visitServerImport(repositoryId);
17
- ImportServerFilesSteps.getResources().should('have.length', 18);
17
+ ImportServerFilesSteps.getResources().should('have.length', SERVER_FILES_COUNT);
18
18
  });
19
19
 
20
20
  afterEach(() => {
@@ -66,7 +66,7 @@ describe('Import server files', () => {
66
66
  // When the server files tab is loaded
67
67
  // Then I should see all the files and folders by default
68
68
  ImportServerFilesSteps.getShowAllResourceTypesButton().should('have.class', 'active');
69
- ImportServerFilesSteps.getResources().should('have.length', 18);
69
+ ImportServerFilesSteps.getResources().should('have.length', SERVER_FILES_COUNT);
70
70
  // When I select the folders only filter
71
71
  ImportServerFilesSteps.selectFoldersOnlyFilter();
72
72
  // Then I should see only the folders
@@ -75,7 +75,7 @@ describe('Import server files', () => {
75
75
  // When I select the files only filter
76
76
  ImportServerFilesSteps.selectFilesOnlyFilter();
77
77
  // Then I should see only the files
78
- ImportServerFilesSteps.getResources().should('have.length', 16);
78
+ ImportServerFilesSteps.getResources().should('have.length', SERVER_FILES_COUNT - 2);
79
79
  });
80
80
 
81
81
  it('should be able to import the whole directory', () => {
@@ -180,8 +180,8 @@ describe('Import server files', () => {
180
180
  ImportServerFilesSteps.getResource(5).should('contain', "rdfxml.rdf");
181
181
  ImportServerFilesSteps.getResource(6).should('contain', "jsonld-file.jsonld");
182
182
  // checks files in root
183
- ImportServerFilesSteps.getResource(15).should('contain', "0007-import-file.jsonld");
184
- ImportServerFilesSteps.getResource(16).should('contain', "test_turtlestar.ttls");
185
- ImportServerFilesSteps.getResource(17).should('contain', "bnodes.ttl");
183
+ ImportServerFilesSteps.getResource(17).should('contain', "0007-import-file.jsonld");
184
+ ImportServerFilesSteps.getResource(18).should('contain', "test_turtlestar.ttls");
185
+ ImportServerFilesSteps.getResource(19).should('contain', "bnodes.ttl");
186
186
  });
187
187
  });
@@ -3,6 +3,7 @@ import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
3
3
  import {ImportServerFilesSteps} from "../../steps/import/import-server-files-steps";
4
4
  import ImportSteps from "../../steps/import/import-steps";
5
5
  import HomeSteps from "../../steps/home-steps";
6
+ import {SERVER_FILES_COUNT} from "../../steps/import/import-test-constants";
6
7
 
7
8
  const bnodes = `_:node0 <http://purl.org/dc/elements/1.1/title> "A new book" ;
8
9
  \t<http://purl.org/dc/elements/1.1/creator> "A.N.Other" .`;
@@ -39,7 +40,7 @@ describe('Import view', () => {
39
40
  // When I switch to the server files tab
40
41
  ImportUserDataSteps.openServerFilesTab();
41
42
  // Then I should see the server files only
42
- ImportServerFilesSteps.getResources().should('have.length', 18);
43
+ ImportServerFilesSteps.getResources().should('have.length', SERVER_FILES_COUNT);
43
44
  // When I switch back to the user data tab
44
45
  ImportServerFilesSteps.openUserDataTab();
45
46
  // Then I should see the uploaded file
@@ -12,7 +12,7 @@ describe('Show saved queries', () => {
12
12
  QueryStubs.stubQueryCountResponse();
13
13
  cy.createRepository({id: repositoryId});
14
14
  cy.presetRepository(repositoryId);
15
- cy.intercept(`/repositories/${repositoryId}`, {fixture: '/graphql-editor/default-query-response.json'}).as('getGuides');
15
+ cy.intercept(`/repositories/${repositoryId}`, {fixture: '/queries/default-query-response.json'}).as('getGuides');
16
16
 
17
17
  SparqlEditorSteps.visitSparqlEditorPage();
18
18
  YasguiSteps.getYasgui().should('be.visible');
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.0.0-TR4",
3
+ "version": "3.0.0-TR6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.0.0-TR4",
9
+ "version": "3.0.0-TR6",
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": "3.0.0-TR4",
3
+ "version": "3.0.0-TR6",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
@@ -0,0 +1,253 @@
1
+ export class CreateGraphqlEndpointSteps {
2
+ static visit() {
3
+ return cy.visit('/graphql/endpoint/create');
4
+ }
5
+
6
+ static getView() {
7
+ return cy.get('.create-graphql-endpoint-view');
8
+ }
9
+
10
+ static getSourceRepositorySelector() {
11
+ return this.getView().find('.source-repository-selector');
12
+ }
13
+
14
+ static getSelectedSourceRepository() {
15
+ return this.getSourceRepositorySelector().find('option:selected');
16
+ }
17
+
18
+ static getActiveStep() {
19
+ return this.getView().find('.wizard-step.active');
20
+ }
21
+
22
+ // ===================================
23
+ // Schema source view
24
+ // ===================================
25
+
26
+ static getSelectSchemaSourceView() {
27
+ return this.getView().find('.select-schema-source-view');
28
+ }
29
+
30
+ static getSchemaSourceTypes() {
31
+ return this.getSelectSchemaSourceView().find('.schema-source-type input[type=radio]');
32
+ }
33
+
34
+ static getSelectedSchemaSource() {
35
+ return this.getSelectSchemaSourceView().find('.schema-source-type input[type=radio]:checked');
36
+ }
37
+
38
+ static selectOntologiesAndShaclShapesOption() {
39
+ this.getSelectSchemaSourceView().find(`.schema-source-type input[type=radio]`).eq(1).click();
40
+ }
41
+
42
+ // ===================================
43
+ // Graphql schema shapes view
44
+ // ===================================
45
+
46
+ static getGraphqlSchemaShapesView() {
47
+ return this.getView().find('.graphql-schema-shapes');
48
+ }
49
+
50
+ static getGraphqlSchemaShapesNotFound() {
51
+ return this.getGraphqlSchemaShapesView().find('.no-shapes');
52
+ }
53
+
54
+ static getGraphqlSchemaSelector() {
55
+ return this.getGraphqlSchemaShapesView().find('.graphql-shapes-selector .shuttle-multiselect');
56
+ }
57
+
58
+ static getSelectedGraphqlShapesCountBanner() {
59
+ return this.getGraphqlSchemaSelector().find('.toolbar-right .selected-items-message');
60
+ }
61
+
62
+ static getAvailableGraphqlShapes() {
63
+ return this.getGraphqlSchemaSelector().find('.available-options .option-item');
64
+ }
65
+
66
+ static getAvailableGraphqlShape(index) {
67
+ return this.getAvailableGraphqlShapes().eq(index);
68
+ }
69
+
70
+ static getSelectedGraphqlShapes() {
71
+ return this.getGraphqlSchemaSelector().find('.selected-options .option-item');
72
+ }
73
+
74
+ static getSelectedGraphqlShape(index) {
75
+ return this.getSelectedGraphqlShapes().eq(index);
76
+ }
77
+
78
+ static selectAllGraphqlShapes() {
79
+ this.getGraphqlSchemaSelector().find('.add-all-btn').click();
80
+ }
81
+
82
+ static deselectAllGraphqlShapes() {
83
+ this.getGraphqlSchemaSelector().find('.remove-all-btn').click();
84
+ }
85
+
86
+ static selectGraphqlShape(index) {
87
+ this.getAvailableGraphqlShapes().eq(index).find('.add-btn').click();
88
+ }
89
+
90
+ static deselectAllGraphqlShape(index) {
91
+ this.getSelectedGraphqlShapes().eq(index).find('.remove-btn').click();
92
+ }
93
+
94
+ static filterSelectedGraphqlShapes(term) {
95
+ this.getGraphqlSchemaSelector().find('.toolbar-left .filter-selected').clear().type(term);
96
+ }
97
+
98
+ static clearSelectedGraphqlShapesFilter() {
99
+ this.getGraphqlSchemaSelector().find('.toolbar-left .filter-selected').clear();
100
+ }
101
+
102
+ // ===================================
103
+ // Ontologies and SHACL shapes view
104
+ // ===================================
105
+
106
+ static getOntologiesAndShaclShapesView() {
107
+ return this.getView().find('.ontologies-and-shacl-shapes');
108
+ }
109
+
110
+ static getGraphSourceTypes() {
111
+ return this.getOntologiesAndShaclShapesView().find('.graph-source-type input[type=radio]');
112
+ }
113
+
114
+ static getSelectedGraphSource() {
115
+ return this.getOntologiesAndShaclShapesView().find('.graph-source-type input[type=radio]:checked');
116
+ }
117
+
118
+ static selectUseAllGraphsOption() {
119
+ this.getOntologiesAndShaclShapesView().find(`.graph-source-type input[type=radio]`).eq(0).click();
120
+ }
121
+
122
+ static selectUseShaclShapeGraphsOption() {
123
+ this.getOntologiesAndShaclShapesView().find(`.graph-source-type input[type=radio]`).eq(1).click();
124
+ }
125
+
126
+ static selectPickGraphsOption() {
127
+ this.getOntologiesAndShaclShapesView().find(`.graph-source-type input[type=radio]`).eq(2).click();
128
+ }
129
+
130
+ static getGraphsNotFound() {
131
+ return this.getOntologiesAndShaclShapesView().find('.use-all-graphs .no-graphs');
132
+ }
133
+
134
+ static getAllGraphsWillBeUsedMessage() {
135
+ return this.getOntologiesAndShaclShapesView().find('.use-all-graphs .all-graphs-selected');
136
+ }
137
+
138
+ static getPickGraphsNoGraphsFound() {
139
+ return this.getOntologiesAndShaclShapesView().find('.select-graphs .no-graphs');
140
+ }
141
+
142
+ static getShaclShapeGraphsNotFound() {
143
+ return this.getOntologiesAndShaclShapesView().find('.use-all-shacl-shape-graphs .no-shacl-shapes');
144
+ }
145
+
146
+ static getEndpointParamsForm() {
147
+ return this.getView().find('.endpoint-params-form');
148
+ }
149
+
150
+ // Endpoint ID field
151
+ static getEndpointIdField() {
152
+ return this.getEndpointParamsForm().find('.endpoint-id');
153
+ }
154
+
155
+ static getEndpointIdFieldInput() {
156
+ return this.getEndpointIdField().find('input');
157
+ }
158
+
159
+ static typeEndpointId(endpointId) {
160
+ this.getEndpointIdFieldInput().clear().type(endpointId);
161
+ }
162
+
163
+ // Endpoint label field
164
+ static getEndpointLabelField() {
165
+ return this.getEndpointParamsForm().find('.endpoint-label');
166
+ }
167
+
168
+ static getEndpointLabelFieldInput() {
169
+ return this.getEndpointLabelField().find('input');
170
+ }
171
+
172
+ static typeEndpointLabel(endpointLabel) {
173
+ this.getEndpointLabelFieldInput().clear().type(endpointLabel);
174
+ }
175
+
176
+ // Vocabulary prefix select
177
+ static getVocabularyPrefixSelectField() {
178
+ return this.getEndpointParamsForm().find('.vocabulary-prefix');
179
+ }
180
+
181
+ static getVocabularyPrefixSelect() {
182
+ return this.getVocabularyPrefixSelectField().find('select');
183
+ }
184
+
185
+ static getVocabularyPrefixSelectOptions() {
186
+ return this.getVocabularyPrefixSelect().find('option');
187
+ }
188
+
189
+ static getVocabularyPrefixSelectSelectedOption() {
190
+ return this.getVocabularyPrefixSelect().find('option:selected');
191
+ }
192
+
193
+ static selectVocabularyPrefix(prefix) {
194
+ this.getVocabularyPrefixSelect().select(prefix);
195
+ }
196
+
197
+ // Graphs selector
198
+ static getGraphsSelector() {
199
+ return this.getOntologiesAndShaclShapesView().find('.graphs-selector .shuttle-multiselect');
200
+ }
201
+
202
+ static getAvailableGraphs() {
203
+ return this.getGraphsSelector().find('.available-options .option-item');
204
+ }
205
+
206
+ static getSelectedGraphs() {
207
+ return this.getGraphsSelector().find('.selected-options .option-item');
208
+ }
209
+
210
+ static getSelectedGraphsCountBanner() {
211
+ return this.getGraphsSelector().find('.toolbar-right .selected-items-message');
212
+ }
213
+
214
+ static selectAllGraphs() {
215
+ this.getGraphsSelector().find('.add-all-btn').click();
216
+ }
217
+
218
+ // ===================================
219
+ // Configure endpoint view
220
+ // ===================================
221
+
222
+ static getConfigureEndpointView() {
223
+ return this.getView().find('.endpoint-configuration-view');
224
+ }
225
+
226
+ // ===================================
227
+ // Wizard actions
228
+ // ===================================
229
+
230
+ static getCancelButton() {
231
+ return this.getView().find('.cancel-btn');
232
+ }
233
+
234
+ static cancelEndpointCreation() {
235
+ this.getCancelButton().click();
236
+ }
237
+
238
+ static getNextStepButton() {
239
+ return this.getView().find('.next-btn');
240
+ }
241
+
242
+ static next() {
243
+ this.getNextStepButton().click();
244
+ }
245
+
246
+ static getBackButton() {
247
+ return this.getView().find('.back-btn');
248
+ }
249
+
250
+ static back() {
251
+ this.getBackButton().click();
252
+ }
253
+ }
@@ -0,0 +1,84 @@
1
+ const VIEW_URL = '/graphql/endpoints';
2
+
3
+ export class GraphqlEndpointManagementSteps {
4
+
5
+ static visit() {
6
+ return cy.visit(VIEW_URL);
7
+ }
8
+
9
+ static getView() {
10
+ return cy.get('.graphql-endpoint-management-view');
11
+ }
12
+
13
+ static getEndpointFilterField() {
14
+ return this.getView().find('.endpoints-filter-field');
15
+ }
16
+
17
+ static getCreateEndpointButton() {
18
+ return this.getView().find('.create-endpoint-btn');
19
+ }
20
+
21
+ static getImportEndpointSchemaDefinitionButton() {
22
+ return this.getView().find('.import-schema-definition-btn');
23
+ }
24
+
25
+ static getEndpointTable() {
26
+ return this.getView().find('.endpoints-info-table');
27
+ }
28
+
29
+ static getEndpointsInfo() {
30
+ return this.getEndpointTable().find('tbody tr');
31
+ }
32
+
33
+ static getEndpointLink(index) {
34
+ return this.getEndpointsInfo().eq(index).find('.endpoint-link');
35
+ }
36
+
37
+ static exploreEndpoint(index) {
38
+ this.getEndpointLink(index).click();
39
+ }
40
+
41
+ static toggleEndpointRow(index) {
42
+ return this.getEndpointsInfo().eq(index).find('.toggle-row a').click();
43
+ }
44
+
45
+ static filterEndpoints(term) {
46
+ this.getEndpointFilterField().type(term);
47
+ }
48
+
49
+ static clearFilter() {
50
+ this.getEndpointFilterField().clear();
51
+ }
52
+
53
+ static getNoResultsInTableBanner() {
54
+ return this.getEndpointTable().find('.no-results');
55
+ }
56
+
57
+ static getNoEndpointsInRepositoryBanner() {
58
+ return this.getView().find('.no-endpoints');
59
+ }
60
+
61
+ static createEndpoint() {
62
+ this.getView().find('.create-endpoint-btn').click();
63
+ }
64
+
65
+ static verifyEndpointInfo(data) {
66
+ this.getEndpointsInfo().each(($row, index) => {
67
+ const endpointInfo = data[index];
68
+ cy.wrap($row).within(() => {
69
+ cy.get('td').eq(1).should('contain', endpointInfo.id);
70
+ cy.get('td').eq(2).should('contain', endpointInfo.label);
71
+ cy.get('td').eq(3).should('contain', endpointInfo.default ? 'yes' : 'no');
72
+ cy.get('td').eq(4).should('contain', endpointInfo.active ? 'yes' : 'no');
73
+ cy.get('td').eq(5).should('contain', endpointInfo.modified);
74
+ cy.get('td').eq(6).should('contain', endpointInfo.types);
75
+ cy.get('td').eq(7).should('contain', endpointInfo.properties);
76
+ cy.get('td').eq(8).find('button').should('have.length', 4);
77
+ });
78
+ // expand the row and check the description outside the wrapper
79
+ this.toggleEndpointRow(index).closest('tr').next('tr')
80
+ .find('.endpoint-description').should('contain', endpointInfo.description);
81
+ this.toggleEndpointRow(index);
82
+ });
83
+ }
84
+ }
@@ -1,4 +1,4 @@
1
- const VIEW_URL = '/graphql-playground';
1
+ const VIEW_URL = '/graphql/playground';
2
2
 
3
3
  export class GraphqlPlaygroundSteps {
4
4
 
@@ -0,0 +1 @@
1
+ export const SERVER_FILES_COUNT = 20;
@@ -2,17 +2,43 @@ export const ENDPOINT_COUNTRIES = '/rest/repositories/test/graphql/countries';
2
2
  export const ENDPOINT_RICKMORTY = '/rest/repositories/test/graphql/rickmorty';
3
3
 
4
4
  export class GraphqlStubs {
5
- static stubGetEndpoints(repositoryId, delay = 0) {
5
+ static stubGetEndpoints(repositoryId, fixture = 'graphql-endpoints.json', delay = 0) {
6
+ const fuxturePath = `/graphql/endpoints/${fixture}`;
6
7
  cy.intercept('GET', `/rest/repositories/${repositoryId}/graphql/endpoints`, {
7
- fixture: '/graphql-editor/graphql-endpoints.json',
8
+ fixture: fuxturePath,
8
9
  statusCode: 200,
9
10
  delay: delay
10
11
  }).as('get-endpoints');
11
12
  }
12
13
 
14
+ static stubGetEndpointsInfo(repositoryId, fixture = 'graphql-endpoints-info.json', delay = 0) {
15
+ cy.intercept('GET', `/rest/repositories/${repositoryId}/manage/graphql/endpoints`, {
16
+ fixture: `/graphql/endpoints/${fixture}`,
17
+ statusCode: 200,
18
+ delay: delay
19
+ }).as('get-endpoints-info');
20
+ }
21
+
22
+ static stubGetNoEndpointsInfo(repositoryId, fixture = 'no-graphql-endpoints-info.json', delay = 0) {
23
+ cy.intercept('GET', `/rest/repositories/${repositoryId}/manage/graphql/endpoints`, {
24
+ fixture: `/graphql/endpoints/${fixture}`,
25
+ statusCode: 200,
26
+ delay: delay
27
+ }).as('get-no-endpoints-info');
28
+ }
29
+
30
+ static stubGetEndpointsInfoError(repositoryId) {
31
+ cy.intercept('GET', `/rest/repositories/${repositoryId}/manage/graphql/endpoints`, {
32
+ statusCode: 500,
33
+ response: {
34
+ error: "Required request parameter 'query' for method parameter type String is not present"
35
+ }
36
+ }).as('get-endpoints-info-error');
37
+ }
38
+
13
39
  static stubCountriesSchema() {
14
40
  cy.intercept('POST', ENDPOINT_COUNTRIES, (req) => {
15
- stubQuery(req, 'IntrospectionQuery', 'graphql-editor/countries-schema.json');
41
+ stubQuery(req, 'IntrospectionQuery', 'graphql/editor/countries-schema.json');
16
42
  stubQuery(req, 'GetContinentById', {
17
43
  data: {
18
44
  name: 'Europe'
@@ -23,7 +49,7 @@ export class GraphqlStubs {
23
49
 
24
50
  static stubStubRickAndMortySchema() {
25
51
  cy.intercept('POST', ENDPOINT_RICKMORTY, (req) => {
26
- stubQuery(req, 'IntrospectionQuery', 'graphql-editor/rick-and-morty-schema.json');
52
+ stubQuery(req, 'IntrospectionQuery', 'graphql/editor/rick-and-morty-schema.json');
27
53
  stubQuery(req, 'Character', {
28
54
  data: {
29
55
  name: 'Morty Smith'
@@ -7,6 +7,10 @@ export class RepositoriesStubs extends Stubs {
7
7
  RepositoriesStubs.stubGetQueryResponse('/rest/repositories/all', fixture, 'get-all-repositories', withDelay);
8
8
  }
9
9
 
10
+ static spyGetRepositories() {
11
+ cy.intercept('GET', '/rest/repositories/all').as('getRepositories');
12
+ }
13
+
10
14
  static stubLocations(withDelay = 0) {
11
15
  RepositoriesStubs.stubQueryResponse('/rest/locations', '/repositories/get-locations.json', 'get-locations', withDelay);
12
16
  }
@@ -11,11 +11,11 @@ export class QueryStubs {
11
11
  cy.intercept('GET', '/rest/monitor/query/count', {body: 0});
12
12
  }
13
13
  static stubDefaultQueryResponse(repositoryId, withDelay = 0) {
14
- QueryStubs.stubQueryResponse(repositoryId, '/graphql-editor/default-query-response.json', withDelay);
14
+ QueryStubs.stubQueryResponse(repositoryId, '/queries/default-query-response.json', withDelay);
15
15
  }
16
16
 
17
17
  static stubLongRunningQuery(repositoryId, delay = 3000) {
18
- QueryStubs.stubQueryResponse(repositoryId, '/graphql-editor/default-query-response.json', delay);
18
+ QueryStubs.stubQueryResponse(repositoryId, '/queries/default-query-response.json', delay);
19
19
  }
20
20
 
21
21
  static stubEmptyQueryResponse(repositoryId, withDelay = 0) {
@@ -5,6 +5,34 @@ const UPLOAD_URL = '/import/upload/';
5
5
  const SERVER_URL = '/import/server/';
6
6
  const POLL_INTERVAL = 200;
7
7
 
8
+ // Imports a graphql schema to the repository
9
+ Cypress.Commands.add('uploadGraphqlSchema', (repositoryId, schemaPath, schemaId ) => {
10
+ cy.fixture(schemaPath).then((schema) => {
11
+ cy.request({
12
+ method: 'POST',
13
+ url: `${REPOSITORIES_URL}${repositoryId}/soml`,
14
+ headers: {'Content-type': 'text/yaml'},
15
+ body: schema
16
+ }).should((response) => expect(response.status).to.equal(201));
17
+ waitForGraphqlSchema(repositoryId, schemaId);
18
+ });
19
+ });
20
+
21
+ // Waits for the schema import to finish
22
+ function waitForGraphqlSchema(repositoryId, schemaId) {
23
+ cy.request({
24
+ method: 'GET',
25
+ url: `${REPOSITORIES_URL}${repositoryId}/soml/${schemaId}`
26
+ }).then((response) => {
27
+ // const importStatus = Cypress._.find(response.body, (importStatus) => importStatus.name === fileName);
28
+ if (response.status === 200 && response.body && response.body.id === `/soml/${schemaId}`) {
29
+ return;
30
+ }
31
+ cy.wait(POLL_INTERVAL);
32
+ waitForGraphqlSchema(repositoryId, schemaId);
33
+ });
34
+ }
35
+
8
36
  Cypress.Commands.add('importRDFTextSnippet', (repositoryId, rdf, importSettings = {}) => {
9
37
  const importData = Cypress._.defaultsDeep(importSettings, snippetImportTemplate);
10
38
  importData.data = rdf;
@@ -1,17 +0,0 @@
1
- {
2
- "repository": "test",
3
- "endpoints": [
4
- {
5
- "id": "countries",
6
- "graphQL": "/rest/repositories/test/graphql/countries",
7
- "active": true,
8
- "default": false
9
- },
10
- {
11
- "id": "rickmorty",
12
- "graphQL": "/rest/repositories/test/graphql/rickmorty",
13
- "active": true,
14
- "default": false
15
- }
16
- ]
17
- }