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.
Files changed (76) hide show
  1. package/fixtures/graph/rdf.txt +130 -0
  2. package/fixtures/graphdb-import/ontology-and-shapes.ttl +562 -0
  3. package/fixtures/graphdb-import/swapi-dataset.ttl +4393 -0
  4. package/fixtures/graphql/endpoints/graphql-endpoints-info.json +49 -0
  5. package/fixtures/graphql/endpoints/no-graphql-endpoints-info.json +3 -0
  6. package/fixtures/graphql/soml/big-swapi-schema-broken.yaml +83167 -0
  7. package/fixtures/graphql/soml/swapi-schema-broken.yaml +880 -0
  8. package/fixtures/graphql/soml/swapi-schema-broken.zip +0 -0
  9. package/fixtures/graphql/soml/swapi-schema-film-restricted.yaml +335 -0
  10. package/fixtures/graphql/soml/swapi-schema-planets.yaml +51 -0
  11. package/fixtures/graphql/soml/swapi-schema-species.yaml +66 -0
  12. package/fixtures/graphql/soml/swapi-schema.yaml +857 -0
  13. package/fixtures/graphql/soml/swapi-schemas.zip +0 -0
  14. package/fixtures/locale-en.json +666 -37
  15. package/fixtures/ttyg/agent/get-agent-list-autocomplete-query.json +23 -0
  16. package/fixtures/ttyg/autocomplete-response.json +154 -0
  17. package/integration/explore/class.hierarchy.spec.js +131 -184
  18. package/integration/explore/graphs.overview.spec.js +18 -10
  19. package/integration/explore/visual-graph/graphs-config.spec.js +17 -1
  20. package/integration/explore/visual-graph/visual-graph-node-labels.spec.js +68 -0
  21. package/integration/graphql/activate-deactivate-graphql-endpoint.spec.js +40 -0
  22. package/integration/graphql/create-graphql-endpoint.spec.js +281 -0
  23. package/integration/graphql/delete-graphql-endpoint.spec.js +46 -0
  24. package/integration/graphql/edit-graphql-enpoint.spec.js +160 -0
  25. package/integration/graphql/export-graphql-endpoint-definition.spec.js +35 -0
  26. package/integration/graphql/filter-graphql-endpoints-on-management-view.spec.js +66 -0
  27. package/integration/graphql/graphql-endpoint-management-view.spec.js +142 -0
  28. package/integration/graphql/graphql-playground.spec.js +110 -0
  29. package/integration/graphql/import-graphql-endpoint-definitions.spec.js +269 -0
  30. package/integration/graphql/set-default-graphql-endpoint.spec.js +42 -0
  31. package/integration/import/import-server-files-batch-operations.spec.js +4 -3
  32. package/integration/import/import-server-files.spec.js +29 -7
  33. package/integration/import/import-user-data-url.spec.js +33 -0
  34. package/integration/import/import-view.spec.js +2 -1
  35. package/integration/repository/repositories.spec.js +9 -4
  36. package/integration/setup/user-and-access.spec.js +695 -117
  37. package/integration/sparql-editor/actions/show-saved-queries.spec.js +1 -1
  38. package/integration/sparql-editor/saved-query/readonly-query.spec.js +66 -0
  39. package/integration/ttyg/edit-agent.spec.js +45 -0
  40. package/integration-flaky/setup/users-and-access/security-and-free-access.spec.js +54 -0
  41. package/{integration → integration-flaky}/ttyg/ttyg-permission.spec.js +4 -3
  42. package/npm-shrinkwrap.json +931 -305
  43. package/package.json +3 -3
  44. package/steps/class-views-steps.js +139 -0
  45. package/steps/explore/graphs-overview-steps.js +12 -0
  46. package/steps/graphql/create-graphql-endpoint-steps.js +277 -0
  47. package/steps/graphql/edit-graphql-endpoint-steps.js +124 -0
  48. package/steps/graphql/generation-report-modal-steps.js +34 -0
  49. package/steps/graphql/graphiql-editor-tools-steps.js +10 -0
  50. package/steps/graphql/graphiql-playground-steps.js +6 -0
  51. package/steps/graphql/graphql-endpoint-management-steps.js +147 -0
  52. package/steps/graphql/graphql-playground-steps.js +90 -0
  53. package/steps/graphql/import-endpoint-definition-modal-steps.js +80 -0
  54. package/steps/home-steps.js +1 -1
  55. package/steps/import/import-settings-dialog-steps.js +12 -0
  56. package/steps/import/import-steps.js +9 -4
  57. package/steps/import/import-test-constants.js +1 -0
  58. package/steps/import/import-user-data-steps.js +8 -0
  59. package/steps/login-steps.js +20 -0
  60. package/steps/modal-dialog-steps.js +8 -0
  61. package/steps/repository-steps.js +4 -0
  62. package/steps/setup/user-and-access-steps.js +165 -11
  63. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +44 -0
  64. package/steps/visual-graph-steps.js +14 -0
  65. package/steps/yasgui/saved-queries-dialog.js +19 -3
  66. package/stubs/global-operations-statuses-stub.js +2 -2
  67. package/stubs/graphql/graphql-stubs.js +146 -0
  68. package/stubs/repositories/repositories-stubs.js +4 -0
  69. package/stubs/ttyg/ttyg-stubs.js +7 -0
  70. package/stubs/yasgui/query-stubs.js +2 -2
  71. package/support/import-commands.js +28 -0
  72. package/support/repository-commands.js +10 -3
  73. package/support/security-command.js +49 -8
  74. package/support/user-commands.js +10 -2
  75. package/utils/html-util.js +21 -0
  76. /package/fixtures/{graphql-editor → queries}/default-query-response.json +0 -0
