graphdb-workbench-tests 2.5.1 → 2.6.0-RC2

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 (114) hide show
  1. package/fixtures/graphdb-import/resource-test-data.ttl +99 -0
  2. package/fixtures/graphql-editor/default-query-response.json +517 -0
  3. package/fixtures/guides/guides.json +764 -0
  4. package/fixtures/guides/movies.ttl +629 -0
  5. package/fixtures/guides/starwars.ttl +4384 -0
  6. package/fixtures/locale-en.json +53 -12
  7. package/fixtures/namespaces/ontotext-generated-namespace.json +22 -0
  8. package/fixtures/queries/empty-query-response.json +11 -0
  9. package/integration/cluster/cluster-management.spec.js +1 -2
  10. package/integration/explore/graphs.overview.spec.js +4 -2
  11. package/integration/explore/similariti-index-create.spec.js +333 -0
  12. package/integration/explore/similarity-index.spec.js +88 -0
  13. package/integration/explore/similarity.spec.js +180 -56
  14. package/integration/explore/visual-graph/graphs-config.spec.js +453 -0
  15. package/integration/explore/{visual.graph.spec.js → visual-graph/visual.graph.spec.js} +146 -347
  16. package/integration/guides/movies-interactive-guide.spec.js +73 -0
  17. package/integration/guides/star-wars-interactive-guide.js +60 -0
  18. package/integration/home/language-change.spec.js +3 -3
  19. package/integration/import/import.user.data.spec.js +2 -0
  20. package/integration/resource/resource.spec.js +357 -0
  21. package/integration/setup/aclmanagement/create-rule.spec.js +88 -11
  22. package/integration/setup/aclmanagement/delete-rule.spec.js +6 -4
  23. package/integration/setup/aclmanagement/edit-rule.spec.js +13 -8
  24. package/integration/setup/aclmanagement/render-rules.spec.js +4 -2
  25. package/integration/setup/aclmanagement/reorder-rules.spec.js +5 -3
  26. package/integration/setup/aclmanagement/revert-rules.spec.js +4 -3
  27. package/integration/setup/aclmanagement/scopes.spec.js +228 -0
  28. package/integration/setup/aclmanagement/update-rules.spec.js +17 -9
  29. package/integration/setup/jdbc-create.spec.js +330 -0
  30. package/integration/setup/jdbc.spec.js +78 -154
  31. package/integration/setup/my-settings.spec.js +9 -41
  32. package/integration/setup/sparql-template-create.js +150 -0
  33. package/integration/setup/sparql-templates.spec.js +82 -146
  34. package/integration/sparql-editor/actions/execute-query.spec.js +44 -0
  35. package/integration/sparql-editor/actions/expand-results-over-sameas.spec.js +136 -0
  36. package/integration/sparql-editor/actions/include-inferred-statements.spec.js +100 -0
  37. package/integration/sparql-editor/actions/inferred-sameas.spec.js +47 -0
  38. package/integration/sparql-editor/actions/save-query.spec.js +70 -0
  39. package/integration/sparql-editor/actions/show-saved-queries.spec.js +61 -0
  40. package/integration/sparql-editor/internationalization.spec.js +41 -0
  41. package/integration/sparql-editor/saved-query/abort-query.spec.js +51 -0
  42. package/integration/sparql-editor/saved-query/delete-query.spec.js +56 -0
  43. package/integration/sparql-editor/saved-query/edit-query.spec.js +68 -0
  44. package/integration/sparql-editor/saved-query/share-query.spec.js +78 -0
  45. package/integration/sparql-editor/sparql-editor.spec.js +55 -0
  46. package/integration/sparql-editor/yasgui-tabs.spec.js +107 -0
  47. package/integration/sparql-editor/yasr/download-as.spec.js +54 -0
  48. package/integration/sparql-editor/yasr/pagination.spec.js +234 -0
  49. package/integration/sparql-editor/yasr/table-plugin.spec.js +39 -0
  50. package/integration/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +57 -0
  51. package/integration-flaky/explore/visual.graph.spec.js +3 -2
  52. package/integration-flaky/setup/sparql-template-create.js +139 -0
  53. package/integration-flaky/sparql-editor/actions/execute-update-query.spec.js +89 -0
  54. package/integration-flaky/sparql-editor/actions/share-query.spec.js +84 -0
  55. package/integration-flaky/sparql-editor/lucene-connector.spec.js +62 -0
  56. package/integration-flaky/sparql-editor/plugins/error-plugin.spec.js +83 -0
  57. package/integration-flaky/sparql-editor/yasr/table-plugin.spec.js +81 -0
  58. package/package.json +3 -1
  59. package/steps/application-steps.js +5 -0
  60. package/steps/autocomplete-steps.js +10 -0
  61. package/steps/error-steps.js +9 -0
  62. package/steps/explore/graphs-overview-steps.js +24 -0
  63. package/steps/explore/similarity-index-create-steps.js +113 -0
  64. package/steps/explore/similarity-indexes-steps.js +18 -0
  65. package/steps/guides/guide-dialog-steps.js +38 -0
  66. package/steps/guides/guide-steps.js +278 -0
  67. package/steps/guides/movies-guide-steps.js +241 -0
  68. package/steps/guides/star-wars-guide-steps.js +188 -0
  69. package/steps/import-steps.js +16 -0
  70. package/steps/language-selector-steps.js +22 -0
  71. package/steps/loader-steps.js +10 -0
  72. package/steps/lucene-connector-steps.js +43 -0
  73. package/steps/main-menu-steps.js +67 -0
  74. package/steps/repository-selector-steps.js +26 -0
  75. package/steps/repository-steps.js +4 -0
  76. package/steps/resource/resource-edit-steps.js +111 -0
  77. package/steps/resource/resource-steps.js +149 -0
  78. package/steps/setup/acl-management-steps.js +201 -39
  79. package/steps/setup/jdbc-create-steps.js +97 -0
  80. package/steps/setup/jdbc-steps.js +42 -0
  81. package/steps/setup/sparql-create-update-steps.js +55 -0
  82. package/steps/setup/sparql-templates-steps.js +38 -0
  83. package/steps/sparql-editor-steps.js +20 -0
  84. package/steps/sparql-steps.js +0 -6
  85. package/steps/visual-graph-steps.js +365 -6
  86. package/steps/yasgui/confirmation-dialog-steps.js +13 -0
  87. package/steps/yasgui/pagination-steps.js +47 -0
  88. package/steps/yasgui/plugin/error-plugin-steps.js +30 -0
  89. package/steps/yasgui/save-query-dialog.js +61 -0
  90. package/steps/yasgui/saved-queries-dialog.js +29 -0
  91. package/steps/yasgui/saved-query.js +25 -0
  92. package/steps/yasgui/share-saved-query-dialog.js +25 -0
  93. package/steps/yasgui/table-plugin-steps.js +29 -0
  94. package/steps/yasgui/yasgui-loader.js +10 -0
  95. package/steps/yasgui/yasgui-steps.js +191 -0
  96. package/steps/yasgui/yasqe-steps.js +187 -0
  97. package/steps/yasgui/yasr-steps.js +108 -0
  98. package/stubs/namespace-stubs.js +10 -0
  99. package/stubs/repositories-stub.js +58 -0
  100. package/stubs/security-stubs.js +69 -0
  101. package/stubs/yasgui/connectors-stubs.js +12 -0
  102. package/stubs/yasgui/query-stubs.js +253 -0
  103. package/support/index.js +3 -0
  104. package/support/repository-commands.js +5 -5
  105. package/support/sparql-commands.js +1 -1
  106. package/support/visual-graph-commands.js +25 -0
  107. package/integration/sparql/main.menu.spec.js +0 -232
  108. package/integration/sparql/sparql-error-handling.spec.js +0 -74
  109. package/integration/sparql/sparql-language-change.spec.js +0 -58
  110. package/integration/sparql/sparql-result-formating.spec.js +0 -84
  111. package/integration/sparql/sparql.menu.spec.js +0 -1253
  112. package/integration-flaky/setup/sparql-templates.spec.js +0 -125
  113. package/integration-flaky/sparql/sparql-language-change.spec.js +0 -45
  114. package/integration-flaky/sparql/sparql.menu.spec.js +0 -75
