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
@@ -0,0 +1,61 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
4
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
5
+
6
+ describe('Show saved queries', () => {
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
+ cy.intercept(`/repositories/${repositoryId}`, {fixture: '/graphql-editor/default-query-response.json'}).as('getGuides');
16
+
17
+ SparqlEditorSteps.visitSparqlEditorPage();
18
+ YasguiSteps.getYasgui().should('be.visible');
19
+ });
20
+
21
+ afterEach(() => {
22
+ cy.deleteRepository(repositoryId);
23
+ });
24
+
25
+ it('Should open a popup with the saved queries list', () => {
26
+ // When I click on show saved queries button
27
+ YasguiSteps.showSavedQueries();
28
+ // Then I expect that a popup with a saved queries list to be opened
29
+ SavedQueriesDialog.getSavedQueriesPopup().should('be.visible');
30
+ SavedQueriesDialog.getSavedQueries().should('have.length.gt', 0);
31
+ });
32
+
33
+ it('Should be able to select a query from the list', {
34
+ retries: {
35
+ runMode: 1,
36
+ openMode: 0
37
+ }
38
+ }, () => {
39
+ // Given I have opened the saved queries popup
40
+ YasguiSteps.showSavedQueries();
41
+ SavedQueriesDialog.getSavedQueriesPopup().should('be.visible');
42
+ // When I select a query from the list
43
+ SavedQueriesDialog.selectSavedQueryByIndex(0);
44
+ // Then I expect that the popup should be closed
45
+ SavedQueriesDialog.getSavedQueriesPopup().should('not.exist');
46
+ // And the query will be populated in a new tab in the yasgui
47
+ YasguiSteps.getTabs().should('have.length', 2);
48
+ YasguiSteps.getCurrentTab().should('contain', 'Add statements');
49
+ YasguiSteps.getTabQuery(1).should('equal', 'PREFIX dc: <http://purl.org/dc/elements/1.1/>\nINSERT DATA\n {\n GRAPH <http://example> {\n <http://example/book1> dc:title "A new book" ;\n dc:creator "A.N.Other" .\n }\n }');
50
+ });
51
+
52
+ it('Should be able to close the popup by clicking outside', () => {
53
+ // Given I have opened the saved queries popup
54
+ YasguiSteps.showSavedQueries();
55
+ SavedQueriesDialog.getSavedQueriesPopup().should('be.visible');
56
+ // When I click outside of the popup
57
+ cy.get('body').click();
58
+ // Then the popup should be closed
59
+ SavedQueriesDialog.getSavedQueriesPopup().should('not.exist');
60
+ });
61
+ });
@@ -0,0 +1,41 @@
1
+ import {QueryStubs} from "../../stubs/yasgui/query-stubs";
2
+ import {YasguiSteps} from "../../steps/yasgui/yasgui-steps";
3
+ import {LanguageSelectorSteps} from "../../steps/language-selector-steps";
4
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
5
+ import {YasrSteps} from "../../steps/yasgui/yasr-steps";
6
+ import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
7
+
8
+ describe('Internationalization of ontotext-yasgui-web-component', () => {
9
+
10
+ beforeEach(() => {
11
+ const repositoryId = 'sparql-editor-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
16
+ SparqlEditorSteps.visitSparqlEditorPage();
17
+ });
18
+
19
+ it('Should translate labels when language is changed', () => {
20
+ // When I load page I expect all labels to be translated on the default English language.
21
+ YasguiSteps.getYasguiModeButton().contains('Editor and results');
22
+
23
+ // When I execute a query I expect labels in table plugin to be translated on the default English language.
24
+ YasqeSteps.executeQuery();
25
+
26
+ // Then I expect label in table plugin to be translated on the default English language.
27
+ YasrSteps.getResultFilter().invoke('attr', 'placeholder').should('contain', 'Filter query results');
28
+
29
+ // When I change language to French.
30
+ LanguageSelectorSteps.switchToFr();
31
+ // Yasgui re-renders all DOM elements to shows the new labels. This includes the plugins of yasr which is time-consuming.
32
+ // We have to wait a bit because cypress is too fast and grabs the old element (with the old label) and the test fails.
33
+ cy.wait(500);
34
+
35
+ // Then I expect labels to be translated on French language.
36
+ YasguiSteps.getYasguiModeButton().contains('Éditeur et résultats');
37
+
38
+ // And I expect label in table plugin to be translated on French language.
39
+ YasrSteps.getResultFilter().invoke('attr', 'placeholder').should('contain', 'Filtrer les résultats des requêtes');
40
+ });
41
+ });
@@ -0,0 +1,51 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
3
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
4
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
5
+
6
+ describe('Abort query', () => {
7
+
8
+ const FILE_TO_IMPORT = 'wine.rdf';
9
+ let repositoryId;
10
+
11
+ beforeEach(() => {
12
+ repositoryId = 'sparql-editor-' + Date.now();
13
+ QueryStubs.stubQueryCountResponse();
14
+ cy.createRepository({id: repositoryId});
15
+ cy.presetRepository(repositoryId);
16
+ cy.importServerFile(repositoryId, FILE_TO_IMPORT);
17
+
18
+ SparqlEditorSteps.visitSparqlEditorPage();
19
+ YasguiSteps.getYasgui().should('be.visible');
20
+ });
21
+
22
+ afterEach(() => {
23
+ cy.deleteRepository(repositoryId);
24
+ });
25
+
26
+ it('should abort query when click on "Abort query" button.', () => {
27
+ // When I visit a page with "ontotext-yasgui-web-component" in it,
28
+ // and execute a query that takes a long time.
29
+ YasqeSteps.pasteQuery(
30
+ 'select (count(*) as ?count) where {?s ?p ?o. ?s1 ?p1 ?o1. ?s2 ?p2 ?o2. ?s3 ?p3 ?o3.}');
31
+ YasqeSteps.executeQueryWithoutWaiteResult();
32
+
33
+ // Then I expect to an "Abort query" button to be displayed,
34
+ YasqeSteps.getAbortQueryButton().should('exist');
35
+ // and button has text
36
+ YasqeSteps.getAbortQueryButton().should('have.text', 'Abort query');
37
+
38
+ // When I hover over the "Abort button".
39
+ YasqeSteps.hoverOverAbortQueryButton();
40
+
41
+ // Then I expect to see tooltip that describes what happen if click on it.
42
+ cy.get('div[data-tippy-root]').contains('Click to abort query');
43
+
44
+ // When I click on the button.
45
+ YasqeSteps.getAbortQueryButton().realClick();
46
+
47
+ // When abort query finished.
48
+ // I expect the button not be visible.
49
+ YasqeSteps.getAbortQueryButton().should('not.be.visible');
50
+ });
51
+ });
@@ -0,0 +1,56 @@
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 {SavedQuery} from "../../../steps/yasgui/saved-query";
6
+ import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
7
+ import {SaveQueryDialog} from "../../../steps/yasgui/save-query-dialog";
8
+
9
+ describe('Delete saved queries', () => {
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 delete saved query', () => {
29
+ // Given I have created a query
30
+ const savedQueryName = SavedQuery.generateQueryName();
31
+ SavedQuery.create(savedQueryName);
32
+ SaveQueryDialog.getSaveQueryDialog().should('not.exist');
33
+ YasguiSteps.showSavedQueries();
34
+ SavedQueriesDialog.getSavedQueries().should('contain.text', savedQueryName);
35
+ // When I trigger delete button
36
+ SavedQueriesDialog.deleteQueryByName(savedQueryName);
37
+ // Then I expect a confirmation dialog
38
+ YasguiSteps.getDeleteQueryConfirmation().should('be.visible');
39
+ // When I reject delete operation
40
+ YasguiSteps.rejectDeleteOperation();
41
+ YasguiSteps.getDeleteQueryConfirmation().should('not.exist');
42
+ // Then selected query should not be deleted
43
+ YasguiSteps.showSavedQueries();
44
+ SavedQueriesDialog.getSavedQueries().should('contain.text', savedQueryName);
45
+ // When I trigger delete button again
46
+ SavedQueriesDialog.deleteQueryByName(savedQueryName);
47
+ YasguiSteps.getDeleteQueryConfirmation().should('be.visible');
48
+ // And I confirm delete operation
49
+ YasguiSteps.confirmDeleteOperation();
50
+ // Then selected query should be deleted
51
+ YasguiSteps.getDeleteQueryConfirmation().should('not.exist');
52
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
53
+ YasguiSteps.showSavedQueries();
54
+ SavedQueriesDialog.getSavedQueries().should('not.contain.text', savedQueryName);
55
+ });
56
+ });
@@ -0,0 +1,68 @@
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 {SavedQuery} from "../../../steps/yasgui/saved-query";
5
+ import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
6
+ import {SaveQueryDialog} from "../../../steps/yasgui/save-query-dialog";
7
+
8
+ describe('Edit saved queries', () => {
9
+
10
+ let repositoryId;
11
+
12
+ beforeEach(() => {
13
+ repositoryId = 'sparql-editor-' + Date.now();
14
+ QueryStubs.stubQueryCountResponse();
15
+ cy.createRepository({id: repositoryId});
16
+ cy.presetRepository(repositoryId);
17
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
18
+
19
+ SparqlEditorSteps.visitSparqlEditorPage();
20
+ YasguiSteps.getYasgui().should('be.visible');
21
+ });
22
+
23
+ afterEach(() => {
24
+ cy.deleteRepository(repositoryId);
25
+ });
26
+
27
+ it('Should prevent saving query with duplicated name', () => {
28
+ // Given I have created a query
29
+ const savedQueryName = SavedQuery.generateQueryName();
30
+ SavedQuery.create(savedQueryName);
31
+ // When I open the saved queries popup
32
+ YasguiSteps.showSavedQueries();
33
+ // Then I expect to see the last saved query in the list
34
+ SavedQueriesDialog.getSavedQueries().should('contain', savedQueryName);
35
+ // When I edit the saved query
36
+ SavedQueriesDialog.editQueryByName(savedQueryName);
37
+ // Then I expect that save query dialog should be opened
38
+ SaveQueryDialog.getQueryNameField().should('have.value', savedQueryName);
39
+ SaveQueryDialog.getQueryField().should('have.value', 'select *');
40
+ SaveQueryDialog.getIsPublicField().should('be.checked');
41
+ // When I change the query
42
+ SaveQueryDialog.clearQueryField();
43
+ SaveQueryDialog.writeQuery('select $s $p $o');
44
+ // And try to save the query
45
+ SaveQueryDialog.saveQuery();
46
+ // Then the query should be updated
47
+ SaveQueryDialog.getSaveQueryDialog().should('not.exist');
48
+ YasguiSteps.showSavedQueries();
49
+ SavedQueriesDialog.editQueryByName(savedQueryName);
50
+ SaveQueryDialog.getQueryField().should('have.value', 'select $s $p $o');
51
+ // When I change the query name
52
+ // TODO: This currently won't work. The legacy implementation in the WB does the following:
53
+ // * First POST to create a new query with the new name
54
+ // * Then DELETE the query with the old name
55
+ // This is quite hackish and would require maintaining some state in the WB which is awkward.
56
+ // Better approach would be to think of a way to delegate this to the backend api for the edit.
57
+ // YasguiSteps.clearQueryNameField();
58
+ // savedQueryName = generateQueryName();
59
+ // YasguiSteps.writeQueryName(savedQueryName);
60
+ // YasguiSteps.saveQuery();
61
+ // // Then a new query should be created
62
+ // YasguiSteps.getSaveQueryDialog().should('not.exist');
63
+ // YasguiSteps.showSavedQueries();
64
+ // YasguiSteps.editQueryByName(savedQueryName);
65
+ // YasguiSteps.getQueryNameField().should('have.value', savedQueryName);
66
+ // YasguiSteps.getQueryField().should('have.value', 'select $s $p $o');
67
+ });
68
+ });
@@ -0,0 +1,78 @@
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 {DEFAULT_QUERY, SavedQuery} from "../../../steps/yasgui/saved-query";
6
+ import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
7
+ import {ShareSavedQueryDialog} from "../../../steps/yasgui/share-saved-query-dialog";
8
+
9
+ describe('Share saved queries', () => {
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 get a share link for any saved query', () => {
29
+ // Given I have created a query
30
+ const savedQueryName = SavedQuery.generateQueryName();
31
+ SavedQuery.create(savedQueryName);
32
+ // When I select to share the new saved query
33
+ YasguiSteps.showSavedQueries();
34
+ SavedQueriesDialog.shareQueryByName(savedQueryName);
35
+ // Then I expect that share query dialog will be opened
36
+ ShareSavedQueryDialog.getDialog().should('be.visible');
37
+ ShareSavedQueryDialog.getShareLink().then((shareLink) => {
38
+ expect(shareLink).to.have.string(`/sparql?savedQueryName=${encodeURIComponent(savedQueryName)}`);
39
+ });
40
+ // When I click copy button
41
+ ShareSavedQueryDialog.copyLink();
42
+ // Then I expect link to be copied
43
+ ShareSavedQueryDialog.getDialog().should('not.exist');
44
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
45
+ });
46
+
47
+ it('Should be able to open a share link in a new editor tab', () => {
48
+ // Given I have created a query
49
+ YasguiSteps.getTabs().should('have.length', 1);
50
+ const savedQueryName = SavedQuery.generateQueryName();
51
+ SavedQuery.create(savedQueryName);
52
+ // When I get the shareable link for the query
53
+ YasguiSteps.showSavedQueries();
54
+ SavedQueriesDialog.shareQueryByName(savedQueryName);
55
+ ShareSavedQueryDialog.getDialog().should('be.visible');
56
+ // And I open the link
57
+ ShareSavedQueryDialog.getShareLink().then((shareLink) => {
58
+ cy.visit(shareLink);
59
+ // Then I expect that the sparql view should be opened
60
+ // And the saved query will be loaded in the editor
61
+ YasguiSteps.getTabs().should('have.length', 2);
62
+ YasguiSteps.getCurrentTab().should('contain', savedQueryName);
63
+ YasguiSteps.getTabQuery(0).should('contain', DEFAULT_QUERY);
64
+ // TODO: And the infer should be active
65
+ // TODO: And the expand results should be active
66
+ // When I open the other tab
67
+ // TODO: the next step appears to be flaky with the element is detached error
68
+ // YasguiSteps.openTab(0);
69
+ // YasguiSteps.getCurrentTab().should('contain', 'Unnamed');
70
+ // // And I open the share link again
71
+ // cy.visit(shareLink);
72
+ // // Then I expect that the previously opened tab to be selected instead of opening a new one
73
+ // YasguiSteps.getTabs().should('have.length', 2);
74
+ // YasguiSteps.getCurrentTab().should('contain', savedQueryName);
75
+ // YasguiSteps.getTabQuery(0).should('contain', DEFAULT_QUERY);
76
+ });
77
+ });
78
+ });
@@ -0,0 +1,55 @@
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 {YasrSteps} from "../../steps/yasgui/yasr-steps";
5
+ import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
6
+
7
+ describe('Sparql editor', () => {
8
+ let repositoryId;
9
+ let secondRepositoryId;
10
+
11
+ beforeEach(() => {
12
+ repositoryId = 'sparql-editor-' + Date.now();
13
+ // QueryStubs.stubQueryCountResponse();
14
+ cy.createRepository({id: repositoryId});
15
+ cy.presetRepository(repositoryId);
16
+ });
17
+
18
+ afterEach(() => {
19
+ cy.deleteRepository(repositoryId);
20
+ cy.deleteRepository(secondRepositoryId);
21
+ });
22
+
23
+ it('Should load yasgui with default configuration', () => {
24
+ // Given I have opened the workbench
25
+ // When I visit the sparql editor page
26
+ SparqlEditorSteps.visitSparqlEditorPage();
27
+ // Then I should see the yasgui component
28
+ YasguiSteps.getYasgui().should('be.visible');
29
+ // When I execute the default query
30
+ YasqeSteps.executeQuery();
31
+ // Then I should see the results
32
+ YasrSteps.getResults().should('be.visible').and('have.length.gt', 0);
33
+ });
34
+
35
+ it('Should reset yasgui state when repository is changed', () => {
36
+ // create second repository
37
+ secondRepositoryId = repositoryId + '-second';
38
+ cy.createRepository({id: secondRepositoryId});
39
+ // Given I have opened the sparql editor and executed a query
40
+ SparqlEditorSteps.visitSparqlEditorPage();
41
+ YasguiSteps.getYasgui().should('be.visible');
42
+ YasqeSteps.executeQuery();
43
+ YasrSteps.getResults().should('be.visible');
44
+ // When I change the repository
45
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
46
+ // Then I expect yasgui to be visible
47
+ YasguiSteps.getYasgui().should('be.visible');
48
+ // And yasr results and plugins should not be visible
49
+ YasrSteps.getYasrResultsContainer().should('be.empty');
50
+ // And I should see a warning message that there are no results
51
+ YasrSteps.getNoResultsMessage().should('be.visible');
52
+ // And yasr tabs should not be visible
53
+ YasrSteps.getResultHeader().should('not.be.visible');
54
+ });
55
+ });
@@ -0,0 +1,107 @@
1
+ import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
2
+ import {TabContextMenu, YasguiSteps} from "../../steps/yasgui/yasgui-steps";
3
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
4
+ import {YasrSteps} from "../../steps/yasgui/yasr-steps";
5
+ import {ConfirmationDialogSteps} from "../../steps/yasgui/confirmation-dialog-steps";
6
+ import {QueryStubs} from "../../stubs/yasgui/query-stubs";
7
+
8
+ describe('Yasgui tabs', () => {
9
+
10
+ let repositoryId;
11
+ beforeEach(() => {
12
+ repositoryId = 'sparql-editor-' + Date.now();
13
+ QueryStubs.stubQueryCountResponse();
14
+ cy.createRepository({id: repositoryId});
15
+ cy.presetRepository(repositoryId);
16
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
17
+ });
18
+
19
+ afterEach(() => {
20
+ cy.deleteRepository(repositoryId);
21
+ });
22
+
23
+ it('Should ask for confirmation on tab close', () => {
24
+ // Given I have opened yasgui with a single opened tab
25
+ SparqlEditorSteps.visitSparqlEditorPage();
26
+ // And I have created a second tab
27
+ openNewTab(2);
28
+ // When I close the second tab
29
+ YasguiSteps.closeTab(1);
30
+ // Then I expect a confirmation dialog to be opened
31
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
32
+ ConfirmationDialogSteps.getConfirmation().should('contain.text', 'Are you sure you want to close this query tab?');
33
+ // When I cancel the operation
34
+ ConfirmationDialogSteps.reject();
35
+ ConfirmationDialogSteps.getConfirmation().should('not.exist');
36
+ // Then I expect that to remain opened
37
+ YasguiSteps.getTabs().should('have.length', 2);
38
+ // When I try closing it again
39
+ YasguiSteps.closeTab(1);
40
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
41
+ // And I confirm
42
+ ConfirmationDialogSteps.confirm();
43
+ // Then I expect that the tab will be closed
44
+ YasguiSteps.getTabs().should('have.length', 1);
45
+ YasguiSteps.getCurrentTabTitle().should('have.text', 'Unnamed');
46
+ });
47
+
48
+ it('Should ask for confirmation on tab close through tab context menu', {
49
+ retries: {
50
+ runMode: 1,
51
+ openMode: 0
52
+ }
53
+ }, () => {
54
+ // Given I have opened yasgui with a single opened tab
55
+ SparqlEditorSteps.visitSparqlEditorPage();
56
+ // And I have created a second tab
57
+ openNewTab(2);
58
+ // When I close the second tab
59
+ YasguiSteps.openTabContextMenu(1).should('be.visible');
60
+ TabContextMenu.closeTab();
61
+ // Then I expect a confirmation dialog to be opened
62
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
63
+ // And I confirm
64
+ ConfirmationDialogSteps.confirm();
65
+ // Then I expect that the tab will be closed
66
+ YasguiSteps.getTabs().should('have.length', 1);
67
+ YasguiSteps.getCurrentTabTitle().should('have.text', 'Unnamed');
68
+ });
69
+
70
+ it('Should ask for confirmation on close other tabs action', {
71
+ retries: {
72
+ runMode: 1,
73
+ openMode: 0
74
+ }
75
+ }, () => {
76
+ // Given I have opened yasgui with a single opened tab
77
+ SparqlEditorSteps.visitSparqlEditorPage();
78
+ // And I have created more tabs
79
+ openNewTab(2);
80
+ // When I try closing all other tabs but the last one
81
+ YasguiSteps.openTabContextMenu(1).should('be.visible');
82
+ TabContextMenu.closeOtherTabs();
83
+ // Then I expect a confirmation dialog to be opened
84
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
85
+ ConfirmationDialogSteps.getConfirmation().should('contain.text', 'Are you sure you want to close all other query tabs?');
86
+ // When I cancel the operation
87
+ ConfirmationDialogSteps.reject();
88
+ ConfirmationDialogSteps.getConfirmation().should('not.exist');
89
+ // Then I expect that to remain opened
90
+ YasguiSteps.getTabs().should('have.length', 2);
91
+ YasguiSteps.openTabContextMenu(1).should('be.visible');
92
+ TabContextMenu.closeOtherTabs();
93
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
94
+ // And I confirm
95
+ ConfirmationDialogSteps.confirm();
96
+ // Then I expect that the tab will be closed
97
+ YasguiSteps.getTabs().should('have.length', 1);
98
+ YasguiSteps.getCurrentTabTitle().should('have.text', 'Unnamed 1');
99
+ });
100
+ });
101
+
102
+ function openNewTab(expectedTabsCount) {
103
+ YasguiSteps.openANewTab();
104
+ YasguiSteps.getTabs().should('have.length', expectedTabsCount);
105
+ // Execute the query for a bit of delay before closing the tab
106
+ YasqeSteps.executeQuery();
107
+ }
@@ -0,0 +1,54 @@
1
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
2
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
3
+ import {YasrSteps} from "../../../steps/yasgui/yasr-steps";
4
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
5
+
6
+ describe('Download results', () => {
7
+ let repositoryId;
8
+ beforeEach(() => {
9
+ repositoryId = 'sparql-editor-' + Date.now();
10
+ QueryStubs.stubQueryCountResponse();
11
+ cy.createRepository({id: repositoryId});
12
+ cy.presetRepository(repositoryId);
13
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
14
+ // Given I visit a page with "ontotex-yasgu-web-component" in it.
15
+ SparqlEditorSteps.visitSparqlEditorPage();
16
+ });
17
+
18
+ afterEach(() => {
19
+ cy.deleteRepository(repositoryId);
20
+ });
21
+
22
+ describe('DownloadAs button', () => {
23
+ it('should not be visible if query is not ran', () => {
24
+ // When yasr has not result
25
+ // Then download dropdown should not be visible.
26
+ YasrSteps.getDownloadAsDropdown().should('not.be.visible');
27
+ });
28
+
29
+ it('Should "Download as" dropdown be visible if there is results', () => {
30
+ // When execute a query witch returns results.
31
+ YasqeSteps.executeQuery();
32
+
33
+ // Then "Download as" dropdown should be visible.
34
+ YasrSteps.getDownloadAsDropdown().should('be.visible');
35
+ });
36
+
37
+ it('should contains following dropdown option.', () => {
38
+ // When execute a query witch returns results.
39
+ YasqeSteps.executeQuery();
40
+ // And open the download button.
41
+ YasrSteps.openDownloadAsDropdown();
42
+
43
+ // Then expect follow options to be present.
44
+ YasrSteps.getDownloadAsOption(0).contains('JSON');
45
+ YasrSteps.getDownloadAsOption(1).contains( 'JSON*');
46
+ YasrSteps.getDownloadAsOption(2).contains( 'XML');
47
+ YasrSteps.getDownloadAsOption(3).contains( 'XML*');
48
+ YasrSteps.getDownloadAsOption(4).contains( 'CSV');
49
+ YasrSteps.getDownloadAsOption(5).contains( 'TSV');
50
+ YasrSteps.getDownloadAsOption(6).contains( 'TSV*');
51
+ YasrSteps.getDownloadAsOption(7).contains( 'Binary RDF Results');
52
+ });
53
+ });
54
+ });