graphdb-workbench-tests 2.8.4 → 3.0.0-NEW-JENKINS-1
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/graph/rdf.txt +130 -0
- package/fixtures/graphdb-import/ontology-and-shapes.ttl +562 -0
- package/fixtures/graphdb-import/swapi-dataset.ttl +4393 -0
- package/fixtures/graphql/endpoints/graphql-endpoints-info.json +49 -0
- package/fixtures/graphql/endpoints/no-graphql-endpoints-info.json +3 -0
- package/fixtures/graphql/soml/big-swapi-schema-broken.yaml +83167 -0
- package/fixtures/graphql/soml/swapi-schema-broken.yaml +880 -0
- package/fixtures/graphql/soml/swapi-schema-broken.zip +0 -0
- package/fixtures/graphql/soml/swapi-schema-film-restricted.yaml +335 -0
- package/fixtures/graphql/soml/swapi-schema-planets.yaml +51 -0
- package/fixtures/graphql/soml/swapi-schema-species.yaml +66 -0
- package/fixtures/graphql/soml/swapi-schema.yaml +857 -0
- package/fixtures/graphql/soml/swapi-schemas.zip +0 -0
- package/fixtures/locale-en.json +666 -37
- package/fixtures/ttyg/agent/get-agent-list-autocomplete-query.json +23 -0
- package/fixtures/ttyg/autocomplete-response.json +154 -0
- package/integration/explore/class.hierarchy.spec.js +131 -184
- package/integration/explore/graphs.overview.spec.js +18 -10
- package/integration/explore/visual-graph/graphs-config.spec.js +17 -1
- package/integration/explore/visual-graph/visual-graph-node-labels.spec.js +68 -0
- package/integration/graphql/activate-deactivate-graphql-endpoint.spec.js +40 -0
- package/integration/graphql/create-graphql-endpoint.spec.js +281 -0
- package/integration/graphql/delete-graphql-endpoint.spec.js +46 -0
- package/integration/graphql/edit-graphql-enpoint.spec.js +160 -0
- package/integration/graphql/export-graphql-endpoint-definition.spec.js +35 -0
- package/integration/graphql/filter-graphql-endpoints-on-management-view.spec.js +66 -0
- package/integration/graphql/graphql-endpoint-management-view.spec.js +142 -0
- package/integration/graphql/graphql-playground.spec.js +110 -0
- package/integration/graphql/import-graphql-endpoint-definitions.spec.js +269 -0
- package/integration/graphql/set-default-graphql-endpoint.spec.js +42 -0
- package/integration/import/import-server-files-batch-operations.spec.js +4 -3
- package/integration/import/import-server-files.spec.js +29 -7
- package/integration/import/import-user-data-url.spec.js +33 -0
- package/integration/import/import-view.spec.js +2 -1
- package/integration/repository/repositories.spec.js +9 -4
- package/integration/setup/user-and-access.spec.js +695 -117
- package/integration/sparql-editor/actions/show-saved-queries.spec.js +1 -1
- package/integration/sparql-editor/saved-query/readonly-query.spec.js +66 -0
- package/integration/ttyg/edit-agent.spec.js +45 -0
- package/integration-flaky/setup/users-and-access/security-and-free-access.spec.js +54 -0
- package/{integration → integration-flaky}/ttyg/ttyg-permission.spec.js +4 -3
- package/npm-shrinkwrap.json +931 -305
- package/package.json +3 -3
- package/steps/class-views-steps.js +139 -0
- package/steps/explore/graphs-overview-steps.js +12 -0
- package/steps/graphql/create-graphql-endpoint-steps.js +277 -0
- package/steps/graphql/edit-graphql-endpoint-steps.js +124 -0
- package/steps/graphql/generation-report-modal-steps.js +34 -0
- 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 +147 -0
- package/steps/graphql/graphql-playground-steps.js +90 -0
- package/steps/graphql/import-endpoint-definition-modal-steps.js +80 -0
- package/steps/home-steps.js +1 -1
- package/steps/import/import-settings-dialog-steps.js +12 -0
- package/steps/import/import-steps.js +9 -4
- package/steps/import/import-test-constants.js +1 -0
- package/steps/import/import-user-data-steps.js +8 -0
- package/steps/login-steps.js +20 -0
- package/steps/modal-dialog-steps.js +8 -0
- package/steps/repository-steps.js +4 -0
- package/steps/setup/user-and-access-steps.js +165 -11
- package/steps/ttyg/ttyg-agent-settings-modal.steps.js +44 -0
- package/steps/visual-graph-steps.js +14 -0
- package/steps/yasgui/saved-queries-dialog.js +19 -3
- package/stubs/global-operations-statuses-stub.js +2 -2
- package/stubs/graphql/graphql-stubs.js +146 -0
- package/stubs/repositories/repositories-stubs.js +4 -0
- package/stubs/ttyg/ttyg-stubs.js +7 -0
- package/stubs/yasgui/query-stubs.js +2 -2
- package/support/import-commands.js +28 -0
- package/support/repository-commands.js +10 -3
- package/support/security-command.js +49 -8
- package/support/user-commands.js +10 -2
- package/utils/html-util.js +21 -0
- /package/fixtures/{graphql-editor → queries}/default-query-response.json +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
|
|
2
|
+
import {GraphqlStubs} from "../../stubs/graphql/graphql-stubs";
|
|
3
|
+
|
|
4
|
+
describe('Graphql: export endpoint definition', () => {
|
|
5
|
+
let repositoryId;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
repositoryId = 'graphql-endpoint-management-' + Date.now();
|
|
9
|
+
cy.createRepository({id: repositoryId});
|
|
10
|
+
cy.presetRepository(repositoryId);
|
|
11
|
+
cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
|
|
12
|
+
cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema-planets.yaml', 'swapi-planets');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
cy.deleteRepository(repositoryId);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should be able to export endpoint definition', () => {
|
|
20
|
+
GraphqlStubs.spyExportEndpointDefinition(repositoryId, 'swapi-planets');
|
|
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', 2);
|
|
26
|
+
|
|
27
|
+
// When I click on the export button
|
|
28
|
+
GraphqlEndpointManagementSteps.exportEndpointDefinition(1);
|
|
29
|
+
// Then I expect the endpoint definition to be exported
|
|
30
|
+
cy.wait('@export-endpoint-definition').then((interception) => {
|
|
31
|
+
expect(interception.response.statusCode).to.eq(200);
|
|
32
|
+
cy.readFile('cypress/downloads/swapi-planets.yaml');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
|
|
2
|
+
|
|
3
|
+
describe('GraphQL endpoints filtering', () => {
|
|
4
|
+
let repositoryId;
|
|
5
|
+
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
repositoryId = 'graphql-endpoint-filtering-' + Date.now();
|
|
8
|
+
cy.createRepository({id: repositoryId});
|
|
9
|
+
cy.presetRepository(repositoryId);
|
|
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');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
cy.deleteRepository(repositoryId);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should be able to filter endpoints', () => {
|
|
20
|
+
// Given I have a repository with active GraphQL endpoints
|
|
21
|
+
// When I visit the endpoint management view
|
|
22
|
+
GraphqlEndpointManagementSteps.visit();
|
|
23
|
+
// Then I should see all endpoints
|
|
24
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
|
|
25
|
+
// When I filter the endpoints by the term "film"
|
|
26
|
+
GraphqlEndpointManagementSteps.filterEndpoints('planets');
|
|
27
|
+
// Then I should see only one endpoint
|
|
28
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
|
|
29
|
+
GraphqlEndpointManagementSteps.verifyEndpointInfo([
|
|
30
|
+
{
|
|
31
|
+
id: 'swapi-planets',
|
|
32
|
+
label: 'Star Wars planets API',
|
|
33
|
+
description: '',
|
|
34
|
+
default: false,
|
|
35
|
+
active: true,
|
|
36
|
+
modified: new Date().toISOString().split('T')[0],
|
|
37
|
+
types: 1,
|
|
38
|
+
properties: 10
|
|
39
|
+
}
|
|
40
|
+
]);
|
|
41
|
+
// When I clear the filter
|
|
42
|
+
GraphqlEndpointManagementSteps.clearFilter();
|
|
43
|
+
// Then I should see all endpoints
|
|
44
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it.only('should render no results banner when all endpoints are filtered', () => {
|
|
48
|
+
// Given I have a repository with active GraphQL endpoints
|
|
49
|
+
// When I visit the endpoint management view
|
|
50
|
+
GraphqlEndpointManagementSteps.visit();
|
|
51
|
+
// Then I should see all endpoints
|
|
52
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
|
|
53
|
+
// And the no results banner should not be visible
|
|
54
|
+
GraphqlEndpointManagementSteps.getNoResultsInTableBanner().should('not.exist');
|
|
55
|
+
// When I filter the endpoints by the term "starship"
|
|
56
|
+
GraphqlEndpointManagementSteps.filterEndpoints('starship');
|
|
57
|
+
// Then I should see the no results banner
|
|
58
|
+
GraphqlEndpointManagementSteps.getNoResultsInTableBanner().should('be.visible');
|
|
59
|
+
// When I clear the filter
|
|
60
|
+
GraphqlEndpointManagementSteps.clearFilter();
|
|
61
|
+
// Then I should see all endpoints
|
|
62
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
|
|
63
|
+
// And the no results banner should not be visible
|
|
64
|
+
GraphqlEndpointManagementSteps.getNoResultsInTableBanner().should('not.exist');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
|
|
2
|
+
import {GraphqlStubs} from "../../stubs/graphql/graphql-stubs";
|
|
3
|
+
import {GraphqlPlaygroundSteps} from "../../steps/graphql/graphql-playground-steps";
|
|
4
|
+
import {ApplicationSteps} from "../../steps/application-steps";
|
|
5
|
+
|
|
6
|
+
describe('GraphQL endpoints management', () => {
|
|
7
|
+
let repositoryId;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
repositoryId = 'graphql-endpoint-management-' + Date.now();
|
|
11
|
+
cy.createRepository({id: repositoryId});
|
|
12
|
+
cy.presetRepository(repositoryId);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
cy.deleteRepository(repositoryId);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should render no results banner when no endpoints are found for the current repository', () => {
|
|
20
|
+
// Given I have a repository with no active GraphQL endpoints
|
|
21
|
+
GraphqlStubs.stubGetEndpointsInfo(repositoryId, 'no-graphql-endpoints-info.json');
|
|
22
|
+
// When I visit the endpoint management view
|
|
23
|
+
GraphqlEndpointManagementSteps.visit();
|
|
24
|
+
// Then I should see the no results banner
|
|
25
|
+
GraphqlEndpointManagementSteps.getNoEndpointsInRepositoryBanner().should('be.visible');
|
|
26
|
+
});
|
|
27
|
+
|
|
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
|
+
});
|
|
35
|
+
|
|
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');
|
|
54
|
+
});
|
|
55
|
+
|
|
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', 10);
|
|
75
|
+
// the first column contains the status icon
|
|
76
|
+
cy.get('thead th').eq(2).should('contain', 'Id');
|
|
77
|
+
cy.get('thead th').eq(3).should('contain', 'Label');
|
|
78
|
+
cy.get('thead th').eq(4).should('contain', 'Default');
|
|
79
|
+
cy.get('thead th').eq(5).should('contain', 'Active');
|
|
80
|
+
cy.get('thead th').eq(6).should('contain', 'Modified');
|
|
81
|
+
cy.get('thead th').eq(7).should('contain', 'Types');
|
|
82
|
+
cy.get('thead th').eq(8).should('contain', 'Properties');
|
|
83
|
+
cy.get('thead th').eq(9).should('contain', 'Actions');
|
|
84
|
+
});
|
|
85
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
|
|
86
|
+
GraphqlEndpointManagementSteps.verifyEndpointInfo([
|
|
87
|
+
{
|
|
88
|
+
status: 'deleted',
|
|
89
|
+
id: 'swapi',
|
|
90
|
+
label: 'Ontotext Star Wars Ontology',
|
|
91
|
+
description: '',
|
|
92
|
+
default: true,
|
|
93
|
+
active: true,
|
|
94
|
+
modified: new Date().toISOString().split('T')[0],
|
|
95
|
+
types: 56,
|
|
96
|
+
properties: 68
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
status: 'deleted',
|
|
100
|
+
id: 'swapi-planets',
|
|
101
|
+
label: 'Star Wars planets API',
|
|
102
|
+
description: '',
|
|
103
|
+
default: false,
|
|
104
|
+
active: true,
|
|
105
|
+
modified: new Date().toISOString().split('T')[0],
|
|
106
|
+
types: 1,
|
|
107
|
+
properties: 10
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
status: 'deleted',
|
|
111
|
+
id: 'swapi-species',
|
|
112
|
+
label: 'Star Wars species API',
|
|
113
|
+
description: '',
|
|
114
|
+
default: false,
|
|
115
|
+
active: true,
|
|
116
|
+
modified: new Date().toISOString().split('T')[0],
|
|
117
|
+
types: 2,
|
|
118
|
+
properties: 17
|
|
119
|
+
}
|
|
120
|
+
]);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should be able to explore graphql endpoints which are active', () => {
|
|
124
|
+
// Given I have a repository with active GraphQL endpoints
|
|
125
|
+
// When I visit the endpoint management view
|
|
126
|
+
GraphqlEndpointManagementSteps.visit();
|
|
127
|
+
// Then I expect that inactive endpoints should not be clickable
|
|
128
|
+
GraphqlEndpointManagementSteps.getEndpointLink(0).should('have.prop', 'tagName', 'A');
|
|
129
|
+
GraphqlEndpointManagementSteps.getEndpointLink(1).should('have.prop', 'tagName', 'A');
|
|
130
|
+
// This is supposed to test for a inactive endpoint, due to some error during generation for example,
|
|
131
|
+
// but we can't simulate it by uploading SOML schemas. We test this in other tests.
|
|
132
|
+
// GraphqlEndpointManagementSteps.getEndpointLink(2).should('have.prop', 'tagName', 'SPAN');
|
|
133
|
+
GraphqlEndpointManagementSteps.getEndpointLink(2).should('have.prop', 'tagName', 'A');
|
|
134
|
+
// And I click on some endpoint
|
|
135
|
+
GraphqlEndpointManagementSteps.exploreEndpoint(1);
|
|
136
|
+
// Then I should be redirected to the GraphQL playground view
|
|
137
|
+
cy.url().should('include', '/graphql/playground');
|
|
138
|
+
// And the selected endpoint should be the one I clicked
|
|
139
|
+
GraphqlPlaygroundSteps.getSelectedEndpoint().should('contain', 'swapi-planets');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {GraphqlPlaygroundSteps} from "../../steps/graphql/graphql-playground-steps";
|
|
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";
|
|
5
|
+
|
|
6
|
+
describe('GraphQL Playground', () => {
|
|
7
|
+
let repositoryId;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
repositoryId = 'graphql-playground-' + Date.now();
|
|
11
|
+
cy.createRepository({id: repositoryId});
|
|
12
|
+
cy.presetRepository(repositoryId);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
cy.deleteRepository(repositoryId);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should render the no schemas alert when current repository does not contain graphql schemas', () => {
|
|
20
|
+
// Given I have opened the workbench on the GraphQL Playground page
|
|
21
|
+
GraphqlPlaygroundSteps.visit();
|
|
22
|
+
// When there are no GraphQL schemas in the current repository
|
|
23
|
+
// Then I should see the no schemas alert
|
|
24
|
+
GraphqlPlaygroundSteps.getNoSchemasAlert().should('be.visible');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
context('with schemas', () => {
|
|
28
|
+
|
|
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
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should set default query', () => {
|
|
95
|
+
// Given: I have opened the workbench on the GraphQL Playground page.
|
|
96
|
+
GraphqlPlaygroundSteps.visit();
|
|
97
|
+
GraphiqlPlaygroundSteps.getPlayground().should('be.visible');
|
|
98
|
+
|
|
99
|
+
// Then: I expect the default query to be set in the GraphQL query editor.
|
|
100
|
+
GraphqlPlaygroundSteps.getEditorContent().should('equal', 'query Object {\n object(limit: 100) {\n id\n }\n}');
|
|
101
|
+
|
|
102
|
+
// When: I open a new tab.
|
|
103
|
+
GraphqlPlaygroundSteps.addTab();
|
|
104
|
+
GraphqlPlaygroundSteps.getTabs().should('have.length', 2);
|
|
105
|
+
|
|
106
|
+
// Then: I expect the default query to be set in the GraphAL query editor for the newly opened tab.
|
|
107
|
+
GraphqlPlaygroundSteps.getEditorContent().should('equal', 'query Object {\n object(limit: 100) {\n id\n }\n}');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
|
|
2
|
+
import {ImportEndpointDefinitionModalSteps} from "../../steps/graphql/import-endpoint-definition-modal-steps";
|
|
3
|
+
import {GenerationReportModalSteps} from "../../steps/graphql/generation-report-modal-steps";
|
|
4
|
+
|
|
5
|
+
describe('Graphql: import endpoint definitions', () => {
|
|
6
|
+
let repositoryId;
|
|
7
|
+
const swapiDefinitionPath = 'graphql/soml/swapi-schema.yaml';
|
|
8
|
+
const swapiPlanetsDefinitionPath = 'graphql/soml/swapi-schema-planets.yaml';
|
|
9
|
+
const swapiSpeciesDefinitionPath = 'graphql/soml/swapi-schema-species.yaml';
|
|
10
|
+
const brokenSwapiDefinitionPath = 'graphql/soml/swapi-schema-broken.yaml';
|
|
11
|
+
const swapiDefinitionZipPath = 'graphql/soml/swapi-schemas.zip';
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
repositoryId = 'graphql-endpoint-management-' + Date.now();
|
|
15
|
+
cy.createRepository({id: repositoryId});
|
|
16
|
+
cy.presetRepository(repositoryId);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
cy.deleteRepository(repositoryId);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should be able to open the import definition modal', () => {
|
|
24
|
+
visitAndOpenImportModal();
|
|
25
|
+
ImportEndpointDefinitionModalSteps.getUploadButton().should('be.visible').and('be.disabled');
|
|
26
|
+
// When I close the modal
|
|
27
|
+
ImportEndpointDefinitionModalSteps.close();
|
|
28
|
+
// Then the modal should be closed and no endpoints should be visible
|
|
29
|
+
ImportEndpointDefinitionModalSteps.getDialog().should('not.exist');
|
|
30
|
+
GraphqlEndpointManagementSteps.getNoEndpointsInRepositoryBanner().should('be.visible');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should be able to import an endpoint definition', () => {
|
|
34
|
+
visitAndOpenImportModal();
|
|
35
|
+
// When I select the file to upload
|
|
36
|
+
ImportEndpointDefinitionModalSteps.selectFile(swapiDefinitionPath);
|
|
37
|
+
// Then the upload button should be enabled
|
|
38
|
+
ImportEndpointDefinitionModalSteps.getUploadButton().should('be.enabled');
|
|
39
|
+
// And I should see the selected file in the modal
|
|
40
|
+
ImportEndpointDefinitionModalSteps.getSelectedFiles().should('have.length', 1);
|
|
41
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileName(0).should('contain', 'swapi-schema.yaml');
|
|
42
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileSize(0).should('contain', '23.4 kB');
|
|
43
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('contain', 'Pending');
|
|
44
|
+
// And I should see the remove selected file button
|
|
45
|
+
ImportEndpointDefinitionModalSteps.getRemoveSelectedFileButton(0).should('be.visible').and('be.enabled');
|
|
46
|
+
// When I remove the selected file
|
|
47
|
+
ImportEndpointDefinitionModalSteps.removeSelectedFile(0);
|
|
48
|
+
// Then the selected file should be removed
|
|
49
|
+
ImportEndpointDefinitionModalSteps.getSelectedFiles().should('have.length', 0);
|
|
50
|
+
// And the upload button should be disabled
|
|
51
|
+
ImportEndpointDefinitionModalSteps.getUploadButton().should('be.disabled');
|
|
52
|
+
// When I select the file to upload again
|
|
53
|
+
ImportEndpointDefinitionModalSteps.selectFile(swapiDefinitionPath);
|
|
54
|
+
ImportEndpointDefinitionModalSteps.getUploadButton().should('be.enabled');
|
|
55
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileName(0).should('contain', 'swapi-schema.yaml');
|
|
56
|
+
|
|
57
|
+
// When I click the upload button
|
|
58
|
+
ImportEndpointDefinitionModalSteps.upload();
|
|
59
|
+
// Then I should see the import progress
|
|
60
|
+
// TODO: This check makes the test flaky, because the progress bar might disappear before the check
|
|
61
|
+
// ImportEndpointDefinitionModalSteps.getProgressBar().should('be.visible');
|
|
62
|
+
// And I should see the import status for the imported definition file
|
|
63
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('contain', 'Created');
|
|
64
|
+
// And I should see the generated endpoint link
|
|
65
|
+
ImportEndpointDefinitionModalSteps.getGeneratedEndpointLink(0).should('be.visible');
|
|
66
|
+
|
|
67
|
+
// When I close the modal
|
|
68
|
+
ImportEndpointDefinitionModalSteps.close();
|
|
69
|
+
// Then the modal should be closed and the endpoint should be visible
|
|
70
|
+
ImportEndpointDefinitionModalSteps.getDialog().should('not.exist');
|
|
71
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
|
|
72
|
+
|
|
73
|
+
GraphqlEndpointManagementSteps.verifyEndpointInfo([
|
|
74
|
+
{
|
|
75
|
+
status: 'deleted',
|
|
76
|
+
id: 'swapi',
|
|
77
|
+
label: 'Ontotext Star Wars Ontology',
|
|
78
|
+
description: '',
|
|
79
|
+
default: true,
|
|
80
|
+
active: true,
|
|
81
|
+
modified: new Date().toISOString().split('T')[0],
|
|
82
|
+
types: 56,
|
|
83
|
+
properties: 68
|
|
84
|
+
}
|
|
85
|
+
]);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should be able to import broken endpoint definition', () => {
|
|
89
|
+
visitAndOpenImportModal();
|
|
90
|
+
// When I select the file to upload
|
|
91
|
+
ImportEndpointDefinitionModalSteps.selectFile(brokenSwapiDefinitionPath);
|
|
92
|
+
// And I should see the selected file in the modal
|
|
93
|
+
ImportEndpointDefinitionModalSteps.getSelectedFiles().should('have.length', 1);
|
|
94
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileName(0).should('contain', 'swapi-schema-broken.yaml');
|
|
95
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('contain', 'Pending');
|
|
96
|
+
// When I click the upload button
|
|
97
|
+
ImportEndpointDefinitionModalSteps.upload();
|
|
98
|
+
// Then I should see the import progress
|
|
99
|
+
// TODO: This check makes the test flaky, because the progress bar might disappear before the check
|
|
100
|
+
// ImportEndpointDefinitionModalSteps.getProgressBar().should('be.visible');
|
|
101
|
+
// And I should see the import status for the imported definition file
|
|
102
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('contain', 'Failed');
|
|
103
|
+
// And I should see the generated endpoint link
|
|
104
|
+
ImportEndpointDefinitionModalSteps.getGeneratedEndpointLink(0).should('not.exist');
|
|
105
|
+
// And I should see the generation report link
|
|
106
|
+
ImportEndpointDefinitionModalSteps.getReportLink(0).should('be.visible');
|
|
107
|
+
|
|
108
|
+
// When I click the report link
|
|
109
|
+
ImportEndpointDefinitionModalSteps.openReport(0);
|
|
110
|
+
// Then I should see the report modal
|
|
111
|
+
GenerationReportModalSteps.getDialog().should('be.visible');
|
|
112
|
+
// And I should see the report content
|
|
113
|
+
GenerationReportModalSteps.getDialogBody().should('be.visible');
|
|
114
|
+
GenerationReportModalSteps.getErrorsCount().should('contain', '1');
|
|
115
|
+
GenerationReportModalSteps.getWarningsCount().should('contain', '0');
|
|
116
|
+
GenerationReportModalSteps.getErrors().should('have.length', 1);
|
|
117
|
+
GenerationReportModalSteps.closeChildModal();
|
|
118
|
+
// Then the report modal should be closed
|
|
119
|
+
GenerationReportModalSteps.getDialog().should('not.exist');
|
|
120
|
+
|
|
121
|
+
// When I close the modal
|
|
122
|
+
ImportEndpointDefinitionModalSteps.close();
|
|
123
|
+
// Then the modal should be closed and no endpoints should be visible
|
|
124
|
+
ImportEndpointDefinitionModalSteps.getDialog().should('not.exist');
|
|
125
|
+
// And no endpoints should be visible
|
|
126
|
+
GraphqlEndpointManagementSteps.getNoEndpointsInRepositoryBanner().should('be.visible');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should be able to import multiple definitions at once', () => {
|
|
130
|
+
visitAndOpenImportModal();
|
|
131
|
+
// When I select the file to upload
|
|
132
|
+
ImportEndpointDefinitionModalSteps.selectFile([swapiDefinitionPath, swapiPlanetsDefinitionPath]);
|
|
133
|
+
// And I should see the selected files in the modal
|
|
134
|
+
ImportEndpointDefinitionModalSteps.getSelectedFiles().should('have.length', 2);
|
|
135
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileName(0).should('contain', 'swapi-schema.yaml');
|
|
136
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('contain', 'Pending');
|
|
137
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileName(1).should('contain', 'swapi-schema-planets.yaml');
|
|
138
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(1).should('contain', 'Pending');
|
|
139
|
+
// When I click the upload button
|
|
140
|
+
ImportEndpointDefinitionModalSteps.upload();
|
|
141
|
+
// Then I should see the import progress
|
|
142
|
+
// TODO: This check makes the test flaky, because the progress bar might disappear before the check
|
|
143
|
+
// ImportEndpointDefinitionModalSteps.getProgressBar().should('be.visible');
|
|
144
|
+
// And I should see the import status for the imported definition files
|
|
145
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('contain', 'Created');
|
|
146
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(1).should('contain', 'Created');
|
|
147
|
+
|
|
148
|
+
// And I can remove a file from the list of selected files and already imported files
|
|
149
|
+
ImportEndpointDefinitionModalSteps.removeSelectedFile(0);
|
|
150
|
+
ImportEndpointDefinitionModalSteps.getSelectedFiles().should('have.length', 1);
|
|
151
|
+
// And I should be able to add a new file to the list of selected files
|
|
152
|
+
ImportEndpointDefinitionModalSteps.selectFile([swapiSpeciesDefinitionPath]);
|
|
153
|
+
ImportEndpointDefinitionModalSteps.getSelectedFiles().should('have.length', 2);
|
|
154
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileName(0).should('contain', 'swapi-schema-planets.yaml');
|
|
155
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileName(1).should('contain', 'swapi-schema-species.yaml');
|
|
156
|
+
// When I click the upload button
|
|
157
|
+
ImportEndpointDefinitionModalSteps.upload();
|
|
158
|
+
// Then All files in the list should be imported
|
|
159
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('contain', 'Created');
|
|
160
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(1).should('contain', 'Created');
|
|
161
|
+
|
|
162
|
+
// When I close the modal
|
|
163
|
+
ImportEndpointDefinitionModalSteps.close();
|
|
164
|
+
// Then the modal should be closed and the endpoints should be visible
|
|
165
|
+
ImportEndpointDefinitionModalSteps.getDialog().should('not.exist');
|
|
166
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
|
|
167
|
+
GraphqlEndpointManagementSteps.verifyEndpointInfo([
|
|
168
|
+
{
|
|
169
|
+
status: 'deleted',
|
|
170
|
+
id: 'swapi',
|
|
171
|
+
label: 'Ontotext Star Wars Ontology',
|
|
172
|
+
description: '',
|
|
173
|
+
default: true,
|
|
174
|
+
active: true,
|
|
175
|
+
modified: new Date().toISOString().split('T')[0],
|
|
176
|
+
types: 56,
|
|
177
|
+
properties: 68
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
status: 'deleted',
|
|
181
|
+
id: 'swapi-planets',
|
|
182
|
+
label: 'Star Wars planets API',
|
|
183
|
+
description: '',
|
|
184
|
+
default: false,
|
|
185
|
+
active: true,
|
|
186
|
+
modified: new Date().toISOString().split('T')[0],
|
|
187
|
+
types: 1,
|
|
188
|
+
properties: 10
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
status: 'deleted',
|
|
192
|
+
id: 'swapi-species',
|
|
193
|
+
label: 'Star Wars species API',
|
|
194
|
+
description: '',
|
|
195
|
+
default: false,
|
|
196
|
+
active: true,
|
|
197
|
+
modified: new Date().toISOString().split('T')[0],
|
|
198
|
+
types: 2,
|
|
199
|
+
properties: 17
|
|
200
|
+
}
|
|
201
|
+
]);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('should be able to upload definitions in zip archive', () => {
|
|
205
|
+
visitAndOpenImportModal();
|
|
206
|
+
// When I select the zip file to upload
|
|
207
|
+
ImportEndpointDefinitionModalSteps.selectFile(swapiDefinitionZipPath);
|
|
208
|
+
// And I should see the selected file in the modal
|
|
209
|
+
ImportEndpointDefinitionModalSteps.getSelectedFiles().should('have.length', 1);
|
|
210
|
+
ImportEndpointDefinitionModalSteps.getSelectedFileName(0).should('contain', 'swapi-schemas.zip');
|
|
211
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('contain', 'Pending');
|
|
212
|
+
// When I click the upload button
|
|
213
|
+
ImportEndpointDefinitionModalSteps.upload();
|
|
214
|
+
// Then I should see the import progress
|
|
215
|
+
// TODO: This check makes the test flaky, because the progress bar might disappear before the check
|
|
216
|
+
// ImportEndpointDefinitionModalSteps.getProgressBar().should('be.visible');
|
|
217
|
+
|
|
218
|
+
// And I should see the import status for the imported definition files
|
|
219
|
+
// The status for the zip file should not be displayed, because we care only about the files inside it
|
|
220
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(0).should('not.exist');
|
|
221
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(1).should('contain', 'Failed');
|
|
222
|
+
ImportEndpointDefinitionModalSteps.getReportLink(1).should('be.visible');
|
|
223
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(2).should('contain', 'Created');
|
|
224
|
+
ImportEndpointDefinitionModalSteps.getGeneratedEndpointLink(2).should('be.visible');
|
|
225
|
+
ImportEndpointDefinitionModalSteps.getImportStatus(3).should('contain', 'Created');
|
|
226
|
+
ImportEndpointDefinitionModalSteps.getGeneratedEndpointLink(3).should('be.visible');
|
|
227
|
+
|
|
228
|
+
// When I close the modal
|
|
229
|
+
ImportEndpointDefinitionModalSteps.close();
|
|
230
|
+
// Then the modal should be closed and the endpoint should be visible
|
|
231
|
+
ImportEndpointDefinitionModalSteps.getDialog().should('not.exist');
|
|
232
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 2);
|
|
233
|
+
GraphqlEndpointManagementSteps.verifyEndpointInfo([
|
|
234
|
+
{
|
|
235
|
+
status: 'deleted',
|
|
236
|
+
id: 'swapi-planets',
|
|
237
|
+
label: 'Star Wars planets API',
|
|
238
|
+
description: '',
|
|
239
|
+
default: true,
|
|
240
|
+
active: true,
|
|
241
|
+
modified: new Date().toISOString().split('T')[0],
|
|
242
|
+
types: 1,
|
|
243
|
+
properties: 10
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
status: 'deleted',
|
|
247
|
+
id: 'swapi-species',
|
|
248
|
+
label: 'Star Wars species API',
|
|
249
|
+
description: '',
|
|
250
|
+
default: false,
|
|
251
|
+
active: true,
|
|
252
|
+
modified: new Date().toISOString().split('T')[0],
|
|
253
|
+
types: 2,
|
|
254
|
+
properties: 17
|
|
255
|
+
}
|
|
256
|
+
]);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
function visitAndOpenImportModal() {
|
|
261
|
+
// Given I have a repository without GraphQL endpoints
|
|
262
|
+
// And I have visited the endpoint management view
|
|
263
|
+
GraphqlEndpointManagementSteps.visit();
|
|
264
|
+
GraphqlEndpointManagementSteps.getNoEndpointsInRepositoryBanner().should('be.visible');
|
|
265
|
+
// When I open the import modal
|
|
266
|
+
GraphqlEndpointManagementSteps.openImportModal();
|
|
267
|
+
ImportEndpointDefinitionModalSteps.getDialog().should('be.visible');
|
|
268
|
+
ImportEndpointDefinitionModalSteps.getFileselectorButton().should('be.visible').and('be.enabled');
|
|
269
|
+
}
|