@@ -1,160 +1,96 @@
1
+ import {SparqlTemplatesSteps} from "../../steps/setup/sparql-templates-steps";
2
+ import {SparqlCreateUpdateSteps} from "../../steps/setup/sparql-create-update-steps";
3
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
4
+ import {ToasterSteps} from "../../steps/toaster-steps";
5
+
1
6
  describe('SPARQL Templates', () => {
2
7
 
3
8
  let repositoryId;
4
- const TEMPLATE_NAME = "http://example.com/salary_template";
5
- const SPARQL_TEMPLATE = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
6
- "PREFIX factory: <http://factory/>\n" +
7
- "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" +
8
- "PREFIX spif: <http://spinrdf.org/spif#>\n" +
9
- "INSERT {\n" +
10
- "?id <http://factory/updatedOn> \"2021-10-01T07:55:38.238Z\"^^xsd:dateTime .\n" +
11
- "?split spif:split (\"blaaa/blaa\" \"/\")\n" +
12
- "} WHERE {\n" +
13
- "?id rdf:type <http://factory/Factory> .\n" +
14
- "?worker <http://factory/worksIn> ?id .\n" +
15
- "?worker <http://factory/hasSalary> ?oldSalary .\n" +
16
- "FILTER regex(STR(?id), \"fac\", \"i\")\n" +
17
- "?split spif:split (\"blaaa/blaa\" \"/\")\n" +
18
- "bind(now() as ?now)\n" +
19
- "}";
20
- const DEFAULT_QUERY = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
21
- "PREFIX ex: <http://example.com#>\n" +
22
- "DELETE {\n" +
23
- " ?subject ex:myPredicate ?oldValue .\n" +
24
- "} INSERT {\n" +
25
- " ?subject ex:myPredicate ?newValue .\n" +
26
- "} WHERE {\n" +
27
- " ?id rdf:type ex:MyType .\n" +
28
- " ?subject ex:isRelatedTo ?id .\n" +
29
- "}\n";
30
-
31
- before(() => {
32
- repositoryId = 'sparql-templates-repo' + Date.now();
33
- cy.createRepository({id: repositoryId});
34
- });
35
9
 
36
10
  beforeEach(() => {
37
- cy.visit('/sparql-templates', {
38
- onBeforeLoad: (win) => {
39
- win.localStorage.setItem('ls.repository-id', repositoryId);
40
- }
41
- });
42
- cy.window()
43
- .then(() => getTemplatesTable().scrollIntoView().should('be.visible'));
11
+ repositoryId = 'sparql-templates-repo' + Date.now();
12
+ cy.createRepository({id: repositoryId});
13
+ cy.presetRepository(repositoryId);
14
+ SparqlTemplatesSteps.visit();
44
15
  });
45
16
 
46
- after(() => {
17
+ afterEach(() => {
47
18
  cy.deleteRepository(repositoryId);
48
19
  });
49
20
 
50
- it('Initial state', () => {
51
- cy.url().should('include', '/sparql-templates');
52
- //Verify templates table is empty
53
- getTemplatesTable().should('be.visible')
54
- .and('contain','No templates are defined');
55
- //Verify create template button is visible
56
- getCreateSparqlTemplateButton().should('be.visible');
57
- });
21
+ it('should not create a SPARQL template if cancel button is clicked', () => {
22
+ // When I visit 'Sparql templates' view,
23
+ // and click on create template button.
24
+ SparqlTemplatesSteps.clickOnCreateSparqlTemplateButton();
25
+
26
+ // Then, I expect to be navigated to "Sparql create template" view.
27
+ SparqlCreateUpdateSteps.verifyUrl();
28
+
29
+ // When I click on button cancel.
30
+ SparqlCreateUpdateSteps.clickOnCancelButton();
58
31
 
59
- it('Should create/edit/delete a SPARQL template', () => {
60
- //Click create template button
61
- getCreateSparqlTemplateButton().click();
62
- cy.waitUntilQueryIsVisible();
63
- //Test Template IRI field validation
64
- getSaveButton().click();
65
- //Verify error toast
66
- getToastError()
67
- .should('be.visible')
68
- .and('contain','SPARQL template IRI is required');
69
- //Type a valid Template IRI value in the filed
70
- getTemplateNameField().type(TEMPLATE_NAME);
71
- //Verify default query
72
- verifyQueryAreaEquals(DEFAULT_QUERY);
73
- //Paste new template query and verify content
74
- cy.pasteQuery(SPARQL_TEMPLATE);
75
- verifyQueryAreaEquals(SPARQL_TEMPLATE);
76
- getSaveButton()
77
- .scrollIntoView()
78
- .click()
79
- .then(() => {
80
- cy.waitUntil(() =>
81
- cy.get('.edit-query-btn')
82
- .then(editBtn => editBtn));
83
- });
84
- //Verify new template is stored in the templates table
85
- getTemplatesTable().should('be.visible')
86
- .and('contain',TEMPLATE_NAME);
87
- //Edit template
88
- getEditTemplateButton(TEMPLATE_NAME);
89
- cy.waitUntilQueryIsVisible();
90
- verifyQueryAreaEquals(SPARQL_TEMPLATE);
91
- //Cancel as no changes have been made
92
- getCancelButton().click();
93
- //Delete template and verify templates table is empty
94
- getDeleteTemplateButton(TEMPLATE_NAME);
95
- getConfirmDeleteTemplateButton().click();
96
- cy.url().should('include', '/sparql-templates');
97
- getTemplatesTable().should('be.visible')
98
- .and('contain','No templates are defined');
32
+ // Then, I expect to be navigated to "Sparql templates" view,
33
+ SparqlTemplatesSteps.verifyUrl();
34
+ // and expect that no query has been created.
35
+ SparqlTemplatesSteps.getSparqlTemplates().should('have.length', 0);
36
+ SparqlTemplatesSteps.getNoTemplateDefinedElement().should('contain.text', 'No templates are defined');
99
37
  });
100
38
 
101
- function getTemplatesTable() {
102
- return cy.get('.sparql-templates-list');
103
- }
104
-
105
- function getCreateSparqlTemplateButton() {
106
- return cy.get('.clearfix .create-sql-table-configuration');
107
- }
108
-
109
- function getTemplateNameField() {
110
- return cy.get('.sparql-template-name');
111
- }
112
-
113
- function verifyQueryAreaEquals(query) {
114
- // Using the CodeMirror instance because getting the value from the DOM is very cumbersome
115
- getQueryArea().should(codeMirrorEl => {
116
- const cm = codeMirrorEl[0].CodeMirror;
117
- expect(cm.getValue().trim()).to.equal(query.trim());
118
- });
119
- }
120
-
121
- function getQueryArea() {
122
- return cy.get('#queryEditor .CodeMirror');
123
- }
124
-
125
- function getSaveButton() {
126
- return cy.get('.save-query-btn');
127
- }
128
-
129
- function getCancelButton() {
130
- return cy.get('.cancel-query-btn');
131
- }
132
-
133
- function getToastError() {
134
- return cy.get('#toast-container');
135
- }
136
-
137
- function getEditTemplateButton(templateName) {
138
- return cy.get('#configurations-table tr')
139
- .contains(templateName)
140
- .parent()
141
- .parent()
142
- .within(() => {
143
- cy.get('.icon-edit').click();
144
- })
145
- }
146
-
147
- function getDeleteTemplateButton(templateName) {
148
- return cy.get('#configurations-table tr')
149
- .contains(templateName)
150
- .parent()
151
- .parent()
152
- .within(() => {
153
- cy.get('.icon-trash').click();
154
- })
155
- }
156
-
157
- function getConfirmDeleteTemplateButton() {
158
- return cy.get('.confirm-btn');
159
- }
39
+ it('should create a query and delete it', () => {
40
+ // When I visit 'Sparql templates' view,
41
+ // and click on create template button.
42
+ SparqlTemplatesSteps.clickOnCreateSparqlTemplateButton();
43
+
44
+ // Then, I expect to be navigated to "Sparql create template" view.
45
+ SparqlCreateUpdateSteps.verifyUrl();
46
+
47
+ const templateId = `http://test-${Date.now()}`;
48
+ // When I fill template id,
49
+ SparqlCreateUpdateSteps.typeTemplateId(templateId);
50
+
51
+ // and click on save button.
52
+ SparqlCreateUpdateSteps.clickOnSaveButton();
53
+
54
+ // Then, I expect to be navigated to "Sparql templates" view,
55
+ SparqlTemplatesSteps.verifyUrl();
56
+ // and expect a query has been created.
57
+ SparqlTemplatesSteps.getSparqlTemplates().should('have.length', 1);
58
+ SparqlTemplatesSteps.getNoTemplateDefinedElement().should('not.exist');
59
+ SparqlTemplatesSteps.getSparqlTemplate(templateId).should('exist');
60
+
61
+ // When I try to delete the query.
62
+ SparqlTemplatesSteps.deleteTemplate(templateId);
63
+
64
+ // Then I expect to see Warning dialog,
65
+ ModalDialogSteps.getDialogHeader().contains('Warning');
66
+ ModalDialogSteps.getDialogBody().contains(`Are you sure you want to delete the SPARQL template '${templateId}'?`);
67
+
68
+ // When click on close button
69
+ ModalDialogSteps.clickOnCloseButton();
70
+
71
+ //Then I expect query to be not deleted.
72
+ SparqlTemplatesSteps.getSparqlTemplate(templateId).should('exist');
73
+
74
+ // When confirm dialog is open,
75
+ SparqlTemplatesSteps.deleteTemplate(templateId);
76
+ // and click on cancel button.
77
+ ModalDialogSteps.clickOnCancelButton();
78
+
79
+ //Then I expect query to be not deleted.
80
+ SparqlTemplatesSteps.getSparqlTemplate(templateId).should('exist');
81
+
82
+ // When confirm dialog is open,
83
+ SparqlTemplatesSteps.deleteTemplate(templateId);
84
+ // and click on confirm button.
85
+ ModalDialogSteps.clickOnConfirmButton();
86
+
87
+ // Then, I expect to be navigated to "Sparql templates" view,
88
+ SparqlTemplatesSteps.verifyUrl();
89
+ // and expect that no query has been created.
90
+ SparqlTemplatesSteps.getSparqlTemplates().should('have.length', 0);
91
+ SparqlTemplatesSteps.getNoTemplateDefinedElement().should('contain.text', 'No templates are defined');
92
+
93
+ ToasterSteps.verifyTitle('Deleted successfully SPARQL template');
94
+ ToasterSteps.verifySuccess(templateId);
95
+ });
160
96
  });
@@ -0,0 +1,44 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
4
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
5
+
6
+ describe('Execute query', () => {
7
+
8
+ let repositoryId;
9
+
10
+ beforeEach(() => {
11
+ repositoryId = 'sparql-editor-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
16
+
17
+ SparqlEditorSteps.visitSparqlEditorPage();
18
+ YasguiSteps.getYasgui().should('be.visible');
19
+ });
20
+
21
+ afterEach(() => {
22
+ cy.deleteRepository(repositoryId);
23
+ });
24
+
25
+ it('Should be able to execute query from each editor tab', () => {
26
+ cy.intercept('POST', `/repositories/${repositoryId}`).as('query');
27
+ YasqeSteps.executeQuery();
28
+ cy.wait('@query').then((interception) => {
29
+ const headers = interception.request.headers;
30
+ expect(headers).to.have.property('x-graphdb-local-consistency');
31
+ expect(headers).to.have.property('x-graphdb-repository-location');
32
+ expect(headers).to.have.property('x-graphdb-track-alias');
33
+ });
34
+ YasguiSteps.openANewTab();
35
+ YasguiSteps.getTabs().should('have.length', 2);
36
+ YasqeSteps.executeQuery();
37
+ cy.wait('@query').then((interception) => {
38
+ const headers = interception.request.headers;
39
+ expect(headers).to.have.property('x-graphdb-local-consistency');
40
+ expect(headers).to.have.property('x-graphdb-repository-location');
41
+ expect(headers).to.have.property('x-graphdb-track-alias');
42
+ });
43
+ });
44
+ });
@@ -0,0 +1,136 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
4
+ import {QueryStubDescription, QueryStubs} from "../../../stubs/yasgui/query-stubs";
5
+
6
+ describe('Expand results over owl:sameAs', () => {
7
+
8
+ let repositoryId;
9
+
10
+ beforeEach(() => {
11
+ repositoryId = 'sparql-editor-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ });
16
+
17
+ afterEach(() => {
18
+ cy.deleteRepository(repositoryId);
19
+ });
20
+
21
+ it('Should be able to toggle expand results parameter', () => {
22
+ QueryStubs.stubInferAndSameAsDefaults(true, true);
23
+ SparqlEditorSteps.visitSparqlEditorPage();
24
+ YasguiSteps.getYasgui().should('be.visible');
25
+ const queryDescription = new QueryStubDescription()
26
+ .setRepositoryId(repositoryId)
27
+ .setTotalElements(1);
28
+ QueryStubs.stubQueryResults(queryDescription);
29
+ // When I open the editor
30
+ // Then I expect that expand results should be enabled by default
31
+ YasqeSteps.getExpandResultsOverSameAsButtonTooltip().should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: ON');
32
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-on');
33
+ YasqeSteps.executeQuery();
34
+ cy.wait('@query-1_0_1001_1').its('request.body').should('contain', 'sameAs=true');
35
+ // When I disable the expand results action
36
+ YasqeSteps.expandResultsOverSameAs();
37
+ // Then I expect that the button state should be changed
38
+ YasqeSteps.getExpandResultsOverSameAsButtonTooltip().should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: OFF');
39
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-off');
40
+ // And sameAs=false parameter should be sent with the request
41
+ YasqeSteps.executeQuery();
42
+ cy.wait('@query-1_0_1001_1').its('request.body').should('contain', 'sameAs=false');
43
+ YasqeSteps.expandResultsOverSameAs();
44
+ // When I disable the include inferred action
45
+ YasqeSteps.includeInferredStatements();
46
+ // Then I expect that sameAs should be disabled too
47
+ YasqeSteps.getExpandResultsOverSameAsButtonTooltip().should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
48
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-off');
49
+ YasqeSteps.executeQuery();
50
+ cy.wait('@query-1_0_1001_1').its('request.body').should('contain', 'infer=false&sameAs=false');
51
+ });
52
+
53
+ it('should be enabled when infer is true and sameAs is true in user settings', () => {
54
+ QueryStubs.stubInferAndSameAsDefaults(true, true);
55
+
56
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
57
+ SparqlEditorSteps.visitSparqlEditorPage();
58
+ YasguiSteps.getYasgui().should('be.visible');
59
+
60
+ // Then I expect that "sameAs" element to be enabled by default
61
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-on');
62
+ // and the tooltip of element describes that "sameAs" element is enabled.
63
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: ON');
64
+
65
+ // When I open a new Tab.
66
+ YasguiSteps.openANewTab();
67
+
68
+ // Then I expect that "sameAs" element to be enabled in the new tab.
69
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-on');
70
+ // and the tooltip of element describes that "sameAs" element is enabled.
71
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: ON');
72
+ });
73
+
74
+ it('should not be enabled when infer is true and sameAs is false in user settings', () => {
75
+ QueryStubs.stubInferAndSameAsDefaults(true, false);
76
+
77
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
78
+ SparqlEditorSteps.visitSparqlEditorPage();
79
+ YasguiSteps.getYasgui().should('be.visible');
80
+
81
+ // Then I expect that "sameAs" element to be disabled by default
82
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
83
+ // and the tooltip of element describes that "sameAs" element is disabled.
84
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: OFF');
85
+
86
+ // When I open a new Tab.
87
+ YasguiSteps.openANewTab();
88
+
89
+ // Then I expect that "sameAs" element to be disabled in the new tab.
90
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
91
+ // and the tooltip of element describes that "sameAs" element is disabled.
92
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: OFF');
93
+ });
94
+
95
+ it('should not be enabled when infer is false and sameAs is true in user settings', () => {
96
+ QueryStubs.stubInferAndSameAsDefaults(false, true);
97
+
98
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
99
+ SparqlEditorSteps.visitSparqlEditorPage();
100
+ YasguiSteps.getYasgui().should('be.visible');
101
+
102
+ // Then I expect that "sameAs" element to be disabled by default
103
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
104
+ // and the tooltip of element describes that "infer" is required.
105
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
106
+
107
+ // When I open a new Tab.
108
+ YasguiSteps.openANewTab();
109
+
110
+ // Then I expect that "sameAs" element to be disabled in the new tab,
111
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
112
+ // and the tooltip of element describes that "infer" is required.
113
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
114
+ });
115
+
116
+ it('should not be enabled when infer is false and sameAs is false in user settings', () => {
117
+ QueryStubs.stubInferAndSameAsDefaults(false, false);
118
+
119
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
120
+ SparqlEditorSteps.visitSparqlEditorPage();
121
+ YasguiSteps.getYasgui().should('be.visible');
122
+
123
+ // Then I expect that "sameAs" element to be disabled by default,
124
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
125
+ // and the tooltip of element describes that "infer" is required.
126
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
127
+
128
+ // When I open a new Tab.
129
+ YasguiSteps.openANewTab();
130
+
131
+ // Then I expect that "sameAs" element to be disabled in the new tab,
132
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
133
+ // and the tooltip of element describes that "infer" is required.
134
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
135
+ });
136
+ });
@@ -0,0 +1,100 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
4
+ import {QueryStubDescription, QueryStubs} from "../../../stubs/yasgui/query-stubs";
5
+
6
+ describe('Include inferred statements', () => {
7
+
8
+ let repositoryId;
9
+
10
+ beforeEach(() => {
11
+ repositoryId = 'sparql-editor-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ });
16
+
17
+ afterEach(() => {
18
+ cy.deleteRepository(repositoryId);
19
+ });
20
+
21
+ it('Should be able to toggle include inferred statements', () => {
22
+ const queryDescription = new QueryStubDescription()
23
+ .setRepositoryId(repositoryId)
24
+ .setTotalElements(1);
25
+ QueryStubs.stubQueryResults(queryDescription);
26
+ QueryStubs.stubInferAndSameAsDefaults(true);
27
+
28
+ // When I visit a page with "ontotext-yasgui-web-component" in it,
29
+ SparqlEditorSteps.visitSparqlEditorPage();
30
+ YasguiSteps.getYasgui().should('be.visible');
31
+
32
+ // Then I expect that include inferred statements should be enabled by default,
33
+ YasqeSteps.getIncludeInferredStatementsButton().should('have.class', 'icon-inferred-on');
34
+ // and the tooltip of element describes that "infer" functionality is enabled.
35
+ YasqeSteps.getIncludeInferredStatementsButtonTooltip().should('have.attr', 'data-tooltip', 'Include inferred data in results: ON');
36
+
37
+ // When I execute a query.
38
+ YasqeSteps.executeQuery();
39
+
40
+ // Then I expect the request body contains property "infer" with value true.
41
+ cy.wait('@query-1_0_1001_1').its('request.body').should('contain', 'infer=true');
42
+
43
+ // When I disable "infer".
44
+ YasqeSteps.includeInferredStatements();
45
+
46
+ // Then I expect the include inferred statements should be enabled by default,
47
+ YasqeSteps.getIncludeInferredStatementsButton().should('have.class', 'icon-inferred-off');
48
+ // and the tooltip of element describes that "infer" functionality is disabled.
49
+ YasqeSteps.getIncludeInferredStatementsButtonTooltip().should('have.attr', 'data-tooltip', 'Include inferred data in results: OFF');
50
+
51
+ // When I execute a query.
52
+ YasqeSteps.executeQuery();
53
+
54
+ // Then I expect the request body contains property "infer" with value false.
55
+ cy.wait('@query-1_0_1001_1').its('request.body').should('contain', 'infer=false');
56
+ });
57
+
58
+
59
+ it('should be enabled when user settings is set to true.', () => {
60
+ QueryStubs.stubInferAndSameAsDefaults(true);
61
+
62
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
63
+ SparqlEditorSteps.visitSparqlEditorPage();
64
+ YasguiSteps.getYasgui().should('be.visible');
65
+
66
+ // Then I expect that "infer" element to be enabled by default,
67
+ YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-on');
68
+ // and the tooltip of element describes that "infer" functionality is enabled.
69
+ YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'data-tooltip', 'Include inferred data in results: ON');
70
+
71
+ // When I open a new Tab.
72
+ YasguiSteps.openANewTab();
73
+
74
+ // Then I expect that inferred element to be enabled in the new tab,
75
+ YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-on');
76
+ // and the tooltip of element describes that "infer" element is enabled.
77
+ YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'data-tooltip', 'Include inferred data in results: ON');
78
+ });
79
+
80
+ it('should not be enabled when user settings is set to false.', () => {
81
+ QueryStubs.stubInferAndSameAsDefaults(false);
82
+
83
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
84
+ SparqlEditorSteps.visitSparqlEditorPage();
85
+ YasguiSteps.getYasgui().should('be.visible');
86
+
87
+ // Then I expect that "infer" element to be disabled by default,
88
+ YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-off');
89
+ // and the tooltip of element describes that "infer" element is disabled.
90
+ YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'data-tooltip', 'Include inferred data in results: OFF');
91
+
92
+ // When I open a new Tab.
93
+ YasguiSteps.openANewTab();
94
+
95
+ // Then I expect that inferred element to be disabled in the new tab,
96
+ YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-off');
97
+ // and the tooltip of element describes that "infer" element is disabled.
98
+ YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'data-tooltip', 'Include inferred data in results: OFF');
99
+ });
100
+ });
@@ -0,0 +1,47 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
3
+ import {RepositoriesStub} from "../../../stubs/repositories-stub";
4
+
5
+ describe('Expand results over owl:sameAs', () => {
6
+
7
+ let repositoryId;
8
+
9
+ beforeEach(() => {
10
+ repositoryId = 'sparql-editor-' + Date.now();
11
+ cy.setLocalStorage("ls.repository-id", repositoryId);
12
+ RepositoriesStub.stubOntopRepository(repositoryId);
13
+ RepositoriesStub.stubNameSpaces(repositoryId);
14
+ });
15
+
16
+ it('should not be able to toggle the sameAs button state if repository is virtual', () => {
17
+ // When I open the editor configured for virtual repository.
18
+ SparqlEditorSteps.visitSparqlEditorPage();
19
+
20
+ // Then I expect sameAs button to be on.
21
+ YasqeSteps.getExpandResultsOverSameAsButtonTooltip().should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: ON');
22
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-on');
23
+
24
+ // When I click on inferred button
25
+ YasqeSteps.getExpandResultsOverSameAsButton().click({force: true});
26
+
27
+ // Then I expect sameAs button to not be toggled.
28
+ YasqeSteps.getExpandResultsOverSameAsButtonTooltip().should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: ON');
29
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-on');
30
+ });
31
+
32
+ it('should not be able to toggle the inferred button state if repository is virtual', () => {
33
+ // When I open the editor configured for virtual repository.
34
+ SparqlEditorSteps.visitSparqlEditorPage();
35
+
36
+ // Then I expect inferred button to be on.
37
+ YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'data-tooltip', 'Include inferred data in results: ON');
38
+ YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-on');
39
+
40
+ // When I click on inferred button
41
+ YasqeSteps.getActionButton(3).click({force: true});
42
+
43
+ // Then I expect inferred button to not be toggled.
44
+ YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'data-tooltip', 'Include inferred data in results: ON');
45
+ YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-on');
46
+ });
47
+ });
@@ -0,0 +1,70 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {ApplicationSteps} from "../../../steps/application-steps";
4
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
5
+ import {SaveQueryDialog} from "../../../steps/yasgui/save-query-dialog";
6
+ import {SavedQuery} from "../../../steps/yasgui/saved-query";
7
+ import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
8
+
9
+ describe('Save query', () => {
10
+
11
+ let repositoryId;
12
+
13
+ beforeEach(() => {
14
+ repositoryId = 'sparql-editor-' + Date.now();
15
+ QueryStubs.stubQueryCountResponse();
16
+ cy.createRepository({id: repositoryId});
17
+ cy.presetRepository(repositoryId);
18
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
19
+
20
+ SparqlEditorSteps.visitSparqlEditorPage();
21
+ YasguiSteps.getYasgui().should('be.visible');
22
+ });
23
+
24
+ afterEach(() => {
25
+ cy.deleteRepository(repositoryId);
26
+ });
27
+
28
+ it('Should be able to edit query and save it', () => {
29
+ // Given I have opened the sparql editor page
30
+ // And I have created a query
31
+ const savedQueryName = SavedQuery.generateQueryName();
32
+ SavedQuery.create(savedQueryName);
33
+ // When I open the saved queries popup
34
+ YasguiSteps.showSavedQueries();
35
+ // Then I expect to see the saved query in the list
36
+ SavedQueriesDialog.getSavedQueries().should('contain', savedQueryName);
37
+ // When I select the query
38
+ SavedQueriesDialog.selectSavedQueryByName(savedQueryName);
39
+ // Then I expect to see the query opened in a new editor tab
40
+ YasguiSteps.getTabs().should('have.length', 2);
41
+ YasguiSteps.getCurrentTab().should('contain', savedQueryName);
42
+ YasguiSteps.getTabQuery(1).should('equal', 'select *');
43
+ });
44
+
45
+ it('Should prevent saving query with duplicated name', () => {
46
+ // Given I have opened the sparql editor page
47
+ YasguiSteps.getCreateSavedQueryButton().should('be.visible');
48
+ // And I have created a query
49
+ const savedQueryName = SavedQuery.generateQueryName();
50
+ SavedQuery.create(savedQueryName);
51
+ // When I try to save the query with the same name
52
+ YasguiSteps.createSavedQuery();
53
+ SaveQueryDialog.clearQueryNameField();
54
+ SaveQueryDialog.writeQueryName(savedQueryName);
55
+ SaveQueryDialog.saveQuery();
56
+ // Then I expect that dialog will remain open and an error will be visible
57
+ // TODO: find out why this check fails on Jenkins sometimes with
58
+ // AssertionError: Timed out retrying after 30000ms: Expected to find element: `.toast-error`, but never found it. Queried from element: <div#toast-container.toast-bottom-right>
59
+ // ApplicationSteps.getErrorNotifications().should('be.visible');
60
+ SaveQueryDialog.getSaveQueryDialog().should('be.visible');
61
+ SaveQueryDialog.getErrorsPane().should('contain', 'Error! Cannot create saved query');
62
+ // When I change the query name
63
+ SaveQueryDialog.clearQueryNameField();
64
+ SaveQueryDialog.writeQueryName(SavedQuery.generateQueryName());
65
+ SaveQueryDialog.saveQuery();
66
+ // Then I should be able to save the query
67
+ SaveQueryDialog.getSaveQueryDialog().should('not.exist');
68
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
69
+ });
70
+ });