graphdb-workbench-tests 3.0.0-TR7 → 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,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
@@ -10,13 +10,8 @@ describe('Graphql: edit endpoint settings', () => {
10
10
  repositoryId = 'create-graphql-endpoint-' + Date.now();
11
11
  cy.createRepository({id: repositoryId});
12
12
  cy.presetRepository(repositoryId);
13
- // TODO: remove stubs and enable next imports when REST API is ready
14
- // cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
15
- // cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
16
- GraphqlStubs.stubGetEndpointsInfo(repositoryId);
17
- GraphqlStubs.stubGetEndpoints(repositoryId, 'graphql-swapi-endpoints.json');
18
- GraphqlStubs.stubGetEndpointConfiguration(repositoryId, 'swapi', undefined, 1000);
19
-
13
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
14
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
20
15
  // Visit the endpoint management view
21
16
  GraphqlEndpointManagementSteps.visit();
22
17
  // Ensure the endpoints list is loaded
@@ -28,29 +23,32 @@ describe('Graphql: edit endpoint settings', () => {
28
23
  });
29
24
 
30
25
  it('should display and edit different types dynamic form fields', () => {
31
- GraphqlStubs.stubGetEndpointConfiguration(repositoryId, 'swapi', 'graphql-endpoint-configuration-types.json');
26
+ // GraphqlStubs.stubGetEndpointConfiguration(repositoryId, 'swapi', 'graphql-endpoint-configuration-types.json');
32
27
  GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
33
28
  EditGraphqlEndpointSteps.getDialog().should('be.visible');
34
29
 
35
- EditGraphqlEndpointSteps.getInputField(0).should('have.value', 'strValue');
36
- EditGraphqlEndpointSteps.fillInputField(0, 'Foo')
30
+ EditGraphqlEndpointSteps.getInputField(3).should('have.value', 'ANY');
31
+ EditGraphqlEndpointSteps.fillInputField(3, 'NONE')
37
32
 
38
33
  EditGraphqlEndpointSteps.getBooleanField(0).should('not.be.checked');
39
34
  EditGraphqlEndpointSteps.toggleBooleanField(0);
40
35
 
41
- EditGraphqlEndpointSteps.getSelectField(0).should('have.value', 'Two');
42
- EditGraphqlEndpointSteps.selectOption(0, 'One');
36
+ // There is no select field in the data
37
+ // EditGraphqlEndpointSteps.getSelectField(0).should('have.value', 'Two');
38
+ // EditGraphqlEndpointSteps.selectOption(0, 'One');
43
39
 
44
- EditGraphqlEndpointSteps.verifyMultiSelectOptionSelected(0, 'Angular', 'JavaScript');
45
- EditGraphqlEndpointSteps.toggleMultiSelectOption(0, 'Angular');
46
- EditGraphqlEndpointSteps.verifyMultiSelectOptionSelected(0, 'JavaScript');
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');
47
44
 
48
- EditGraphqlEndpointSteps.getJsonField(0).should('have.value', '{"foo": "bar"}');
49
- EditGraphqlEndpointSteps.clearJsonField(0);
45
+ // There is no json field in the data
46
+ // EditGraphqlEndpointSteps.getJsonField(0).should('have.value', '{"foo": "bar"}');
47
+ // EditGraphqlEndpointSteps.clearJsonField(0);
50
48
  });
51
49
 
52
50
  it('should allow saving the configuration changes successfully', () => {
53
- GraphqlStubs.stubSaveEndpointConfiguration(repositoryId, 'swapi', 1000);
51
+ GraphqlStubs.spySaveEndpointConfiguration(repositoryId, 'swapi');
54
52
  // Open the modal
55
53
  GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
56
54
  EditGraphqlEndpointSteps.getDialog().should('be.visible');
@@ -59,10 +57,8 @@ describe('Graphql: edit endpoint settings', () => {
59
57
  EditGraphqlEndpointSteps.getOKButton().should('be.disabled');
60
58
 
61
59
  // When I change some fields
62
- EditGraphqlEndpointSteps.fillInputField(0, 'ANY');
63
- EditGraphqlEndpointSteps.fillInputField(2, 'bg');
60
+ EditGraphqlEndpointSteps.fillInputField(3, 'NONE');
64
61
  EditGraphqlEndpointSteps.toggleBooleanField(0);
65
- EditGraphqlEndpointSteps.toggleBooleanField(1);
66
62
 
67
63
  // Then the save button is enabled
68
64
  EditGraphqlEndpointSteps.getOKButton().should('be.enabled');
@@ -71,88 +67,33 @@ describe('Graphql: edit endpoint settings', () => {
71
67
  EditGraphqlEndpointSteps.clickOKButton();
72
68
  EditGraphqlEndpointSteps.getSavingLoader().should('be.visible');
73
69
  cy.wait('@save-endpoint-configuration').then((interception) => {
74
- expect(interception.request.body).to.deep.equal([
75
- {
76
- "key": "enable_mutations",
77
- "value": true
78
- },
79
- {
80
- "key": "lang.fetch",
81
- "value": "ANY"
82
- },
83
- {
84
- "key": "lang.validate",
85
- "value": "UNIQ"
86
- },
87
- {
88
- "key": "lang.implicit",
89
- "value": "bg"
90
- },
91
- {
92
- "key": "lang.defaultNameFetch",
93
- "value": "ANY"
94
- },
95
- {
96
- "key": "lang.appendDefaultNameFetch",
97
- "value": false
98
- },
99
- {
100
- "key": "queryPfx",
101
- "value": null
102
- },
103
- {
104
- "key": "mutationPfx",
105
- "value": null
106
- },
107
- {
108
- "key": "search",
109
- "value": null
110
- },
111
- {
112
- "key": "repository",
113
- "value": null
114
- },
115
- {
116
- "key": "includeInferred",
117
- "value": true
118
- },
119
- {
120
- "key": "expandOwlSameAs",
121
- "value": true
122
- },
123
- {
124
- "key": "disabledChecks",
125
- "value": []
126
- },
127
- {
128
- "key": "defaultRole",
129
- "value": "defaultRole"
130
- },
131
- {
132
- "key": "defaultIntegrationRole",
133
- "value": "Federation_SystemRole"
134
- },
135
- {
136
- "key": "exposeSomlInGraphQL",
137
- "value": false
138
- },
139
- {
140
- "key": "enableCollectionCount",
141
- "value": false
142
- },
143
- {
144
- "key": "enableTypeCount",
145
- "value": false
146
- },
147
- {
148
- "key": "compactErrorMessages",
149
- "value": false
150
- },
151
- {
152
- "key": "enableGraphQlExplain",
153
- "value": true
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
154
95
  }
155
- ]);
96
+ });
156
97
  });
157
98
 
158
99
  // Modal should close after successful save
@@ -183,7 +124,7 @@ describe('Graphql: edit endpoint settings', () => {
183
124
  EditGraphqlEndpointSteps.getDialog().should('be.visible');
184
125
  });
185
126
 
186
- it.only('should close the modal when cancel is clicked', () => {
127
+ it('should close the modal when cancel is clicked', () => {
187
128
  GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
188
129
  EditGraphqlEndpointSteps.getDialog().should('be.visible');
189
130
 
@@ -1,5 +1,4 @@
1
1
  import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
2
- import {GraphqlStubs} from "../../stubs/graphql/graphql-stubs";
3
2
 
4
3
  describe('GraphQL endpoints filtering', () => {
5
4
  let repositoryId;
@@ -8,11 +7,9 @@ describe('GraphQL endpoints filtering', () => {
8
7
  repositoryId = 'graphql-endpoint-filtering-' + Date.now();
9
8
  cy.createRepository({id: repositoryId});
10
9
  cy.presetRepository(repositoryId);
11
- // TODO: remove stubs and enable next imports when REST API is ready
12
- // cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
13
- // cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
14
- GraphqlStubs.stubGetEndpointsInfo(repositoryId);
15
- GraphqlStubs.stubGetEndpoints(repositoryId, 'graphql-swapi-endpoints.json');
10
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
11
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema-planets.yaml', 'swapi-planets');
12
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema-species.yaml', 'swapi-species');
16
13
  });
17
14
 
18
15
  afterEach(() => {
@@ -26,19 +23,19 @@ describe('GraphQL endpoints filtering', () => {
26
23
  // Then I should see all endpoints
27
24
  GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
28
25
  // When I filter the endpoints by the term "film"
29
- GraphqlEndpointManagementSteps.filterEndpoints('film');
26
+ GraphqlEndpointManagementSteps.filterEndpoints('planets');
30
27
  // Then I should see only one endpoint
31
28
  GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
32
29
  GraphqlEndpointManagementSteps.verifyEndpointInfo([
33
30
  {
34
- id: 'film-restricted',
35
- label: 'SWAPI GraphQL endpoint with restricted film relations',
36
- description: 'SWAPI GraphQL endpoint with restricted film relations description',
37
- default: true,
31
+ id: 'swapi-planets',
32
+ label: 'Star Wars planets API',
33
+ description: '',
34
+ default: false,
38
35
  active: true,
39
- modified: '2025-01-28',
40
- types: 13,
41
- properties: 133
36
+ modified: new Date().toISOString().split('T')[0],
37
+ types: 1,
38
+ properties: 10
42
39
  }
43
40
  ]);
44
41
  // When I clear the filter
@@ -47,7 +44,7 @@ describe('GraphQL endpoints filtering', () => {
47
44
  GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
48
45
  });
49
46
 
50
- it('should render no results banner when all endpoints are filtered', () => {
47
+ it.only('should render no results banner when all endpoints are filtered', () => {
51
48
  // Given I have a repository with active GraphQL endpoints
52
49
  // When I visit the endpoint management view
53
50
  GraphqlEndpointManagementSteps.visit();
@@ -10,37 +10,12 @@ describe('GraphQL endpoints management', () => {
10
10
  repositoryId = 'graphql-endpoint-management-' + Date.now();
11
11
  cy.createRepository({id: repositoryId});
12
12
  cy.presetRepository(repositoryId);
13
- // TODO: remove stubs and enable next imports when REST API is ready
14
- // cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
15
- // cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
16
- GraphqlStubs.stubGetEndpointsInfo(repositoryId);
17
- GraphqlStubs.stubGetEndpoints(repositoryId, 'graphql-swapi-endpoints.json');
18
13
  });
19
14
 
20
15
  afterEach(() => {
21
16
  cy.deleteRepository(repositoryId);
22
17
  });
23
18
 
24
- it('should render endpoint management view', () => {
25
- // Given I have a repository with active GraphQL endpoints
26
- // When I visit the endpoint management view
27
- GraphqlEndpointManagementSteps.visit();
28
- // Then I should see the endpoint management view
29
- GraphqlEndpointManagementSteps.getView().should('be.visible');
30
- // And I should see the page info tooltip
31
- // TODO: not ready yet
32
- // And I should see the documentation link
33
- // TODO: not ready yet
34
- // And I should see the endpoints filter field
35
- GraphqlEndpointManagementSteps.getEndpointFilterField().should('be.visible');
36
- // And I should see the create endpoint button
37
- GraphqlEndpointManagementSteps.getCreateEndpointButton().should('be.visible');
38
- // And I should see the import endpoint schema definition button
39
- GraphqlEndpointManagementSteps.getImportEndpointSchemaDefinitionButton().should('be.visible');
40
- // And I should see the endpoint list
41
- GraphqlEndpointManagementSteps.getEndpointTable().should('be.visible');
42
- });
43
-
44
19
  it('should render no results banner when no endpoints are found for the current repository', () => {
45
20
  // Given I have a repository with no active GraphQL endpoints
46
21
  GraphqlStubs.stubGetEndpointsInfo(repositoryId, 'no-graphql-endpoints-info.json');
@@ -50,82 +25,114 @@ describe('GraphQL endpoints management', () => {
50
25
  GraphqlEndpointManagementSteps.getNoEndpointsInRepositoryBanner().should('be.visible');
51
26
  });
52
27
 
53
- it('should render no results banner when endpoints are not loaded due to some error', () => {
54
- // Given I have a repository with active GraphQL endpoints
55
- // And the endpoints info cannot be loaded due to some error
56
- GraphqlStubs.stubGetEndpointsInfoError(repositoryId);
57
- // When I visit the endpoint management view
58
- GraphqlEndpointManagementSteps.visit();
59
- // Then I should see a toast with the error message
60
- ApplicationSteps.getErrorNotifications().should('be.visible');
61
- // Then I should see the no results banner
62
- GraphqlEndpointManagementSteps.getNoEndpointsInRepositoryBanner().should('be.visible');
63
- });
28
+ context('with endpoints', () => {
29
+ beforeEach(() => {
30
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
31
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
32
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema-planets.yaml', 'swapi-planets');
33
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema-species.yaml', 'swapi-species');
34
+ });
64
35
 
65
- it('should render endpoints info', () => {
66
- // Given I have a repository with active GraphQL endpoints
67
- // When I visit the endpoint management view
68
- GraphqlEndpointManagementSteps.visit();
69
- // Then I should see the endpoints info
70
- GraphqlEndpointManagementSteps.getEndpointTable().within(() => {
71
- cy.get('thead th').should('have.length', 9);
72
- cy.get('thead th').eq(1).should('contain', 'Id');
73
- cy.get('thead th').eq(2).should('contain', 'Label');
74
- cy.get('thead th').eq(3).should('contain', 'Default');
75
- cy.get('thead th').eq(4).should('contain', 'Active');
76
- cy.get('thead th').eq(5).should('contain', 'Modified');
77
- cy.get('thead th').eq(6).should('contain', 'Types');
78
- cy.get('thead th').eq(7).should('contain', 'Properties');
79
- cy.get('thead th').eq(8).should('contain', 'Actions');
36
+ it('should render endpoint management view', () => {
37
+ // Given I have a repository with active GraphQL endpoints
38
+ // When I visit the endpoint management view
39
+ GraphqlEndpointManagementSteps.visit();
40
+ // Then I should see the endpoint management view
41
+ GraphqlEndpointManagementSteps.getView().should('be.visible');
42
+ // And I should see the page info tooltip
43
+ // TODO: not ready yet
44
+ // And I should see the documentation link
45
+ // TODO: not ready yet
46
+ // And I should see the endpoints filter field
47
+ GraphqlEndpointManagementSteps.getEndpointFilterField().should('be.visible');
48
+ // And I should see the create endpoint button
49
+ GraphqlEndpointManagementSteps.getCreateEndpointButton().should('be.visible');
50
+ // And I should see the import endpoint schema definition button
51
+ GraphqlEndpointManagementSteps.getImportEndpointSchemaDefinitionButton().should('be.visible');
52
+ // And I should see the endpoint list
53
+ GraphqlEndpointManagementSteps.getEndpointTable().should('be.visible');
80
54
  });
81
- GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
82
- GraphqlEndpointManagementSteps.verifyEndpointInfo([
83
- {
84
- id: 'swapi',
85
- label: 'SWAPI GraphQL endpoint',
86
- description: 'SWAPI GraphQL endpoint description',
87
- default: false,
88
- active: true,
89
- modified: '2025-01-28',
90
- types: 10,
91
- properties: 120
92
- },
93
- {
94
- id: 'film-restricted',
95
- label: 'SWAPI GraphQL endpoint with restricted film relations',
96
- description: 'SWAPI GraphQL endpoint with restricted film relations description',
97
- default: true,
98
- active: true,
99
- modified: '2025-01-28',
100
- types: 13,
101
- properties: 133
102
- },
103
- {
104
- id: 'swapi-characters',
105
- label: 'SWAPI GraphQL endpoint for swapi characters',
106
- description: 'SWAPI GraphQL endpoint for swapi characters description',
107
- default: false,
108
- active: false,
109
- modified: '2025-01-28',
110
- types: 3,
111
- properties: 20
112
- }
113
- ]);
114
- });
115
55
 
116
- it('should be able to explore graphql endpoints which are active', () => {
117
- // Given I have a repository with active GraphQL endpoints
118
- // When I visit the endpoint management view
119
- GraphqlEndpointManagementSteps.visit();
120
- // Then I expect that inactive endpoints should not be clickable
121
- GraphqlEndpointManagementSteps.getEndpointLink(0).should('have.prop', 'tagName', 'A');
122
- GraphqlEndpointManagementSteps.getEndpointLink(1).should('have.prop', 'tagName', 'A');
123
- GraphqlEndpointManagementSteps.getEndpointLink(2).should('have.prop', 'tagName', 'SPAN');
124
- // And I click on some endpoint
125
- GraphqlEndpointManagementSteps.exploreEndpoint(1);
126
- // Then I should be redirected to the GraphQL playground view
127
- cy.url().should('include', '/graphql/playground');
128
- // And the selected endpoint should be the one I clicked
129
- GraphqlPlaygroundSteps.getSelectedEndpoint().should('contain', 'film-restricted');
56
+ it('should render no results banner when endpoints are not loaded due to some error', () => {
57
+ // Given I have a repository with active GraphQL endpoints
58
+ // And the endpoints info cannot be loaded due to some error
59
+ GraphqlStubs.stubGetEndpointsInfoError(repositoryId);
60
+ // When I visit the endpoint management view
61
+ GraphqlEndpointManagementSteps.visit();
62
+ // Then I should see a toast with the error message
63
+ ApplicationSteps.getErrorNotifications().should('be.visible');
64
+ // Then I should see the no results banner
65
+ GraphqlEndpointManagementSteps.getNoEndpointsInRepositoryBanner().should('be.visible');
66
+ });
67
+
68
+ it('should render endpoints info', () => {
69
+ // Given I have a repository with active GraphQL endpoints
70
+ // When I visit the endpoint management view
71
+ GraphqlEndpointManagementSteps.visit();
72
+ // Then I should see the endpoints info
73
+ GraphqlEndpointManagementSteps.getEndpointTable().within(() => {
74
+ cy.get('thead th').should('have.length', 9);
75
+ cy.get('thead th').eq(1).should('contain', 'Id');
76
+ cy.get('thead th').eq(2).should('contain', 'Label');
77
+ cy.get('thead th').eq(3).should('contain', 'Default');
78
+ cy.get('thead th').eq(4).should('contain', 'Active');
79
+ cy.get('thead th').eq(5).should('contain', 'Modified');
80
+ cy.get('thead th').eq(6).should('contain', 'Types');
81
+ cy.get('thead th').eq(7).should('contain', 'Properties');
82
+ cy.get('thead th').eq(8).should('contain', 'Actions');
83
+ });
84
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
85
+ GraphqlEndpointManagementSteps.verifyEndpointInfo([
86
+ {
87
+ id: 'swapi',
88
+ label: 'Ontotext Star Wars Ontology',
89
+ description: '',
90
+ default: true,
91
+ active: true,
92
+ modified: new Date().toISOString().split('T')[0],
93
+ types: 56,
94
+ properties: 68
95
+ },
96
+ {
97
+ id: 'swapi-planets',
98
+ label: 'Star Wars planets API',
99
+ description: '',
100
+ default: false,
101
+ active: true,
102
+ modified: new Date().toISOString().split('T')[0],
103
+ types: 1,
104
+ properties: 10
105
+ },
106
+ {
107
+ id: 'swapi-species',
108
+ label: 'Star Wars species API',
109
+ description: '',
110
+ default: false,
111
+ active: true,
112
+ modified: new Date().toISOString().split('T')[0],
113
+ types: 2,
114
+ properties: 17
115
+ }
116
+ ]);
117
+ });
118
+
119
+ it('should be able to explore graphql endpoints which are active', () => {
120
+ // Given I have a repository with active GraphQL endpoints
121
+ // When I visit the endpoint management view
122
+ GraphqlEndpointManagementSteps.visit();
123
+ // Then I expect that inactive endpoints should not be clickable
124
+ GraphqlEndpointManagementSteps.getEndpointLink(0).should('have.prop', 'tagName', 'A');
125
+ GraphqlEndpointManagementSteps.getEndpointLink(1).should('have.prop', 'tagName', 'A');
126
+ // This is supposed to test for a inactive endpoint, due to some error during generation for example,
127
+ // but we can't simulate it by uploading SOML schemas. We test this in other tests.
128
+ // GraphqlEndpointManagementSteps.getEndpointLink(2).should('have.prop', 'tagName', 'SPAN');
129
+ GraphqlEndpointManagementSteps.getEndpointLink(2).should('have.prop', 'tagName', 'A');
130
+ // And I click on some endpoint
131
+ GraphqlEndpointManagementSteps.exploreEndpoint(1);
132
+ // Then I should be redirected to the GraphQL playground view
133
+ cy.url().should('include', '/graphql/playground');
134
+ // And the selected endpoint should be the one I clicked
135
+ GraphqlPlaygroundSteps.getSelectedEndpoint().should('contain', 'swapi-planets');
136
+ });
130
137
  });
131
138
  });
@@ -1,5 +1,7 @@
1
1
  import {GraphqlPlaygroundSteps} from "../../steps/graphql/graphql-playground-steps";
2
- import {GraphqlStubs} from "../../stubs/graphql/graphql-stubs";
2
+ import {GraphiqlPlaygroundSteps} from "../../steps/graphql/graphiql-playground-steps";
3
+ import {GraphiQLEditorToolsSteps} from "../../steps/graphql/graphiql-editor-tools-steps";
4
+ import {LanguageSelectorSteps} from "../../steps/language-selector-steps";
3
5
 
4
6
  describe('GraphQL Playground', () => {
5
7
  let repositoryId;
@@ -22,53 +24,71 @@ describe('GraphQL Playground', () => {
22
24
  GraphqlPlaygroundSteps.getNoSchemasAlert().should('be.visible');
23
25
  });
24
26
 
25
- it('should load GraphQL Playground', () => {
26
- GraphqlStubs.stubGetEndpoints(repositoryId);
27
- GraphqlStubs.stubCountriesSchema();
28
- // Given I have opened the workbench
29
- // When I visit the GraphQL Playground page
30
- GraphqlPlaygroundSteps.visit();
31
- // Then I should see the graphql endpoints select menu
32
- GraphqlPlaygroundSteps.getEndpointsSelectMenu().should('be.visible');
33
- // And the endpoints menu should contain 2 options
34
- GraphqlPlaygroundSteps.getEndpointsSelectMenuOptions().should('have.length', 2);
35
- // Then I should see the GraphQL Playground component
36
- GraphqlPlaygroundSteps.getPlayground().should('exist').and('be.visible');
37
- });
27
+ context('with schemas', () => {
38
28
 
39
- it('should be able to change the endpoint', () => {
40
- GraphqlStubs.stubGetEndpoints(repositoryId);
41
- GraphqlStubs.stubCountriesSchema();
42
- // When I visit the GraphQL Playground page
43
- GraphqlPlaygroundSteps.visit();
44
- GraphqlPlaygroundSteps.getPlayground().should('exist').and('be.visible');
45
- // Then I should see the countries endpoint selected
46
- GraphqlPlaygroundSteps.getSelectedEndpoint().should('have.text', 'countries');
47
- // And I can execute a query on the countries endpoint
48
- GraphqlPlaygroundSteps.setInEditor(`
49
- query GetContinentById {
50
- continent(code: "EU") {
51
- name
52
- }
53
- }
54
- `);
55
- // And I execute the query
56
- GraphqlPlaygroundSteps.executeQuery();
57
- // Then I get expected result
58
- GraphqlPlaygroundSteps.getResponse().should('contain', '"name": "Europe"');
59
- // When I change the endpoint to countries
60
- GraphqlStubs.stubStubRickAndMortySchema();
61
- GraphqlPlaygroundSteps.selectEndpoint('rickmorty');
62
- GraphqlPlaygroundSteps.setInEditor(`
63
- query Character {
64
- character(id: "2") {
65
- name
66
- }
67
- }
68
- `);
69
- // And I execute the query
70
- GraphqlPlaygroundSteps.executeQuery();
71
- // Then I get expected result from the new endpoint
72
- GraphqlPlaygroundSteps.getResponse().should('contain', '"name": "Morty Smith"');
29
+ beforeEach(() => {
30
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
31
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
32
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema-planets.yaml', 'swapi-planets');
33
+ });
34
+
35
+ it('should load GraphQL Playground', () => {
36
+ // Given I have opened the workbench
37
+ // When I visit the GraphQL Playground page
38
+ GraphqlPlaygroundSteps.visit();
39
+ // Then I should see the graphql endpoints select menu
40
+ GraphqlPlaygroundSteps.getEndpointsSelectMenu().should('be.visible');
41
+ // And the endpoints menu should contain 2 options
42
+ GraphqlPlaygroundSteps.getEndpointsSelectMenuOptions().should('have.length', 2);
43
+ // Then I should see the GraphQL Playground component
44
+ GraphqlPlaygroundSteps.getPlayground().should('exist').and('be.visible');
45
+ });
46
+
47
+ it('should be able to change the endpoint', () => {
48
+ // When I visit the GraphQL Playground page
49
+ GraphqlPlaygroundSteps.visit();
50
+ GraphqlPlaygroundSteps.getPlayground().should('exist').and('be.visible');
51
+ // Then I should see the countries endpoint selected
52
+ GraphqlPlaygroundSteps.getSelectedEndpoint().should('have.text', 'swapi');
53
+ // And I can execute a query on the countries endpoint
54
+ GraphqlPlaygroundSteps.setInEditor(`
55
+ query StarshipById {
56
+ starship(ID: "https://swapi.co/resource/starship/9") {
57
+ name
58
+ }
59
+ }
60
+ `);
61
+ // And I execute the query
62
+ GraphqlPlaygroundSteps.executeQuery();
63
+ // Then I get expected result
64
+ GraphqlPlaygroundSteps.getResponse().should('contain', '"name": "Death Star"');
65
+ // When I change the endpoint to countries
66
+ // GraphqlStubs.stubStubRickAndMortySchema();
67
+ GraphqlPlaygroundSteps.selectEndpoint('swapi-planets');
68
+ GraphqlPlaygroundSteps.setInEditor(`
69
+ query PlanetById {
70
+ planet(ID: "https://swapi.co/resource/planet/1") {
71
+ name
72
+ }
73
+ }
74
+ `);
75
+ // And I execute the query
76
+ GraphqlPlaygroundSteps.executeQuery();
77
+ // Then I get expected result from the new endpoint
78
+ GraphqlPlaygroundSteps.getResponse().should('contain', '"name": "Tatooine"');
79
+ });
80
+
81
+ it('should be able to translate the labels', () => {
82
+ // Given: I have opened the workbench on the GraphQL Playground page.
83
+ GraphqlPlaygroundSteps.visit();
84
+ GraphiqlPlaygroundSteps.getPlayground().should('be.visible');
85
+ // the GraphQL is translated on english
86
+ GraphiQLEditorToolsSteps.getGraphiQLEditorTabButton(1).contains('Headers');
87
+
88
+ // When: I change the language.
89
+ LanguageSelectorSteps.changeLanguage('fr');
90
+ // Then: I expect to see GraphQL playground translated.
91
+ GraphiQLEditorToolsSteps.getGraphiQLEditorTabButton(1).contains('En-têtes');
92
+ });
73
93
  });
74
94
  });
@@ -0,0 +1,59 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
4
+ import {UserAndAccessSteps} from "../../../steps/setup/user-and-access-steps";
5
+ import {SavedQuery} from "../../../steps/yasgui/saved-query";
6
+ import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
7
+
8
+ const USER_NAME = 'saved_query_user';
9
+ const USER_ADMINISTRATOR = 'admin';
10
+ const PASSWORD = 'root';
11
+
12
+ describe('Readonly saved query', () => {
13
+
14
+ let repositoryId;
15
+
16
+ beforeEach(() => {
17
+ repositoryId = 'sparql-editor-' + Date.now();
18
+ QueryStubs.stubQueryCountResponse();
19
+ cy.createRepository({id: repositoryId});
20
+ cy.presetRepository(repositoryId);
21
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
22
+ cy.createUser({username: USER_NAME, password: PASSWORD});
23
+ UserAndAccessSteps.visit();
24
+ UserAndAccessSteps.toggleSecurity();
25
+ });
26
+
27
+ afterEach(() => {
28
+ UserAndAccessSteps.logout();
29
+ cy.deleteRepository(repositoryId);
30
+ UserAndAccessSteps.visit();
31
+ UserAndAccessSteps.loginWithUser(USER_ADMINISTRATOR, PASSWORD);
32
+ UserAndAccessSteps.toggleSecurity();
33
+ cy.deleteUser(USER_NAME);
34
+ });
35
+
36
+ it('Should not allow modifying a saved query if it is readonly', () => {
37
+ // Given: There is a public saved query created by a user.
38
+ UserAndAccessSteps.loginWithUser(USER_NAME, PASSWORD);
39
+ SparqlEditorSteps.visitSparqlEditorPage();
40
+ YasguiSteps.getYasgui().should('be.visible');
41
+ const savedQueryName = SavedQuery.generateQueryName();
42
+ SavedQuery.create(savedQueryName);
43
+ UserAndAccessSteps.logout();
44
+
45
+ // When: I log in with another user
46
+ UserAndAccessSteps.loginWithUser(USER_ADMINISTRATOR, PASSWORD);
47
+ // and open the popup with the saved query.
48
+ SparqlEditorSteps.visitSparqlEditorPage();
49
+ YasguiSteps.showSavedQueries();
50
+
51
+ // Then: I expect:
52
+ // 1. The delete button should not be visible because a saved query can only be deleted by the user who created it.
53
+ SavedQueriesDialog.getDeleteQueryButtonByName(savedQueryName).should('not.exist');
54
+ // 2. The edit button should not be visible because a saved query can only be edited by the user who created it.
55
+ SavedQueriesDialog.getEditQueryButtonByName(savedQueryName).should('not.exist');
56
+ // 3. The share button should be visible because a public saved query should be visible to all users.
57
+ SavedQueriesDialog.getShareQueryButtonByName(savedQueryName).should('exist');
58
+ });
59
+ });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.0.0-TR7",
3
+ "version": "3.0.0-TR8",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.0.0-TR7",
9
+ "version": "3.0.0-TR8",
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-TR7",
3
+ "version": "3.0.0-TR8",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
@@ -0,0 +1,10 @@
1
+ export class GraphiQLEditorToolsSteps {
2
+
3
+ static getGraphiQLEditorTools() {
4
+ return cy.get(".graphiql-editor-tools");
5
+ }
6
+
7
+ static getGraphiQLEditorTabButton(index) {
8
+ return GraphiQLEditorToolsSteps.getGraphiQLEditorTools().find('button').eq(index);
9
+ }
10
+ }
@@ -0,0 +1,6 @@
1
+ export class GraphiqlPlaygroundSteps {
2
+
3
+ static getPlayground() {
4
+ return cy.get('.graphiql-query-editor');
5
+ }
6
+ }
@@ -14,16 +14,32 @@ export class SavedQueriesDialog {
14
14
  static selectSavedQueryByName(name) {
15
15
  this.getSavedQueries().contains(name).click();
16
16
  }
17
+
18
+ static getQueryByName(name) {
19
+ return this.getSavedQueries().contains(name).realHover();
20
+ }
21
+
22
+ static getEditQueryButtonByName(name) {
23
+ return this.getQueryByName(name).closest('.saved-query').find('.edit-saved-query');
24
+ }
17
25
 
18
26
  static editQueryByName(name) {
19
- this.getSavedQueries().contains(name).realHover().closest('.saved-query').find('.edit-saved-query').click();
27
+ this.getEditQueryButtonByName(name).click();
28
+ }
29
+
30
+ static getDeleteQueryButtonByName(name) {
31
+ return this.getQueryByName(name).closest('.saved-query').find('.delete-saved-query');
20
32
  }
21
33
 
22
34
  static deleteQueryByName(name) {
23
- this.getSavedQueries().contains(name).realHover().closest('.saved-query').find('.delete-saved-query').click();
35
+ this.getDeleteQueryButtonByName(name).click();
36
+ }
37
+
38
+ static getShareQueryButtonByName(name) {
39
+ return this.getQueryByName(name).closest('.saved-query').find('.share-saved-query');
24
40
  }
25
41
 
26
42
  static shareQueryByName(name) {
27
- this.getSavedQueries().contains(name).realHover().closest('.saved-query').find('.share-saved-query').click();
43
+ this.getShareQueryButtonByName(name).click();
28
44
  }
29
45
  }
@@ -28,7 +28,7 @@ export class GraphqlStubs {
28
28
  }
29
29
 
30
30
  static stubGetEndpointsInfoError(repositoryId) {
31
- cy.intercept('GET', `/rest/repositories/${repositoryId}/manage/graphql/endpoints`, {
31
+ cy.intercept('GET', `/rest/repositories/${repositoryId}/graphql/manage/list`, {
32
32
  statusCode: 500,
33
33
  response: {
34
34
  error: "Required request parameter 'query' for method parameter type String is not present"
@@ -68,11 +68,15 @@ export class GraphqlStubs {
68
68
  }).as('get-endpoint-configuration');
69
69
  }
70
70
 
71
+ static spySaveEndpointConfiguration(repositoryId, endpoint) {
72
+ cy.intercept('POST', `/rest/repositories/${repositoryId}/graphql/manage/endpoints/${endpoint}`).as('save-endpoint-configuration');
73
+ }
74
+
71
75
  static stubSaveEndpointConfiguration(repositoryId, endpoint, delay = 0, shouldFail = false) {
72
- cy.intercept('PUT', `/rest/repositories//${repositoryId}/manage/graphql/${endpoint}/config`, {
76
+ cy.intercept('POST', `/rest/repositories/${repositoryId}/graphql/manage/endpoints/${endpoint}`, {
73
77
  statusCode: shouldFail ? 400 : 200,
74
78
  delay: delay
75
- }).as('save-endpoint-configuration');
79
+ }).as('save-endpoint-configuration-failed');
76
80
  }
77
81
  }
78
82