@@ -12,7 +12,7 @@ const QUERY_EXPAND_NODE = `# Note that ?node is the node you clicked and must be
12
12
  describe('Graphs config', () => {
13
13
 
14
14
  let repositoryId = 'graphRepo' + Date.now();
15
- let graphConfigName = 'graph-config';
15
+ let graphConfigName = 'graph-config' + Date.now();
16
16
 
17
17
  before(() => {
18
18
  cy.clearLocalStorage('ls.graphs-viz');
@@ -28,6 +28,7 @@ describe('Graphs config', () => {
28
28
  });
29
29
 
30
30
  beforeEach(() => {
31
+ cy.viewport(1280, 1000);
31
32
  cy.presetRepository(repositoryId);
32
33
  });
33
34
 
@@ -385,6 +386,16 @@ describe('Graphs config', () => {
385
386
  saveGraphConfig(graphConfigName);
386
387
  // And I open it for edit
387
388
  VisualGraphSteps.editConfig(graphConfigName);
389
+ // The next check ensures that the page is initialized and ready for interaction.
390
+ //
391
+ // Without this step, Cypress clicks on the second tab too quickly,
392
+ // before the model is fully populated.
393
+ //
394
+ // There is a validation when a tab is clicked. If it is clicked too soon, the validation fails with "Please provide start graph query."
395
+ // This prevents navigation to the second page, causing the test to fail when checking if the second tab is active.
396
+ //
397
+ // Without this check, the test fails randomly.
398
+ checkEditorWithQuery(QUERY_START);
388
399
  // And I open the expand query wizard tab
389
400
  VisualGraphSteps.openConfigWizardTab(2);
390
401
  VisualGraphSteps.getConfigWizardTab(2).should('be.visible').and('have.class', 'active');
@@ -403,6 +414,11 @@ describe('Graphs config', () => {
403
414
  MainMenuSteps.clickOnMenuImport();
404
415
  // Then I expect a confirmation for leaving the page
405
416
  ModalDialogSteps.getDialog().should('be.visible');
417
+ // Confirm page exit.
418
+ // If not,the test fails randomly with the following error:
419
+ // "[Intervention] Blocked attempt to show a 'beforeunload' confirmation panel for a frame
420
+ // that never had a user gesture since its load. https://www.chromestatus.com/feature/5082396709879808 "
421
+ ModalDialogSteps.clickOnConfirmButton();
406
422
  });
407
423
 
408
424
  it('Should be able to delete existing graph config', () => {
@@ -0,0 +1,68 @@
1
+ import { LicenseStubs } from "../../../stubs/license-stubs";
2
+ import { VisualGraphSteps } from "../../../steps/visual-graph-steps";
3
+ import { HtmlUtil } from "../../../utils/html-util";
4
+
5
+ /**
6
+ * RDF snippet with the necessary data to test all possible label scenarios:
7
+ * 1. (ex:node1) Node with a plain text label;
8
+ * 2. (ex:node2) Node with an HTML label;
9
+ * 3. (ex:node3) Node with a label that contains a new line ("\n") character;
10
+ * 4. (ex:node4) Node with a long label.
11
+ *
12
+ * @type {string}
13
+ */
14
+ const RDF_SNIPPETS_WITH_NODE_LABELS_DATA =
15
+ '@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n' +
16
+ '@prefix ex: <http://example.com/> .\n' +
17
+ '\n' +
18
+ '# Define Nodes with Labels\n' +
19
+ 'ex:node1 rdfs:label "Node One" .\n' +
20
+ 'ex:node2 rdfs:label "Node<br>Two" .\n' +
21
+ 'ex:node3 rdfs:label "Node\\nThree" .\n' +
22
+ 'ex:node4 rdfs:label "A longer label for Node Four" .\n' +
23
+ '\n' +
24
+ '# Relationships Between Nodes\n' +
25
+ 'ex:node1 ex:connectedTo ex:node2 .\n' +
26
+ 'ex:node1 ex:connectedTo ex:node3 .\n' +
27
+ 'ex:node1 ex:connectedTo ex:node4 .\n';
28
+
29
+ describe("Node Basics", () => {
30
+
31
+ let repositoryId;
32
+
33
+ beforeEach(() => {
34
+ cy.clearLocalStorage('ls.graphs-viz');
35
+ repositoryId = 'graphRepo-node-labels-' + Date.now();
36
+ cy.createRepository({ id: repositoryId });
37
+ cy.presetRepository(repositoryId);
38
+ // cy.importServerFile(repositoryId, FILE_WITH_NODE_LABELS_DATA);
39
+ cy.importRDFTextSnippet(repositoryId, RDF_SNIPPETS_WITH_NODE_LABELS_DATA);
40
+ LicenseStubs.spyGetLicense();
41
+ });
42
+
43
+ afterEach(() => {
44
+ cy.clearLocalStorage('ls.graphs-viz');
45
+ cy.deleteRepository(repositoryId);
46
+ });
47
+
48
+ it('should allow the node label to be displayed on multiple lines only when a new line character is used', () => {
49
+ // When: I open a visual graph of a node that has links to other nodes.
50
+ VisualGraphSteps.openNodeLabelGraph();
51
+
52
+ // Then: I expect:
53
+ // The label of ex:node1 to be displayed as is, because it is short plain text.
54
+ VisualGraphSteps.getNodeLabel('http://example.com/node1').should('have.html', 'Node One');
55
+
56
+ // The label of ex:node2 to be displayed with all HTML tags removed.
57
+ VisualGraphSteps.getNodeLabel('http://example.com/node2').should('have.html', 'NodeTwo');
58
+
59
+ // The label of ex:node3 to be displayed with the new line character replaced by a <br> tag.
60
+ VisualGraphSteps.getNodeLabel('http://example.com/node3').should('have.html', 'Node<br>Three');
61
+
62
+ // The label of ex:node4 to be displayed with a long label (no truncation).
63
+ VisualGraphSteps.getNodeLabel('http://example.com/node4').should('have.html', 'A longer label for Node Four');
64
+
65
+ // The label of ex:node4 should be truncated with ellipsis because it has a long label.
66
+ HtmlUtil.verifyEllipsis(VisualGraphSteps.getNodeLabel('http://example.com/node4'));
67
+ });
68
+ });
@@ -0,0 +1,40 @@
1
+ import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
2
+ import {ApplicationSteps} from "../../steps/application-steps";
3
+
4
+ describe('GraphQL: activate and deactivate endpoint', () => {
5
+ let repositoryId;
6
+
7
+ beforeEach(() => {
8
+ repositoryId = 'graphql-endpoint-management-' + Date.now();
9
+ cy.createRepository({id: repositoryId});
10
+ cy.presetRepository(repositoryId);
11
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
12
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
13
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema-planets.yaml', 'swapi-planets');
14
+ });
15
+
16
+ afterEach(() => {
17
+ cy.deleteRepository(repositoryId);
18
+ });
19
+
20
+ it('should be able to activate or deactivate an endpoint', () => {
21
+ // Given I have a repository with active GraphQL endpoints
22
+ // When I visit the endpoint management view
23
+ GraphqlEndpointManagementSteps.visit();
24
+ // And I have an active endpoint
25
+ GraphqlEndpointManagementSteps.getEndpointActiveStateToggleCheckbox(0).should('be.checked');
26
+ // When I deactivate the endpoint
27
+ GraphqlEndpointManagementSteps.toggleEndpointActiveState(0);
28
+ // Then I should see a toast with the success message
29
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
30
+ // And the endpoint should be deactivated
31
+ GraphqlEndpointManagementSteps.getEndpointActiveStateToggleCheckbox(0).should('not.be.checked');
32
+
33
+ // When I activate the endpoint
34
+ GraphqlEndpointManagementSteps.toggleEndpointActiveState(0);
35
+ // Then I should see a toast with the success message
36
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
37
+ // And the endpoint should be activated
38
+ GraphqlEndpointManagementSteps.getEndpointActiveStateToggleCheckbox(0).should('be.checked');
39
+ });
40
+ });
@@ -0,0 +1,281 @@
1
+ import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
2
+ import {GraphqlStubs} from "../../stubs/graphql/graphql-stubs";
3
+ import {CreateGraphqlEndpointSteps} from "../../steps/graphql/create-graphql-endpoint-steps";
4
+ import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
5
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
6
+
7
+ describe('Graphql: create endpoint', () => {
8
+ let repositoryId;
9
+
10
+ beforeEach(() => {
11
+ repositoryId = 'create-graphql-endpoint-' + Date.now();
12
+ cy.createRepository({id: repositoryId});
13
+ cy.presetRepository(repositoryId);
14
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
15
+ RepositoriesStubs.spyGetRepositories();
16
+ });
17
+
18
+ afterEach(() => {
19
+ cy.deleteRepository(repositoryId);
20
+ });
21
+
22
+ it('should be able to start graphql endpoint creation wizard - no source data', () => {
23
+ // Given I have a repository with no active GraphQL endpoints
24
+ // When I visit the endpoint management view
25
+ GraphqlEndpointManagementSteps.visit();
26
+ cy.wait('@getRepositories');
27
+ // Then I should see no endpoints
28
+ GraphqlEndpointManagementSteps.getEndpointTable().should('not.exist');
29
+ // When I click on the create endpoint button
30
+ GraphqlEndpointManagementSteps.createEndpoint();
31
+ // Then I should see the create endpoint wizard
32
+ CreateGraphqlEndpointSteps.getView().should('be.visible');
33
+ cy.url().should('include', '/graphql/endpoint/create');
34
+ CreateGraphqlEndpointSteps.getSourceRepositorySelector().should('be.visible');
35
+ // And the source repository should be preselected to the active repository
36
+ CreateGraphqlEndpointSteps.getSelectedSourceRepository().should('have.text', repositoryId);
37
+
38
+ // And the active step should be the first step
39
+ CreateGraphqlEndpointSteps.getActiveStep().should('contain', 'Select schema source');
40
+ CreateGraphqlEndpointSteps.getSelectSchemaSourceView().should('be.visible');
41
+ // And the schema source should be preselected to the first option
42
+ CreateGraphqlEndpointSteps.getSchemaSourceTypes().should('have.length', 2);
43
+ CreateGraphqlEndpointSteps.getSelectedSchemaSource().parent().should('contain', 'GraphQL schema shapes');
44
+ // And there must be no graphql schema shapes in the source repository
45
+ CreateGraphqlEndpointSteps.getGraphqlSchemaShapesNotFound().should('be.visible');
46
+
47
+ // When I switch to the second schema source option
48
+ CreateGraphqlEndpointSteps.selectOntologiesAndShaclShapesOption();
49
+ // Then I expect the schema source to be switched to ontologies and SHACL shapes
50
+ CreateGraphqlEndpointSteps.getOntologiesAndShaclShapesView().should('be.visible');
51
+ CreateGraphqlEndpointSteps.getEndpointParamsForm().should('be.visible');
52
+ // And endpoint params form should be empty
53
+ CreateGraphqlEndpointSteps.getEndpointIdFieldInput().should('have.value', '');
54
+ CreateGraphqlEndpointSteps.getEndpointLabelFieldInput().should('have.value', '');
55
+ // And the vocabulary prefix select should have the placeholder option selected (it has no value, just label)
56
+ CreateGraphqlEndpointSteps.getVocabularyPrefixSelectSelectedOption().should('contain', 'Select prefix');
57
+
58
+ // And Use all graphs option should be selected by default
59
+ CreateGraphqlEndpointSteps.getSelectedGraphSource().parent().should('contain', 'Use all graphs');
60
+ // And No graphs should be found
61
+ CreateGraphqlEndpointSteps.getAllGraphsWillBeUsedMessage().should('be.visible');
62
+
63
+ // When I switch to shacl shape graphs option
64
+ CreateGraphqlEndpointSteps.selectUseShaclShapeGraphsOption();
65
+ CreateGraphqlEndpointSteps.getShaclShapeGraphsNotFound().should('be.visible');
66
+
67
+ // When I switch to pick graphs option
68
+ CreateGraphqlEndpointSteps.selectPickGraphsOption();
69
+ CreateGraphqlEndpointSteps.getPickGraphsNoGraphsFound().should('be.visible');
70
+
71
+ // And the next button should be disabled
72
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.disabled');
73
+ });
74
+
75
+ it('should be able to select graphql schema shapes and open next step', () => {
76
+ // Given I have a repository with graphql shapes in it
77
+ cy.importServerFile(repositoryId, 'ontology-and-shapes.ttl');
78
+ // When I start the endpoint creation wizard
79
+ GraphqlEndpointManagementSteps.visit();
80
+ cy.wait('@getRepositories');
81
+ GraphqlEndpointManagementSteps.createEndpoint();
82
+ CreateGraphqlEndpointSteps.getView().should('be.visible');
83
+ CreateGraphqlEndpointSteps.getSelectedSourceRepository().should('have.text', repositoryId);
84
+ // Then the select schema source view is visible
85
+ CreateGraphqlEndpointSteps.getActiveStep().should('contain', 'Select schema source');
86
+ CreateGraphqlEndpointSteps.getSelectSchemaSourceView().should('be.visible');
87
+ // And the graphql schema selector is visible
88
+ CreateGraphqlEndpointSteps.getGraphqlSchemaSelector().should('be.visible');
89
+ // And the graphql schema shapes are found
90
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 2);
91
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapes().should('have.length', 0);
92
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapesCountBanner().should('not.exist');
93
+ // And I can select or deselect the graphql shapes
94
+ CreateGraphqlEndpointSteps.selectAllGraphqlShapes();
95
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 0);
96
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapes().should('have.length', 2);
97
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapesCountBanner().should('contain', '2 GraphQL schema shapes included');
98
+ // And the next button should be enabled because I have selected the shapes
99
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.enabled');
100
+
101
+ CreateGraphqlEndpointSteps.deselectAllGraphqlShapes();
102
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 2);
103
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapes().should('have.length', 0);
104
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapesCountBanner().should('not.exist');
105
+ // And the next button should be disabled because I have not selected any shapes
106
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.disabled');
107
+
108
+ CreateGraphqlEndpointSteps.selectGraphqlShape(0);
109
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 1);
110
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShape(0).should('contain', 'Swapi GraphQL Schema');
111
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapes().should('have.length', 1);
112
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShape(0).should('contain', 'Character GraphQL Schema');
113
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapesCountBanner().should('contain', '1 GraphQL schema shapes included');
114
+ CreateGraphqlEndpointSteps.deselectAllGraphqlShape(0);
115
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 2);
116
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapes().should('have.length', 0);
117
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapesCountBanner().should('not.exist');
118
+
119
+ // And I can filter the graphql shapes
120
+ CreateGraphqlEndpointSteps.filterSelectedGraphqlShapes('swapi');
121
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 1);
122
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShape(0).should('contain', 'Swapi GraphQL Schema');
123
+ CreateGraphqlEndpointSteps.filterSelectedGraphqlShapes('non-existing');
124
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 0);
125
+ CreateGraphqlEndpointSteps.clearSelectedGraphqlShapesFilter();
126
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 2);
127
+
128
+ // When I select a graphql shacl shape
129
+ CreateGraphqlEndpointSteps.selectGraphqlShape(1);
130
+ // And I proceed to the next step
131
+ CreateGraphqlEndpointSteps.next();
132
+ // Then I should be on the next step
133
+ CreateGraphqlEndpointSteps.getActiveStep().should('contain', 'Configure endpoint');
134
+ CreateGraphqlEndpointSteps.getConfigureEndpointView().should('be.visible');
135
+ // And I should see the cancel button
136
+ CreateGraphqlEndpointSteps.getCancelButton().should('be.visible');
137
+ // And I should see the back button
138
+ CreateGraphqlEndpointSteps.getBackButton().should('be.visible');
139
+
140
+ // When I click on the back button
141
+ CreateGraphqlEndpointSteps.back();
142
+ // Then I should be back on the previous step
143
+ CreateGraphqlEndpointSteps.getActiveStep().should('contain', 'Select schema source');
144
+ // And the graphql schema shapes should be selected as before
145
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 1);
146
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShape(0).should('contain', 'Character GraphQL Schema');
147
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShapes().should('have.length', 1);
148
+ CreateGraphqlEndpointSteps.getSelectedGraphqlShape(0).should('contain', 'Swapi GraphQL Schema');
149
+ });
150
+
151
+ it('should be able to select graphs and endpoint properties and open next step', () => {
152
+ // Given I have a repository with graphql shapes in it
153
+ cy.importServerFile(repositoryId, 'ontology-and-shapes.ttl');
154
+ // When we upload a SOML schema, two graphs are created, and we can use this to test the behavior for graphs selection
155
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
156
+ // When I start the endpoint creation wizard
157
+ GraphqlEndpointManagementSteps.visit();
158
+ cy.wait('@getRepositories');
159
+ GraphqlEndpointManagementSteps.createEndpoint();
160
+ CreateGraphqlEndpointSteps.getView().should('be.visible');
161
+ CreateGraphqlEndpointSteps.getSelectedSourceRepository().should('have.text', repositoryId);
162
+
163
+ // When I switch to the second schema source option
164
+ CreateGraphqlEndpointSteps.selectOntologiesAndShaclShapesOption();
165
+ CreateGraphqlEndpointSteps.getOntologiesAndShaclShapesView().should('be.visible');
166
+ CreateGraphqlEndpointSteps.getSelectedGraphSource().parent().should('contain', 'Use all graphs');
167
+ // Then I should see the message that all graphs will be used
168
+ CreateGraphqlEndpointSteps.getAllGraphsWillBeUsedMessage().should('be.visible');
169
+ // And the next button should be disabled until endpoint params are filled
170
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.disabled');
171
+
172
+ // When I fill in the endpoint params
173
+ CreateGraphqlEndpointSteps.typeEndpointId('swapi-endpoint');
174
+ // The next button should be enabled because the other fields are optional
175
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.enabled');
176
+ // And I fill in the rest of the fields which are optional
177
+ CreateGraphqlEndpointSteps.typeEndpointLabel('Swapi endpoint');
178
+ CreateGraphqlEndpointSteps.selectVocabularyPrefix('voc');
179
+ CreateGraphqlEndpointSteps.typeEndpointDescription('This is a test endpoint');
180
+ // Then the next button should be enabled
181
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.enabled');
182
+
183
+ // When I switch to SHACL shape graphs option
184
+ CreateGraphqlEndpointSteps.selectUseShaclShapeGraphsOption();
185
+ CreateGraphqlEndpointSteps.getShaclShapeGraphsNotFound().should('be.visible');
186
+ // And the next button should be disabled because there are no graphs to select
187
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.disabled');
188
+
189
+ // When I switch to pick graphs option
190
+ CreateGraphqlEndpointSteps.selectPickGraphsOption();
191
+ // And the next button should be disabled because no graphs are still selected
192
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.disabled');
193
+ // And I can select graphs
194
+ CreateGraphqlEndpointSteps.getGraphsSelector().should('be.visible');
195
+ CreateGraphqlEndpointSteps.getAvailableGraphs().should('have.length', 2);
196
+ CreateGraphqlEndpointSteps.getSelectedGraphs().should('have.length', 0);
197
+ CreateGraphqlEndpointSteps.getSelectedGraphsCountBanner().should('not.exist');
198
+ CreateGraphqlEndpointSteps.selectAllGraphs();
199
+ CreateGraphqlEndpointSteps.getAvailableGraphs().should('have.length', 0);
200
+ CreateGraphqlEndpointSteps.getSelectedGraphs().should('have.length', 2);
201
+ CreateGraphqlEndpointSteps.getSelectedGraphsCountBanner().should('contain', '2 SHACL shape graphs are included');
202
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.enabled');
203
+
204
+ // When I click next
205
+ CreateGraphqlEndpointSteps.next();
206
+ // Then I should be on the next step
207
+ CreateGraphqlEndpointSteps.getActiveStep().should('contain', 'Configure endpoint');
208
+ CreateGraphqlEndpointSteps.getConfigureEndpointView().should('be.visible');
209
+ // And I should see the cancel button
210
+ CreateGraphqlEndpointSteps.getCancelButton().should('be.visible');
211
+ // And I should see the back button
212
+ CreateGraphqlEndpointSteps.getBackButton().should('be.visible');
213
+ // When I click on the back button
214
+ CreateGraphqlEndpointSteps.back();
215
+ // Then I should be back on the previous step
216
+ CreateGraphqlEndpointSteps.getActiveStep().should('contain', 'Select schema source');
217
+ CreateGraphqlEndpointSteps.getSelectedSchemaSource().parent().should('contain', 'OWL ontologies/SHACL shapes');
218
+ CreateGraphqlEndpointSteps.getSelectedGraphSource().parent().should('contain', 'Select one or more graphs');
219
+ CreateGraphqlEndpointSteps.getSelectedGraphs().should('have.length', 2);
220
+ CreateGraphqlEndpointSteps.getEndpointIdFieldInput().should('have.value', 'swapi-endpoint');
221
+ CreateGraphqlEndpointSteps.getEndpointLabelFieldInput().should('have.value', 'Swapi endpoint');
222
+ CreateGraphqlEndpointSteps.getVocabularyPrefixSelectSelectedOption().should('have.text', 'voc');
223
+ CreateGraphqlEndpointSteps.getEndpointDescriptionFieldInput().should('have.value', 'This is a test endpoint');
224
+ });
225
+
226
+ it('should be able to configure generation settings (the second step)', () => {
227
+ // Given I have a repository with graphql shapes in it
228
+ cy.importServerFile(repositoryId, 'ontology-and-shapes.ttl');
229
+ // And I started the endpoint creation wizard
230
+ GraphqlEndpointManagementSteps.visit();
231
+ cy.wait('@getRepositories');
232
+ GraphqlEndpointManagementSteps.createEndpoint();
233
+ CreateGraphqlEndpointSteps.getView().should('be.visible');
234
+ CreateGraphqlEndpointSteps.getSelectSchemaSourceView().should('be.visible');
235
+ CreateGraphqlEndpointSteps.getAvailableGraphqlShapes().should('have.length', 2);
236
+ // When I select a graphql schema shape
237
+ CreateGraphqlEndpointSteps.selectGraphqlShape(1);
238
+ // Then I should be able to proceed to the next step
239
+ CreateGraphqlEndpointSteps.next();
240
+ CreateGraphqlEndpointSteps.getGenerationSettingsForm().should('be.visible');
241
+ // And the next button should be enabled because all settings fields are available and valid initially
242
+ CreateGraphqlEndpointSteps.getNextStepButton().should('be.enabled');
243
+ // When I click next
244
+ CreateGraphqlEndpointSteps.next();
245
+ // Then I should be on the generate endpoint step
246
+ CreateGraphqlEndpointSteps.getActiveStep().should('contain', 'Create');
247
+ CreateGraphqlEndpointSteps.getGenerateEndpointView().should('be.visible');
248
+
249
+ });
250
+
251
+ it('should be able to cancel the endpoint creation wizard', () => {
252
+ // Given I have a repository with no active GraphQL endpoints
253
+ // When I visit the endpoint management view
254
+ GraphqlEndpointManagementSteps.visit();
255
+ cy.wait('@getRepositories');
256
+ // Then I should see no endpoints
257
+ GraphqlEndpointManagementSteps.getEndpointTable().should('not.exist');
258
+ // When I click on the create endpoint button
259
+ GraphqlEndpointManagementSteps.createEndpoint();
260
+ // Then I should see the create endpoint wizard
261
+ CreateGraphqlEndpointSteps.getView().should('be.visible');
262
+ CreateGraphqlEndpointSteps.getSelectSchemaSourceView().should('be.visible');
263
+ CreateGraphqlEndpointSteps.getSchemaSourceTypes().should('have.length', 2);
264
+ // When I click on the cancel button
265
+ CreateGraphqlEndpointSteps.cancelEndpointCreation();
266
+ // Then I should see a confirmation dialog
267
+ ModalDialogSteps.getDialog().should('be.visible');
268
+ // When I click on the cancel button in the dialog
269
+ ModalDialogSteps.clickOnCancelButton();
270
+ // Then I should stay on the same page
271
+ ModalDialogSteps.getDialog().should('not.exist');
272
+ cy.url().should('include', '/graphql/endpoint/create');
273
+ // When I click on the cancel button again and confirm
274
+ CreateGraphqlEndpointSteps.cancelEndpointCreation();
275
+ ModalDialogSteps.confirm();
276
+ // Then I should be redirected back to the endpoint management view
277
+ ModalDialogSteps.getDialog().should('not.exist');
278
+ cy.url().should('include', '/graphql/endpoints');
279
+ });
280
+
281
+ });
@@ -0,0 +1,46 @@
1
+ import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
2
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
3
+ import {ApplicationSteps} from "../../steps/application-steps";
4
+
5
+ describe('Graphql: delete endpoint', () => {
6
+ let repositoryId;
7
+
8
+ beforeEach(() => {
9
+ repositoryId = 'graphql-endpoint-management-' + Date.now();
10
+ cy.createRepository({id: repositoryId});
11
+ cy.presetRepository(repositoryId);
12
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
13
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
14
+ });
15
+
16
+ afterEach(() => {
17
+ cy.deleteRepository(repositoryId);
18
+ });
19
+
20
+ it('should be able to delete graphql endpoint', () => {
21
+ // Given I have a repository with active GraphQL endpoint
22
+ // And I have visited the endpoint management view
23
+ GraphqlEndpointManagementSteps.visit();
24
+ GraphqlEndpointManagementSteps.getView().should('be.visible');
25
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
26
+ // When I click on the delete endpoint button
27
+ GraphqlEndpointManagementSteps.deleteEndpoint(0);
28
+ // Then I should see the confirmation dialog
29
+ ModalDialogSteps.getDialog().should('be.visible');
30
+ // When I reject the confirmation dialog
31
+ ModalDialogSteps.cancel();
32
+ // Then Confirmation dialog should be closed
33
+ ModalDialogSteps.getDialog().should('not.exist');
34
+ // And the endpoint should not be deleted
35
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
36
+
37
+ // When I click on the delete endpoint button again and confirm the deletion
38
+ GraphqlEndpointManagementSteps.deleteEndpoint(0);
39
+ ModalDialogSteps.confirm();
40
+ // Then I should see a success toast
41
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
42
+ // And the endpoint should be deleted and the no results row should be visible
43
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 1);
44
+ GraphqlEndpointManagementSteps.getNoResultsRow().should('be.visible');
45
+ });
46
+ });
@@ -0,0 +1,160 @@
1
+ import {GraphqlStubs} from "../../stubs/graphql/graphql-stubs";
2
+ import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
3
+ import {EditGraphqlEndpointSteps} from "../../steps/graphql/edit-graphql-endpoint-steps";
4
+ import {ApplicationSteps} from "../../steps/application-steps";
5
+
6
+ describe('Graphql: edit endpoint settings', () => {
7
+ let repositoryId;
8
+
9
+ beforeEach(() => {
10
+ repositoryId = 'create-graphql-endpoint-' + Date.now();
11
+ cy.createRepository({id: repositoryId});
12
+ cy.presetRepository(repositoryId);
13
+ cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
14
+ cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
15
+ // Visit the endpoint management view
16
+ GraphqlEndpointManagementSteps.visit();
17
+ // Ensure the endpoints list is loaded
18
+ GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length.at.least', 1);
19
+ });
20
+
21
+ afterEach(() => {
22
+ cy.deleteRepository(repositoryId);
23
+ });
24
+
25
+ it('should display and edit different types dynamic form fields', () => {
26
+ GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
27
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
28
+
29
+ // I should see 3 groups of fields
30
+ EditGraphqlEndpointSteps.getFormGroups().should('have.length', 3);
31
+ EditGraphqlEndpointSteps.validateFormGroups([
32
+ {label: 'GraphQL settings'},
33
+ {label: 'Security settings'},
34
+ {label: 'Integration settings'}
35
+ ]);
36
+
37
+ // I should see 8 fields in the first group
38
+ EditGraphqlEndpointSteps.getVisibleFormGroupFields(0).should('have.length', 8);
39
+ EditGraphqlEndpointSteps.validateFormGroupFields(0, [
40
+ {"label": "Enable Type Count Queries"},
41
+ {"label": "Enable Collection Count"},
42
+ {"label": "Compact Error Messages"},
43
+ {"label": "Default Fetch Language"},
44
+ {"label": "Default Language Validation"},
45
+ {"label": "Default Implicit Language"},
46
+ {"label": "Include Inferred Data"},
47
+ {"label": "Expand owl:sameAs"}
48
+ ]);
49
+ // When I expand the first group
50
+ EditGraphqlEndpointSteps.toggleFormGroupHiddenFields(0);
51
+ EditGraphqlEndpointSteps.getAllFormGroupFields(0).should('have.length', 10);
52
+
53
+ EditGraphqlEndpointSteps.getInputField(3).should('have.value', 'ANY');
54
+ EditGraphqlEndpointSteps.fillInputField(3, 'NONE')
55
+
56
+ EditGraphqlEndpointSteps.getBooleanField(0).should('not.be.checked');
57
+ EditGraphqlEndpointSteps.toggleBooleanField(0);
58
+
59
+ // There is no select field in the data
60
+ // EditGraphqlEndpointSteps.getSelectField(0).should('have.value', 'Two');
61
+ // EditGraphqlEndpointSteps.selectOption(0, 'One');
62
+
63
+ // There is no multi select field in the data
64
+ // EditGraphqlEndpointSteps.verifyMultiSelectOptionSelected(0, 'Angular', 'JavaScript');
65
+ // EditGraphqlEndpointSteps.toggleMultiSelectOption(0, 'Angular');
66
+ // EditGraphqlEndpointSteps.verifyMultiSelectOptionSelected(0, 'JavaScript');
67
+
68
+ // There is no json field in the data
69
+ // EditGraphqlEndpointSteps.getJsonField(0).should('have.value', '{"foo": "bar"}');
70
+ // EditGraphqlEndpointSteps.clearJsonField(0);
71
+ });
72
+
73
+ it('should allow saving the configuration changes successfully', () => {
74
+ GraphqlStubs.spySaveEndpointConfiguration(repositoryId, 'swapi');
75
+ // Open the modal
76
+ GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
77
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
78
+
79
+ // Then the save button is disabled
80
+ EditGraphqlEndpointSteps.getOKButton().should('be.disabled');
81
+
82
+ // Show hidden fields
83
+ EditGraphqlEndpointSteps.toggleFormGroupHiddenFields(0);
84
+
85
+ // When I change some fields
86
+ EditGraphqlEndpointSteps.fillInputField(3, 'NONE');
87
+ EditGraphqlEndpointSteps.toggleBooleanField(0);
88
+
89
+ // Then the save button is enabled
90
+ EditGraphqlEndpointSteps.getOKButton().should('be.enabled');
91
+
92
+ // Submit the form
93
+ EditGraphqlEndpointSteps.clickOKButton();
94
+ EditGraphqlEndpointSteps.getSavingLoader().should('be.visible');
95
+ cy.wait('@save-endpoint-configuration').then((interception) => {
96
+ expect(interception.request.body).to.deep.equal({
97
+ "options": {
98
+ "enableTypeCount": true,
99
+ "enableCollectionCount": false,
100
+ "compactErrorMessages": false,
101
+ "langFetch": null,
102
+ "langValidate": null,
103
+ "langImplicit": null,
104
+ "langDefaultNameFetch": "NONE",
105
+ "langAppendDefaultNameFetch": "true",
106
+ "includeInferred": true,
107
+ "expandOwlSameAs": true,
108
+ "enableMutations": null,
109
+ "defaultRole": "defaultRole",
110
+ "enableGraphQLExplain": true,
111
+ "exposeSomlInGraphQL": false,
112
+ "disabledChecks": null,
113
+ "queryPrefix": null,
114
+ "mutationPrefix": null
115
+ }
116
+ });
117
+ });
118
+
119
+ // Modal should close after successful save
120
+ EditGraphqlEndpointSteps.getDialog().should('not.exist');
121
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
122
+ });
123
+
124
+ it('should show an error message if saving configuration fails', () => {
125
+ // Force the stub for save configuration to fail
126
+ GraphqlStubs.stubSaveEndpointConfiguration(repositoryId, 'swapi', 1000, true);
127
+
128
+ // Open the modal
129
+ GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
130
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
131
+
132
+ // Show hidden fields
133
+ EditGraphqlEndpointSteps.toggleFormGroupHiddenFields(0);
134
+
135
+ // Fill in a field to allow form submission
136
+ EditGraphqlEndpointSteps.fillInputField(0, 'ANY');
137
+
138
+ // Submit the form
139
+ EditGraphqlEndpointSteps.clickOKButton();
140
+ EditGraphqlEndpointSteps.getSavingLoader().should('be.visible');
141
+
142
+ // I see a toast error
143
+ ApplicationSteps.getErrorNotifications().should('be.visible');
144
+
145
+ // The modal remains open after failure
146
+ EditGraphqlEndpointSteps.getSavingLoader().should('not.exist');
147
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
148
+ });
149
+
150
+ it('should close the modal when cancel is clicked', () => {
151
+ GraphqlEndpointManagementSteps.editEndpointConfiguration(0);
152
+ EditGraphqlEndpointSteps.getDialog().should('be.visible');
153
+
154
+ // Click cancel
155
+ EditGraphqlEndpointSteps.cancel();
156
+
157
+ // Verify that the modal is dismissed
158
+ EditGraphqlEndpointSteps.getDialog().should('not.exist');
159
+ });
160
+ });