graphdb-workbench-tests 3.0.0-TR6 → 3.0.0-TR8

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,46 @@
1
+ {
2
+ "configs": [
3
+ {
4
+ "key": "str",
5
+ "label": "String",
6
+ "type": "string",
7
+ "collection": false,
8
+ "value": "strValue",
9
+ "values": [],
10
+ "regex": "^(?:ALL:?)?(?:(?:-?[\\w]{2}(?:-[\\w]*)?~?|-?NONE|ANY|BROWSER)?(?:,(?:-?[\\w]{2}(?:-[\\w]*)?~?|-?NONE|ANY|BROWSER))*)$"
11
+ },
12
+ {
13
+ "key": "bool",
14
+ "label": "Boolean value",
15
+ "type": "boolean",
16
+ "collection": false,
17
+ "value": false,
18
+ "values": []
19
+ },
20
+ {
21
+ "key": "select",
22
+ "label": "Select",
23
+ "type": "string",
24
+ "collection": false,
25
+ "value": "Two",
26
+ "values": ["One", "Two", "Three"]
27
+ },
28
+ {
29
+ "key": "multiselect",
30
+ "label": "Multiselect",
31
+ "type": "string",
32
+ "collection": true,
33
+ "value": ["Angular", "JavaScript"],
34
+ "values": ["Angular", "JavaScript", "WebDevelopment"]
35
+ },
36
+ {
37
+ "key": "json",
38
+ "label": "JSON",
39
+ "type": "json",
40
+ "collection": false,
41
+ "value": "{\"foo\": \"bar\"}",
42
+ "values": [],
43
+ "required": true
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,227 @@
1
+ {
2
+ "configs": [
3
+ {
4
+ "key": "enable_mutations",
5
+ "label": "enable_mutations",
6
+ "description": "Controls whether the generated GraphQL schema should include object mutations or not.",
7
+ "type": "boolean",
8
+ "collection": false,
9
+ "value": null,
10
+ "values": null,
11
+ "required": false,
12
+ "regex": null
13
+ },
14
+ {
15
+ "key": "lang.fetch",
16
+ "label": "fetch",
17
+ "description": "Default language fetch configuration",
18
+ "type": "string",
19
+ "collection": false,
20
+ "value": null,
21
+ "values": null,
22
+ "required": false,
23
+ "regex": "^(?:ALL:?)?(?:(?:-?[\\w]{2}(?:-[\\w]*)?~?|-?NONE|ANY|BROWSER)?(?:,(?:-?[\\w]{2}(?:-[\\w]*)?~?|-?NONE|ANY|BROWSER))*)$"
24
+ },
25
+ {
26
+ "key": "lang.validate",
27
+ "label": "validate",
28
+ "description": "Default language validation configuration",
29
+ "type": "string",
30
+ "collection": false,
31
+ "value": "UNIQ",
32
+ "values": null,
33
+ "required": false,
34
+ "regex": "^(?:[\\w]{2}~?|NONE|ANY|ALL)?(?:,(?:[\\w]{2}~?|NONE|ANY|ALL))*(?:;?UNIQ)?$"
35
+ },
36
+ {
37
+ "key": "lang.implicit",
38
+ "label": "implicit",
39
+ "description": "Default language to use when inserting rdf:langString values.",
40
+ "type": "string",
41
+ "collection": false,
42
+ "value": "en",
43
+ "values": null,
44
+ "required": false,
45
+ "regex": "[\\w]{2}(?:-[\\w]*)?"
46
+ },
47
+ {
48
+ "key": "lang.defaultNameFetch",
49
+ "label": "defaultNameFetch",
50
+ "description": "Default language spec to apply when loading values for the name property",
51
+ "type": "string",
52
+ "collection": false,
53
+ "value": "ANY",
54
+ "values": null,
55
+ "required": false,
56
+ "regex": "^(?:(?:-?[\\w]{2}(?:-[\\w]*)?~?|-?NONE|ANY|BROWSER)?(?:,(?:-?[\\w]{2}(?:-[\\w]*)?~?|-?NONE|ANY|BROWSER))*)$"
57
+ },
58
+ {
59
+ "key": "lang.appendDefaultNameFetch",
60
+ "label": "appendDefaultNameFetch",
61
+ "description": "Specifies whether the default spec, if any, should be appended or not to any user-defined name fetch spec",
62
+ "type": "boolean",
63
+ "collection": false,
64
+ "value": true,
65
+ "values": null,
66
+ "required": false,
67
+ "regex": null
68
+ },
69
+ {
70
+ "key": "queryPfx",
71
+ "label": "queryPfx",
72
+ "description": "Allows setting a prefix that will be put in all queries in the GraphQL schema.",
73
+ "type": "string",
74
+ "collection": false,
75
+ "value": null,
76
+ "values": null,
77
+ "required": false,
78
+ "regex": "[\\w]*"
79
+ },
80
+ {
81
+ "key": "mutationPfx",
82
+ "label": "mutationPfx",
83
+ "description": "Allows setting a prefix that will be put in all mutations in the GraphQL schema.",
84
+ "type": "string",
85
+ "collection": false,
86
+ "value": null,
87
+ "values": null,
88
+ "required": false,
89
+ "regex": "[\\w]*"
90
+ },
91
+ {
92
+ "key": "search",
93
+ "label": "search",
94
+ "description": "Allows you to define a structure of the searchable data for fields that are not specified in the configuration of the objects and/or properties",
95
+ "type": "dictionary",
96
+ "collection": false,
97
+ "value": null,
98
+ "values": null,
99
+ "required": false,
100
+ "regex": null
101
+ },
102
+ {
103
+ "key": "repository",
104
+ "label": "repository",
105
+ "description": "Changes the default repository used for the entire schema.",
106
+ "type": "string",
107
+ "collection": false,
108
+ "value": null,
109
+ "values": null,
110
+ "required": false,
111
+ "regex": "[\\w]*"
112
+ },
113
+ {
114
+ "key": "includeInferred",
115
+ "label": "includeInferred",
116
+ "description": "Controls whether query inference is enabled or disabled by default for all queries and mutations.",
117
+ "type": "boolean",
118
+ "collection": false,
119
+ "value": true,
120
+ "values": null,
121
+ "required": false,
122
+ "regex": null
123
+ },
124
+ {
125
+ "key": "expandOwlSameAs",
126
+ "label": "expandOwlSameAs",
127
+ "description": "Controls whether owl:sameAs expansion is enabled or disabled by default for all queries and mutations.",
128
+ "type": "boolean",
129
+ "collection": false,
130
+ "value": true,
131
+ "values": null,
132
+ "required": false,
133
+ "regex": null
134
+ },
135
+ {
136
+ "key": "disabledChecks",
137
+ "label": "disabledChecks",
138
+ "description": "Specifies which checks could be disabled during the schema validation.",
139
+ "type": "string",
140
+ "collection": true,
141
+ "value": true,
142
+ "values": [
143
+ "regexInheritanceCheck",
144
+ "rangeCheck"
145
+ ],
146
+ "required": false,
147
+ "regex": null
148
+ },
149
+ {
150
+ "key": "defaultRole",
151
+ "label": "defaultRole",
152
+ "description": "The default RBAC role the user will receive if no roles are found in the security JWT token or none of the roles match any in the rbac section of the current SOML schema.",
153
+ "type": "string",
154
+ "collection": false,
155
+ "value": "defaultRole",
156
+ "values": null,
157
+ "required": false,
158
+ "regex": "[\\w]*"
159
+ },
160
+ {
161
+ "key": "defaultIntegrationRole",
162
+ "label": "defaultIntegrationRole",
163
+ "description": "The default RBAC role that will have read-only access to the data and could be used for system integrations.",
164
+ "type": "string",
165
+ "collection": false,
166
+ "value": "Federation_SystemRole",
167
+ "values": null,
168
+ "required": false,
169
+ "regex": "[\\w]*"
170
+ },
171
+ {
172
+ "key": "exposeSomlInGraphQL",
173
+ "label": "exposeSomlInGraphQL",
174
+ "description": "Controls whether GraphQL schema should include directives that expose the effective SOML configurations for each output type and property.",
175
+ "type": "boolean",
176
+ "collection": false,
177
+ "value": false,
178
+ "values": null,
179
+ "required": false,
180
+ "regex": null
181
+ },
182
+ {
183
+ "key": "enableCollectionCount",
184
+ "label": "enableCollectionCount",
185
+ "description": "Controls whether the collections should have a companion property that provides counting of the collection properties.",
186
+ "type": "boolean",
187
+ "collection": false,
188
+ "value": false,
189
+ "values": null,
190
+ "required": false,
191
+ "regex": null
192
+ },
193
+ {
194
+ "key": "enableTypeCount",
195
+ "label": "enableTypeCount",
196
+ "description": "Controls whether new counting queries should be generated for all queryable types.",
197
+ "type": "boolean",
198
+ "collection": false,
199
+ "value": false,
200
+ "values": null,
201
+ "required": false,
202
+ "regex": null
203
+ },
204
+ {
205
+ "key": "compactErrorMessages",
206
+ "label": "compactErrorMessages",
207
+ "description": "Controls the default behavior of the GraphQL Responder how to process the errors that are returned to the client.",
208
+ "type": "boolean",
209
+ "collection": false,
210
+ "value": false,
211
+ "values": null,
212
+ "required": false,
213
+ "regex": null
214
+ },
215
+ {
216
+ "key": "enableGraphQlExplain",
217
+ "label": "enableGraphQlExplain",
218
+ "description": "Controls whether SemanticObjects should provide the generated SPARQL query or its explain plan.",
219
+ "type": "boolean",
220
+ "collection": false,
221
+ "value": true,
222
+ "values": null,
223
+ "required": false,
224
+ "regex": null
225
+ }
226
+ ]
227
+ }
@@ -0,0 +1,51 @@
1
+ id: /soml/swapi-planets
2
+ label: Star Wars planets API
3
+ creator: http://ontotext.com
4
+ created: 2019-06-15
5
+ updated: 2019-06-16
6
+ versionInfo: 0.1
7
+
8
+ prefixes:
9
+ # common prefixes
10
+ so: "http://www.ontotext.com/semantic-object/"
11
+ voc: "https://swapi.co/vocabulary/"
12
+ dct: "http://purl.org/dc/terms/"
13
+ gn: "http://www.geonames.org/ontology#"
14
+ owl: "http://www.w3.org/2002/07/owl#"
15
+ puml: "http://plantuml.com/ontology#"
16
+ rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ rdfs: "http://www.w3.org/2000/01/rdf-schema#"
18
+ skos: "http://www.w3.org/2004/02/skos/core#"
19
+ void: "http://rdfs.org/ns/void#"
20
+ wgs84: "http://www.w3.org/2003/01/geo/wgs84_pos#"
21
+ xsd: "http://www.w3.org/2001/XMLSchema#"
22
+
23
+ specialPrefixes:
24
+ base_iri: https://swapi.co/resource/
25
+ vocab_iri: https://swapi.co/vocabulary/
26
+ vocab_prefix: voc
27
+
28
+ objects:
29
+ Planet:
30
+ descr: "The fictional universe of the Star Wars franchise features multiple planets and moons"
31
+ type: ["voc:Planet"]
32
+ typeProp: "rdf:type"
33
+ name: "rdfs:label"
34
+ props:
35
+ desc: {label: "Description"}
36
+ diameter: {label: "Diameter in Km", range: int}
37
+ gravity: {label: "Gravitational pressure m/s squared"}
38
+ orbitalPeriod: {label: "Orbital period in days", range: integer}
39
+ population: {range: integer}
40
+ rotationPeriod: {label: "Rotation period in hours", range: integer}
41
+ surfaceWater: {label: "Surface water in m cubed", range: integer}
42
+ terrain: {label: "Planets terrain"}
43
+ climate: {label: "Planets climate"}
44
+
45
+ rbac:
46
+ roles:
47
+ Admin:
48
+ description: "Administrator role, can read, write and delete objects and schema"
49
+ actions: [
50
+ "*/*/*",
51
+ ]
@@ -0,0 +1,66 @@
1
+ id: /soml/swapi-species
2
+ label: Star Wars species API
3
+ creator: http://ontotext.com
4
+ created: 2019-06-15
5
+ updated: 2019-06-16
6
+ versionInfo: 0.1
7
+
8
+ prefixes:
9
+ # common prefixes
10
+ so: "http://www.ontotext.com/semantic-object/"
11
+ voc: "https://swapi.co/vocabulary/"
12
+ dct: "http://purl.org/dc/terms/"
13
+ gn: "http://www.geonames.org/ontology#"
14
+ owl: "http://www.w3.org/2002/07/owl#"
15
+ puml: "http://plantuml.com/ontology#"
16
+ rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ rdfs: "http://www.w3.org/2000/01/rdf-schema#"
18
+ skos: "http://www.w3.org/2004/02/skos/core#"
19
+ void: "http://rdfs.org/ns/void#"
20
+ wgs84: "http://www.w3.org/2003/01/geo/wgs84_pos#"
21
+ xsd: "http://www.w3.org/2001/XMLSchema#"
22
+
23
+ specialPrefixes:
24
+ base_iri: https://swapi.co/resource/
25
+ vocab_iri: https://swapi.co/vocabulary/
26
+ vocab_prefix: voc
27
+
28
+ objects:
29
+ Species:
30
+ descr: "A group of living organisms consisting of similar individuals capable of exchanging genes or interbreeding"
31
+ type: ["voc:Species"]
32
+ typeProp: "rdf:type"
33
+ name: "rdfs:label"
34
+ props:
35
+ desc: {label: "Description"}
36
+ averageLifespan: {descr: "Lifespan of the species"}
37
+ averageHeight: {descr: "Average height of the species", range: decimal}
38
+ language: {descr: "Species language"}
39
+ skinColor: {descr: "Species skin colour", max: inf}
40
+ hairColor: {descr: "Species hair colour", max: inf}
41
+ eyeColor: {descr: "Species eye colour", max: inf}
42
+ planet: {descr: "Planet which host the species", max: inf, range: Planet}
43
+
44
+ Planet:
45
+ descr: "The fictional universe of the Star Wars franchise features multiple planets and moons"
46
+ type: ["voc:Planet"]
47
+ typeProp: "rdf:type"
48
+ name: "rdfs:label"
49
+ props:
50
+ desc: {label: "Description"}
51
+ diameter: {label: "Diameter in Km", range: int}
52
+ gravity: {label: "Gravitational pressure m/s squared"}
53
+ orbitalPeriod: {label: "Orbital period in days", range: integer}
54
+ population: {range: integer}
55
+ rotationPeriod: {label: "Rotation period in hours", range: integer}
56
+ surfaceWater: {label: "Surface water in m cubed", range: integer}
57
+ terrain: {label: "Planets terrain"}
58
+ climate: {label: "Planets climate"}
59
+
60
+ rbac:
61
+ roles:
62
+ Admin:
63
+ description: "Administrator role, can read, write and delete objects and schema"
64
+ actions: [
65
+ "*/*/*",
66
+ ]
@@ -57,12 +57,13 @@ describe('Graphql: create endpoint', () => {
57
57
  // And endpoint params form should be empty
58
58
  CreateGraphqlEndpointSteps.getEndpointIdFieldInput().should('have.value', '');
59
59
  CreateGraphqlEndpointSteps.getEndpointLabelFieldInput().should('have.value', '');
60
- CreateGraphqlEndpointSteps.getVocabularyPrefixSelectSelectedOption().should('be.empty');
60
+ // And the vocabulary prefix select should have the placeholder option selected (it has no value, just label)
61
+ CreateGraphqlEndpointSteps.getVocabularyPrefixSelectSelectedOption().should('contain', 'Select prefix');
61
62
 
62
63
  // And Use all graphs option should be selected by default
63
64
  CreateGraphqlEndpointSteps.getSelectedGraphSource().parent().should('contain', 'Use all graphs');
64
65
  // And No graphs should be found
65
- CreateGraphqlEndpointSteps.getGraphsNotFound().should('be.visible');
66
+ CreateGraphqlEndpointSteps.getAllGraphsWillBeUsedMessage().should('be.visible');
66
67
 
67
68
  // When I switch to shacl shape graphs option
68
69
  CreateGraphqlEndpointSteps.selectUseShaclShapeGraphsOption();
@@ -175,12 +176,12 @@ describe('Graphql: create endpoint', () => {
175
176
 
176
177
  // When I fill in the endpoint params
177
178
  CreateGraphqlEndpointSteps.typeEndpointId('swapi-endpoint');
178
- // The next button should still be disabled because there are more required fields
179
- CreateGraphqlEndpointSteps.getNextStepButton().should('be.disabled');
179
+ // The next button should be enabled because the other fields are optional
180
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.enabled');
180
181
  // When I fill in the endpoint label which is optional
181
182
  CreateGraphqlEndpointSteps.typeEndpointLabel('Swapi endpoint');
182
- // The next button should still be disabled because there are more required fields
183
- CreateGraphqlEndpointSteps.getNextStepButton().should('be.disabled');
183
+ // The next button should be enabled
184
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.enabled');
184
185
  // When I select the vocabulary prefix
185
186
  CreateGraphqlEndpointSteps.selectVocabularyPrefix('voc');
186
187
  // Then the next button should be enabled
@@ -228,6 +229,31 @@ describe('Graphql: create endpoint', () => {
228
229
  CreateGraphqlEndpointSteps.getVocabularyPrefixSelectSelectedOption().should('have.text', 'voc');
229
230
  });
230
231
 
232
+ it('should be able to configure generation settings (the second step)', () => {
233
+ // Given I have a repository with graphql shapes in it
234
+ cy.importServerFile(repositoryId, 'ontology-and-shapes.ttl');
235
+ // And I started the endpoint creation wizard
236
+ GraphqlEndpointManagementSteps.visit();
237
+ cy.wait('@getRepositories');
238
+ GraphqlEndpointManagementSteps.createEndpoint();
239
+ CreateGraphqlEndpointSteps.getView().should('be.visible');
240
+ CreateGraphqlEndpointSteps.getSelectSchemaSourceView().should('be.visible');
241
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 2);
242
+ // When I select a graphql schema shape
243
+ CreateGraphqlEndpointSteps.selectGraphqlShape(1);
244
+ // Then I should be able to proceed to the next step
245
+ CreateGraphqlEndpointSteps.next();
246
+ CreateGraphqlEndpointSteps.getGenerationSettingsForm().should('be.visible');
247
+ // And the next button should be enabled because all settings fields are available and valid initially
248
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.enabled');
249
+ // When I click next
250
+ CreateGraphqlEndpointSteps.next();
251
+ // Then I should be on the generate endpoint step
252
+ CreateGraphqlEndpointSteps.getActiveStep().should('contain', 'Create');
253
+ CreateGraphqlEndpointSteps.getGenerateEndpointView().should('be.visible');
254
+
255
+ });
256
+
231
257
  it('should be able to cancel the endpoint creation wizard', () => {
232
258
  // Given I have a repository with no active GraphQL endpoints
233
259
  // When I visit the endpoint management view
@@ -0,0 +1,46 @@
1
+ import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
2
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
3
+ import {ApplicationSteps} from "../../steps/application-steps";
4
+
5
+ describe('Graphql: delete endpoint', () => {
6
+ let repositoryId;
7
+
8
+ beforeEach(() => {
9
+ repositoryId = 'graphql-endpoint-management-' + Date.now();
10
+ cy.createRepository({id: repositoryId});
11
+ cy.presetRepository(repositoryId);
12
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
13
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
14
+ });
15
+
16
+ afterEach(() => {
17
+ cy.deleteRepository(repositoryId);
18
+ });
19
+
20
+ it('should be able to delete graphql endpoint', () => {
21
+ // Given I have a repository with active GraphQL endpoint
22
+ // And I have visited the endpoint management view
23
+ GraphqlEndpointManagementSteps.visit();
24
+ GraphqlEndpointManagementSteps.getView().should('be.visible');
25
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
26
+ // When I click on the delete endpoint button
27
+ GraphqlEndpointManagementSteps.deleteEndpoint(0);
28
+ // Then I should see the confirmation dialog
29
+ ModalDialogSteps.getDialog().should('be.visible');
30
+ // When I reject the confirmation dialog
31
+ ModalDialogSteps.cancel();
32
+ // Then Confirmation dialog should be closed
33
+ ModalDialogSteps.getDialog().should('not.exist');
34
+ // And the endpoint should not be deleted
35
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
36
+
37
+ // When I click on the delete endpoint button again and confirm the deletion
38
+ GraphqlEndpointManagementSteps.deleteEndpoint(0);
39
+ ModalDialogSteps.confirm();
40
+ // Then I should see a success toast
41
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
42
+ // And the endpoint should be deleted and the no results row should be visible
43
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
44
+ GraphqlEndpointManagementSteps.getNoResultsRow().should('be.visible');
45
+ });
46
+ });
@@ -0,0 +1,137 @@
1
+ import {GraphqlStubs} from "../../stubs/graphql/graphql-stubs";
2
+ import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
3
+ import {EditGraphqlEndpointSteps} from "../../steps/graphql/edit-graphql-endpoint-steps";
4
+ import {ApplicationSteps} from "../../steps/application-steps";
5
+
6
+ describe('Graphql: edit endpoint settings', () => {
7
+ let repositoryId;
8
+
9
+ beforeEach(() => {
10
+ repositoryId = 'create-graphql-endpoint-' + Date.now();
11
+ cy.createRepository({id: repositoryId});
12
+ cy.presetRepository(repositoryId);
13
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
14
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
15
+ // Visit the endpoint management view
16
+ GraphqlEndpointManagementSteps.visit();
17
+ // Ensure the endpoints list is loaded
18
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length.at.least', 1);
19
+ });
20
+
21
+ afterEach(() => {
22
+ cy.deleteRepository(repositoryId);
23
+ });
24
+
25
+ it('should display and edit different types dynamic form fields', () => {
26
+ // GraphqlStubs.stubGetEndpointConfiguration(repositoryId, 'swapi', 'graphql-endpoint-configuration-types.json');
27
+ GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
28
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
29
+
30
+ EditGraphqlEndpointSteps.getInputField(3).should('have.value', 'ANY');
31
+ EditGraphqlEndpointSteps.fillInputField(3, 'NONE')
32
+
33
+ EditGraphqlEndpointSteps.getBooleanField(0).should('not.be.checked');
34
+ EditGraphqlEndpointSteps.toggleBooleanField(0);
35
+
36
+ // There is no select field in the data
37
+ // EditGraphqlEndpointSteps.getSelectField(0).should('have.value', 'Two');
38
+ // EditGraphqlEndpointSteps.selectOption(0, 'One');
39
+
40
+ // There is no multi select field in the data
41
+ // EditGraphqlEndpointSteps.verifyMultiSelectOptionSelected(0, 'Angular', 'JavaScript');
42
+ // EditGraphqlEndpointSteps.toggleMultiSelectOption(0, 'Angular');
43
+ // EditGraphqlEndpointSteps.verifyMultiSelectOptionSelected(0, 'JavaScript');
44
+
45
+ // There is no json field in the data
46
+ // EditGraphqlEndpointSteps.getJsonField(0).should('have.value', '{"foo": "bar"}');
47
+ // EditGraphqlEndpointSteps.clearJsonField(0);
48
+ });
49
+
50
+ it('should allow saving the configuration changes successfully', () => {
51
+ GraphqlStubs.spySaveEndpointConfiguration(repositoryId, 'swapi');
52
+ // Open the modal
53
+ GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
54
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
55
+
56
+ // Then the save button is disabled
57
+ EditGraphqlEndpointSteps.getOKButton().should('be.disabled');
58
+
59
+ // When I change some fields
60
+ EditGraphqlEndpointSteps.fillInputField(3, 'NONE');
61
+ EditGraphqlEndpointSteps.toggleBooleanField(0);
62
+
63
+ // Then the save button is enabled
64
+ EditGraphqlEndpointSteps.getOKButton().should('be.enabled');
65
+
66
+ // Submit the form
67
+ EditGraphqlEndpointSteps.clickOKButton();
68
+ EditGraphqlEndpointSteps.getSavingLoader().should('be.visible');
69
+ cy.wait('@save-endpoint-configuration').then((interception) => {
70
+ expect(interception.request.body).to.deep.equal({
71
+ "id": "swapi",
72
+ "label": "Ontotext Star Wars Ontology",
73
+ "description": "",
74
+ "active": true,
75
+ "default": true,
76
+ "options": {
77
+ "enableTypeCount": true,
78
+ "enableCollectionCount": false,
79
+ "compactErrorMessages": false,
80
+ "langFetch": null,
81
+ "langValidate": null,
82
+ "langImplicit": null,
83
+ "langDefaultNameFetch": "NONE",
84
+ "langAppendDefaultNameFetch": "true",
85
+ "includeInferred": true,
86
+ "expandOwlSameAs": true,
87
+ "enableMutations": null,
88
+ "defaultRole": "defaultRole",
89
+ "enableGraphQLExplain": true,
90
+ "exposeSomlInGraphQL": false,
91
+ "disabledChecks": null,
92
+ "defaultIntegrationRole": "Federation_SystemRole",
93
+ "queryPrefix": null,
94
+ "mutationPrefix": null
95
+ }
96
+ });
97
+ });
98
+
99
+ // Modal should close after successful save
100
+ EditGraphqlEndpointSteps.getDialog().should('not.exist');
101
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
102
+ });
103
+
104
+ it('should show an error message if saving configuration fails', () => {
105
+ // Force the stub for save configuration to fail
106
+ GraphqlStubs.stubSaveEndpointConfiguration(repositoryId, 'swapi', 1000, true);
107
+
108
+ // Open the modal
109
+ GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
110
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
111
+
112
+ // Fill in a field to allow form submission
113
+ EditGraphqlEndpointSteps.fillInputField(0, 'ANY');
114
+
115
+ // Submit the form
116
+ EditGraphqlEndpointSteps.clickOKButton();
117
+ EditGraphqlEndpointSteps.getSavingLoader().should('be.visible');
118
+
119
+ // I see a toast error
120
+ ApplicationSteps.getErrorNotifications().should('be.visible');
121
+
122
+ // The modal remains open after failure
123
+ EditGraphqlEndpointSteps.getSavingLoader().should('not.exist');
124
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
125
+ });
126
+
127
+ it('should close the modal when cancel is clicked', () => {
128
+ GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
129
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
130
+
131
+ // Click cancel
132
+ EditGraphqlEndpointSteps.cancel();
133
+
134
+ // Verify that the modal is dismissed
135
+ EditGraphqlEndpointSteps.getDialog().should('not.exist');
136
+ });
137
+ });