graphdb-workbench-tests 3.0.0-TR7 → 3.0.0-TR9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fixtures/graphql/soml/swapi-schema-planets.yaml +51 -0
- package/fixtures/graphql/soml/swapi-schema-species.yaml +66 -0
- package/fixtures/locale-en.json +101 -6
- package/fixtures/ttyg/agent/get-agent-list-autocomplete-query.json +23 -0
- package/fixtures/ttyg/autocomplete-response.json +154 -0
- package/integration/graphql/create-graphql-endpoint.spec.js +7 -6
- package/integration/graphql/edit-graphql-enpoint.spec.js +39 -103
- package/integration/graphql/graphql-endpoint-filtering.spec.js +12 -15
- package/integration/graphql/graphql-endpoint-management-view.spec.js +106 -99
- package/integration/graphql/graphql-playground.spec.js +68 -48
- package/integration/graphql/graphql-set-default-endpoint.spec.js +42 -0
- package/integration/sparql-editor/saved-query/readonly-query.spec.js +65 -0
- package/integration/ttyg/edit-agent.spec.js +45 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/steps/graphql/graphiql-editor-tools-steps.js +10 -0
- package/steps/graphql/graphiql-playground-steps.js +6 -0
- package/steps/graphql/graphql-endpoint-management-steps.js +10 -1
- package/steps/ttyg/ttyg-agent-settings-modal.steps.js +44 -0
- package/steps/yasgui/saved-queries-dialog.js +19 -3
- package/stubs/graphql/graphql-stubs.js +7 -3
- package/stubs/ttyg/ttyg-stubs.js +7 -0
|
@@ -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
|
-
|
|
14
|
-
|
|
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(
|
|
36
|
-
EditGraphqlEndpointSteps.fillInputField(
|
|
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
|
-
|
|
42
|
-
EditGraphqlEndpointSteps.
|
|
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
|
-
|
|
45
|
-
EditGraphqlEndpointSteps.
|
|
46
|
-
EditGraphqlEndpointSteps.
|
|
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
|
-
|
|
49
|
-
EditGraphqlEndpointSteps.
|
|
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.
|
|
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(
|
|
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,28 @@ 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
|
-
"
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
"
|
|
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
|
+
"options": {
|
|
72
|
+
"enableTypeCount": true,
|
|
73
|
+
"enableCollectionCount": false,
|
|
74
|
+
"compactErrorMessages": false,
|
|
75
|
+
"langFetch": null,
|
|
76
|
+
"langValidate": null,
|
|
77
|
+
"langImplicit": null,
|
|
78
|
+
"langDefaultNameFetch": "NONE",
|
|
79
|
+
"langAppendDefaultNameFetch": "true",
|
|
80
|
+
"includeInferred": true,
|
|
81
|
+
"expandOwlSameAs": true,
|
|
82
|
+
"enableMutations": null,
|
|
83
|
+
"defaultRole": "defaultRole",
|
|
84
|
+
"enableGraphQLExplain": true,
|
|
85
|
+
"exposeSomlInGraphQL": false,
|
|
86
|
+
"disabledChecks": null,
|
|
87
|
+
"defaultIntegrationRole": "Federation_SystemRole",
|
|
88
|
+
"queryPrefix": null,
|
|
89
|
+
"mutationPrefix": null
|
|
154
90
|
}
|
|
155
|
-
|
|
91
|
+
});
|
|
156
92
|
});
|
|
157
93
|
|
|
158
94
|
// Modal should close after successful save
|
|
@@ -183,7 +119,7 @@ describe('Graphql: edit endpoint settings', () => {
|
|
|
183
119
|
EditGraphqlEndpointSteps.getDialog().should('be.visible');
|
|
184
120
|
});
|
|
185
121
|
|
|
186
|
-
it
|
|
122
|
+
it('should close the modal when cancel is clicked', () => {
|
|
187
123
|
GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
|
|
188
124
|
EditGraphqlEndpointSteps.getDialog().should('be.visible');
|
|
189
125
|
|
|
@@ -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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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('
|
|
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: '
|
|
35
|
-
label: '
|
|
36
|
-
description: '
|
|
37
|
-
default:
|
|
31
|
+
id: 'swapi-planets',
|
|
32
|
+
label: 'Star Wars planets API',
|
|
33
|
+
description: '',
|
|
34
|
+
default: false,
|
|
38
35
|
active: true,
|
|
39
|
-
modified: '
|
|
40
|
-
types:
|
|
41
|
-
properties:
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
});
|