graphdb-workbench-tests 2.7.6 → 2.8.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 (119) hide show
  1. package/cypress.config.js +3 -0
  2. package/fixtures/cluster/2-nodes-cluster-group-status-deleted.json +30 -0
  3. package/fixtures/cluster/2-nodes-cluster-group-status.json +30 -0
  4. package/fixtures/cluster/3-nodes-cluster-group-status-after-replace.json +44 -0
  5. package/fixtures/cluster/3-nodes-cluster-group-status-building-snapshot.json +4 -1
  6. package/fixtures/cluster/3-nodes-cluster-group-status-receiving-snapshot.json +4 -1
  7. package/fixtures/cluster/3-nodes-cluster-group-status-sending-snapshot.json +4 -1
  8. package/fixtures/cluster/3-nodes-cluster-group-status-waiting-for-snapshot.json +4 -1
  9. package/fixtures/cluster/3-nodes-cluster-group-status.json +12 -3
  10. package/fixtures/cluster/4-nodes-cluster-group-status.json +58 -0
  11. package/fixtures/cluster/cluster-config.json +1 -0
  12. package/fixtures/cluster/cluster-node-status.json +4 -1
  13. package/fixtures/connectors/get-connectors.json +8 -0
  14. package/fixtures/connectors/get-retrieval-connector-0.json +1 -0
  15. package/fixtures/connectors/get-retrieval-connector.json +29 -0
  16. package/fixtures/connectors/get-ttyg-chatgpt-connectors.json +188 -0
  17. package/fixtures/locale-en.json +630 -61
  18. package/fixtures/namespaces/get-repository-starwars-namespaces.json +252 -0
  19. package/fixtures/remote-location/get-0-remote-locations.json +1 -2
  20. package/fixtures/remote-location/get-1-remote-locations.json +2 -4
  21. package/fixtures/remote-location/get-2-remote-locations.json +3 -6
  22. package/fixtures/remote-location/get-3-remote-locations.json +4 -8
  23. package/fixtures/remote-location/get-4-remote-locations.json +54 -0
  24. package/fixtures/remote-location/remote-location-status-in-cluster.json +1 -2
  25. package/fixtures/remote-location/remote-location-status-not-in-cluster.json +1 -2
  26. package/fixtures/remote-location/remote-locations-filter.json +1 -2
  27. package/fixtures/repositories/get-locations.json +67 -0
  28. package/fixtures/repositories/get-repositories.json +106 -0
  29. package/fixtures/repositories/get-repository-config-starwars-disabled-fts.json +201 -0
  30. package/fixtures/repositories/get-repository-config-starwars-enabled-fts.json +201 -0
  31. package/fixtures/repositories/get-ttyg-repositories.json +74 -0
  32. package/fixtures/similarity/get-similarity-indexes-0.json +1 -0
  33. package/fixtures/similarity/get-similarity-indexes.json +15 -0
  34. package/fixtures/similarity/get-ttyg-similarity-connectors.json +46 -0
  35. package/fixtures/ttyg/agent/create-agent.json +20 -0
  36. package/fixtures/ttyg/agent/get-agent-defaults.json +42 -0
  37. package/fixtures/ttyg/agent/get-agent-list-0.json +1 -0
  38. package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +56 -0
  39. package/fixtures/ttyg/agent/get-agent-list-new-agent.json +22 -0
  40. package/fixtures/ttyg/agent/get-agent-list.json +77 -0
  41. package/fixtures/ttyg/agent/get-agent.json +25 -0
  42. package/fixtures/ttyg/chats/ask-question.json +25 -0
  43. package/fixtures/ttyg/chats/create/create-chat-response.json +16 -0
  44. package/fixtures/ttyg/chats/create/get-chats-after-create.json +12 -0
  45. package/fixtures/ttyg/chats/create/get-chats-before-create.json +7 -0
  46. package/fixtures/ttyg/chats/deleted-chat.json +3 -0
  47. package/fixtures/ttyg/chats/explain-response-1.json +59 -0
  48. package/fixtures/ttyg/chats/explain-response-2.json +59 -0
  49. package/fixtures/ttyg/chats/export-chat.json +34 -0
  50. package/fixtures/ttyg/chats/get-chat-list-0.json +1 -0
  51. package/fixtures/ttyg/chats/get-chat-list-with-deleted-chat.json +17 -0
  52. package/fixtures/ttyg/chats/get-chat-list-with-renamed-chat.json +22 -0
  53. package/fixtures/ttyg/chats/get-chat-list.json +22 -0
  54. package/fixtures/ttyg/chats/get-chat.json +199 -0
  55. package/fixtures/ttyg/chats/renamed-chat.json +4 -0
  56. package/integration/cluster/cluster-management.spec.js +0 -170
  57. package/integration/cluster/edit-cluster-nodes-modal.spec.js +425 -0
  58. package/integration/explore/graphs.overview.spec.js +4 -0
  59. package/integration/home/cookie-policy.spec.js +65 -0
  60. package/integration/home/create-repository.spec.js +35 -0
  61. package/integration/home/documentation-link.spec.js +60 -0
  62. package/integration/home/google-analytics.spec.js +60 -0
  63. package/integration/home/language-selector.spec.js +19 -0
  64. package/integration/home/rdf-resource-search.spec.js +192 -0
  65. package/integration/home/view-resource-autocomplete.spec.js +52 -0
  66. package/integration/home/workbench.home.spec.js +1 -277
  67. package/integration/import/import-user-data-file-upload.spec.js +13 -0
  68. package/integration/import/import-user-data.spec.js +8 -2
  69. package/integration/import/import-view.spec.js +6 -1
  70. package/integration/repository/attach-remote-location.spec.js +203 -0
  71. package/integration/repository/ontop-repository.spec.js +87 -1
  72. package/integration/repository/repositories.spec.js +4 -19
  73. package/integration/setup/my-settings.spec.js +2 -0
  74. package/integration/ttyg/agent-list.spec.js +76 -0
  75. package/integration/ttyg/agent-select-menu.spec.js +141 -0
  76. package/integration/ttyg/chat-list.spec.js +286 -0
  77. package/integration/ttyg/chat-panel.spec.js +175 -0
  78. package/integration/ttyg/clone-agent.spec.js +75 -0
  79. package/integration/ttyg/create-agent.spec.js +560 -0
  80. package/integration/ttyg/create-chat.spec.js +69 -0
  81. package/integration/ttyg/delete-agent.spec.js +51 -0
  82. package/integration/ttyg/edit-agent.spec.js +54 -0
  83. package/integration/ttyg/ttyg-permission.spec.js +66 -0
  84. package/integration/ttyg/ttyg-view.spec.js +75 -0
  85. package/npm-shrinkwrap.json +215 -220
  86. package/package.json +5 -6
  87. package/steps/alert-dialog-steps.js +25 -0
  88. package/steps/cluster/cluster-page-steps.js +8 -0
  89. package/steps/cluster/custer-nodes-configuration-steps.js +107 -0
  90. package/steps/home-steps.js +48 -5
  91. package/steps/import/import-steps.js +11 -11
  92. package/steps/modal-dialog-steps.js +8 -0
  93. package/steps/ontop-repository-steps.js +26 -0
  94. package/steps/repositories/attach-repository-steps.js +118 -0
  95. package/steps/repository-steps.js +53 -5
  96. package/steps/setup/settings-steps.js +17 -0
  97. package/steps/ttyg/chat-panel-steps.js +62 -0
  98. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +462 -0
  99. package/steps/ttyg/ttyg-view-steps.js +333 -0
  100. package/steps/window-steps.js +5 -0
  101. package/stubs/cluster/cluster-stubs.js +127 -7
  102. package/stubs/cluster/remote-location-stubs.js +46 -0
  103. package/stubs/connector-stubs.js +39 -0
  104. package/stubs/environment-stubs.js +27 -0
  105. package/stubs/license-stubs.js +101 -0
  106. package/stubs/repositories/repositories-stubs.js +133 -0
  107. package/stubs/repositories-stub.js +15 -0
  108. package/stubs/security-stubs.js +7 -0
  109. package/stubs/similarity-index-stubs.js +32 -0
  110. package/stubs/stubs.js +4 -0
  111. package/stubs/ttyg/ttyg-stubs.js +166 -0
  112. package/support/commands.js +2 -0
  113. package/support/index.js +17 -0
  114. package/support/security-command.js +25 -0
  115. package/support/settings-commands.js +4 -5
  116. package/support/user-commands.js +31 -0
  117. package/steps/cluster/add-remote-location-dialog-steps.js +0 -11
  118. package/steps/cluster/create-cluster-dialog-steps.js +0 -39
  119. package/steps/cluster/replace-nodes-dialog-steps.js +0 -39
@@ -0,0 +1,65 @@
1
+ import HomeSteps from '../../steps/home-steps';
2
+ import {EnvironmentStubs} from "../../stubs/environment-stubs";
3
+ import {SecurityStubs} from "../../stubs/security-stubs";
4
+ import {SettingsSteps} from "../../steps/setup/settings-steps";
5
+
6
+ describe('Cookie policy', () => {
7
+ beforeEach(() => {
8
+ cy.setDefaultUserData(false);
9
+ cy.viewport(1280, 1000);
10
+ });
11
+
12
+ afterEach(() => cy.setDefaultUserData());
13
+
14
+ it('Should show consent popup to user', () => {
15
+ HomeSteps.visit();
16
+ EnvironmentStubs.stubWbProdMode();
17
+ HomeSteps.getCookieConsentPopup().should('exist').and('be.visible');
18
+ // When I click on the link
19
+ HomeSteps.clickCookiePolicyLink();
20
+ // Then I see the cookie policy
21
+ HomeSteps.getCookiePolicyModal().should('exist').and('be.visible');
22
+ });
23
+
24
+ it('Should show cookie policy to user in user settings', () => {
25
+ SettingsSteps.visit();
26
+ EnvironmentStubs.stubWbProdMode();
27
+ SettingsSteps.getCookiePolicyLink().should('exist').and('be.visible');
28
+
29
+ // When I click on the link
30
+ SettingsSteps.clickCookiePolicyLink();
31
+ // Then I see the cookie policy
32
+ SettingsSteps.getCookiePolicyModal().should('exist').and('be.visible');
33
+ });
34
+
35
+ it('Should NOT show consent popup to user when tracking is not applicable', () => {
36
+ HomeSteps.visit();
37
+ HomeSteps.getCookieConsentPopup().should('not.exist');
38
+ });
39
+
40
+ it('Should NOT show cookie policy to user when tracking is not applicable', () => {
41
+ SettingsSteps.visit();
42
+ SettingsSteps.getCookiePolicyLink().should('not.exist');
43
+ });
44
+
45
+ it('Should save consent in user settings', () => {
46
+ HomeSteps.visit();
47
+ EnvironmentStubs.stubWbProdMode();
48
+ SecurityStubs.stubUpdateUserData('admin');
49
+
50
+ // When I click Agree button
51
+ HomeSteps.clickAgreeButton();
52
+
53
+ // I expect to save cookie consent in user settings
54
+ cy.wait('@updateUser').then((xhr) => {
55
+ expect(xhr.request.body.appSettings).to.deep.eq({
56
+ "DEFAULT_INFERENCE": true,
57
+ "DEFAULT_VIS_GRAPH_SCHEMA": true,
58
+ "DEFAULT_SAMEAS": true,
59
+ "IGNORE_SHARED_QUERIES": false,
60
+ "EXECUTE_COUNT": true,
61
+ "COOKIE_CONSENT": true
62
+ });
63
+ });
64
+ });
65
+ });
@@ -0,0 +1,35 @@
1
+ import HomeSteps from '../../steps/home-steps';
2
+
3
+ describe('Create repository', () => {
4
+
5
+ beforeEach(() => {
6
+ cy.viewport(1280, 1000);
7
+ HomeSteps.visitAndWaitLoader();
8
+ });
9
+
10
+ it('Test create and select new repository via home page', () => {
11
+ HomeSteps.verifyCreateRepositoryLink();
12
+
13
+ const repositoryId = HomeSteps.createRepo();
14
+ // Initializing the repository to speed up retrieving repository info
15
+ cy.initializeRepository(repositoryId);
16
+
17
+ HomeSteps.selectRepo(repositoryId);
18
+ HomeSteps.verifyRepositoryIsSelected(repositoryId);
19
+ HomeSteps.hasRepositoryInfo(repositoryId);
20
+
21
+ cy.deleteRepository(repositoryId);
22
+ });
23
+
24
+ it('Test saved SPARQL queries links on home page and confirm dialog appearance', () => {
25
+ const repositoryId = HomeSteps.createRepo();
26
+ HomeSteps.selectRepo(repositoryId);
27
+
28
+ HomeSteps.verifyQueryLink('Add statements', true);
29
+ HomeSteps.verifyQueryLink('Clear graph', true);
30
+ HomeSteps.verifyQueryLink('Remove statements', true);
31
+ HomeSteps.verifyQueryLink('SPARQL Select template', false);
32
+
33
+ cy.deleteRepository(repositoryId);
34
+ });
35
+ });
@@ -0,0 +1,60 @@
1
+ import HomeSteps from '../../steps/home-steps';
2
+ import {EnvironmentStubs} from "../../stubs/environment-stubs";
3
+
4
+ describe('Documentation links resolver', () => {
5
+
6
+ beforeEach(() => {
7
+ cy.viewport(1280, 1000);
8
+ });
9
+
10
+ it('Should link to master version when in dev mode', () => {
11
+ HomeSteps.visit();
12
+ EnvironmentStubs.stubWbDevMode();
13
+ HomeSteps.clickHelpMenu();
14
+ // Assert that links point to the master version
15
+ assertDocumentationLinks('master');
16
+ });
17
+
18
+ it('Should link to master version when in prod mode and unofficial version', () => {
19
+ EnvironmentStubs.stubProductInfo('10.8-TR1-test');
20
+ HomeSteps.visit();
21
+ EnvironmentStubs.stubWbProdMode();
22
+ HomeSteps.clickHelpMenu();
23
+ // Assert that links point to the master version
24
+ assertDocumentationLinks('master');
25
+ });
26
+
27
+ it('Should link to GDB version when in prod mode and official version', () => {
28
+ EnvironmentStubs.stubProductInfo('10.8');
29
+ HomeSteps.visit();
30
+ EnvironmentStubs.stubWbProdMode();
31
+ HomeSteps.clickHelpMenu();
32
+ // Assert that links point to the specific GDB version
33
+ assertDocumentationLinks('10.8');
34
+ });
35
+ });
36
+
37
+ function assertDocumentationLinks(version) {
38
+ const baseUrl = `https://graphdb.ontotext.com/documentation/${version}`;
39
+
40
+ HomeSteps.getDocumentationLink()
41
+ .should('exist')
42
+ .and('be.visible')
43
+ .find('a')
44
+ .should('have.attr', 'href', `${baseUrl}/index.html`)
45
+ .and('contain.text', 'Documentation');
46
+
47
+ HomeSteps.getTutorialsLink()
48
+ .should('exist')
49
+ .and('be.visible')
50
+ .find('a')
51
+ .should('have.attr', 'href', `${baseUrl}/tutorials.html`)
52
+ .and('contain.text', 'Tutorials');
53
+
54
+ HomeSteps.getSupportLink()
55
+ .should('exist')
56
+ .and('be.visible')
57
+ .find('a')
58
+ .should('have.attr', 'href', `${baseUrl}/support.html`)
59
+ .and('contain.text', 'Support');
60
+ }
@@ -0,0 +1,60 @@
1
+ import HomeSteps from '../../steps/home-steps';
2
+ import {LicenseStubs} from "../../stubs/license-stubs";
3
+ import {EnvironmentStubs} from "../../stubs/environment-stubs";
4
+
5
+ describe('Google analytics', () => {
6
+
7
+ beforeEach(() => {
8
+ cy.viewport(1280, 1000);
9
+ });
10
+
11
+ // Note: Google API calls are stubbed for all specs in support/index.js
12
+ it('Should set GA tracking code in header and a cookie when free license and prodMode', () => {
13
+ LicenseStubs.stubFreeLicense();
14
+ HomeSteps.visit();
15
+ EnvironmentStubs.stubWbProdMode();
16
+
17
+ cy.document()
18
+ .get('head script')
19
+ .should("have.attr", "src")
20
+ .should('include', 'https://www.googletagmanager.com/gtm.js?id=GTM-WBP6C6Z4');
21
+
22
+ // Check if the installation ID cookie is set correctly
23
+ cy.getCookie('_wb').then((cookie) => {
24
+ expect(cookie).to.exist;
25
+ expect(cookie.value).to.match(/^WB1\.[a-zA-Z0-9\-]+\.\d+$/); // Check the cookie structure: WB1.<installationId>.<timestamp>
26
+ });
27
+ });
28
+
29
+ it('Should set GA tracking code in header and cookie when evaluation enterprise license and prodMode', () => {
30
+ LicenseStubs.stubEvaluationLicense();
31
+ HomeSteps.visit();
32
+ EnvironmentStubs.stubWbProdMode();
33
+
34
+ cy.document()
35
+ .get('head script')
36
+ .should("have.attr", "src")
37
+ .should('include', 'https://www.googletagmanager.com/gtm.js?id=GTM-WBP6C6Z4');
38
+
39
+ // Check if the installation ID cookie is set correctly
40
+ cy.getCookie('_wb').then((cookie) => {
41
+ expect(cookie).to.exist;
42
+ expect(cookie.value).to.match(/^WB1\.[a-zA-Z0-9\-]+\.\d+$/); // Check the cookie structure: WB1.<installationId>.<timestamp>
43
+ });
44
+ });
45
+
46
+ it('Should NOT set GA tracking code in header and cookie when enterprise license in prodMode', () => {
47
+ LicenseStubs.stubEnterpriseLicense();
48
+ HomeSteps.visit();
49
+ EnvironmentStubs.stubWbProdMode();
50
+
51
+ cy.document()
52
+ .get('head script')
53
+ .should("not.have.attr", "src");
54
+
55
+ // Check if the installation ID cookie is set correctly
56
+ cy.getCookie('_wb').then((cookie) => {
57
+ expect(cookie).to.not.exist;
58
+ });
59
+ });
60
+ });
@@ -0,0 +1,19 @@
1
+ import HomeSteps from '../../steps/home-steps';
2
+
3
+ describe('Language selector', () => {
4
+
5
+ beforeEach(() => {
6
+ cy.viewport(1280, 1000);
7
+ HomeSteps.visitAndWaitLoader();
8
+ });
9
+
10
+ it('Should be able to change the language', () => {
11
+ cy.get('#languageGroupDrop')
12
+ .should('be.visible')
13
+ .click()
14
+ .then(() => {
15
+ cy.get('.dropdown-menu .dropdown-item')
16
+ .should('have.length.at.least', 1);
17
+ });
18
+ });
19
+ });
@@ -0,0 +1,192 @@
1
+ import HomeSteps from '../../steps/home-steps';
2
+
3
+ const FILE_TO_IMPORT = 'wine.rdf';
4
+
5
+ describe('RDF resource search', () => {
6
+
7
+ beforeEach(() => {
8
+ cy.viewport(1280, 1000);
9
+ });
10
+
11
+ it('Search button should not be present when no repo is selected', () => {
12
+ HomeSteps.visitAndWaitLoader();
13
+ cy.get('.search-rdf-btn').should('not.exist');
14
+ cy.get('.search-rdf-input').should('not.exist');
15
+ });
16
+
17
+ it('Search should be made from home page search when repo is set and on home page', () => {
18
+ const repositoryId = '23repo' + Date.now();
19
+ cy.createRepository({id: repositoryId});
20
+ cy.initializeRepository(repositoryId);
21
+ cy.enableAutocomplete(repositoryId);
22
+ cy.presetRepository(repositoryId);
23
+
24
+ // When I visit home page with selected repository
25
+ HomeSteps.visitAndWaitLoader();
26
+ // Search rdf button should be visible
27
+ cy.get('.search-rdf-btn').should('be.visible');
28
+ // When I click the button
29
+ HomeSteps.doNotOpenRdfSearchBoxButFocusResourceSearch();
30
+ // I should be able to type some text in the input on home page
31
+ cy.get('#search-resource-input-home > #search-resource-box > input').type('hasPos');
32
+ // And the autocomplete dropdown should become visible
33
+ cy.get('#search-resource-input-home > #auto-complete-results-wrapper').should('be.visible');
34
+ // // When I click the close button
35
+ cy.get('#search-resource-input-home > #search-resource-box > .clear-icon').click();
36
+ // // The input should be cleared
37
+ cy.get('#search-resource-input-home > #search-resource-box > input').should('have.value', '');
38
+
39
+ cy.deleteRepository(repositoryId);
40
+ });
41
+
42
+ it('Search should be present when repo is set', () => {
43
+ const repositoryId = '23repo' + Date.now();
44
+ cy.createRepository({id: repositoryId});
45
+ cy.initializeRepository(repositoryId);
46
+ cy.enableAutocomplete(repositoryId);
47
+ cy.presetRepository(repositoryId);
48
+
49
+ // When I visit not home page with selected repository
50
+ cy.visit('/graphs');
51
+ cy.get('.ot-splash').should('not.be.visible');
52
+ cy.get('.ot-loader-new-content').should('not.exist');
53
+ // Search rdf button should be visible
54
+ cy.get('.search-rdf-btn').should('be.visible');
55
+ // When I click the button
56
+ HomeSteps.openRdfSearchBox();
57
+ // I should be able to type some text in the input
58
+ cy.get('.search-rdf-input search-resource-input .view-res-input').type('hasPos');
59
+ // And the autocomplete dropdown should become visible
60
+ cy.get('.search-rdf-input #auto-complete-results-wrapper').should('be.visible');
61
+ // When I click the close button
62
+ cy.get('.close-rdf-search-btn').click();
63
+ // The input should not be cleared
64
+ cy.get('.search-rdf-input search-resource-input .view-res-input').should('have.value', 'hasPos');
65
+ // And the search bar should hide and not be visible
66
+ cy.get('.search-rdf-input').should('not.be.visible');
67
+ // And the suggestions list should not be visible
68
+ cy.get('.search-rdf-input #auto-complete-results-wrapper').should('not.be.visible');
69
+ // And the search button should be visible
70
+ cy.get('.search-rdf-btn').should('be.visible');
71
+ // When I open again the search box
72
+ HomeSteps.openRdfSearchBox();
73
+ // The input should have value 'hasPos'
74
+ cy.get('.search-rdf-input search-resource-input .view-res-input').should('have.value', 'hasPos');
75
+ // And dropdown should be visible
76
+ cy.get('.search-rdf-input #auto-complete-results-wrapper').should('be.visible');
77
+ // When I press 'escape'
78
+ cy.get('.search-rdf-input search-resource-input .view-res-input').type('{esc}');
79
+ // Search box should not be visible
80
+ cy.get('.search-rdf-input').should('not.be.visible');
81
+
82
+ cy.deleteRepository(repositoryId);
83
+ });
84
+
85
+ it('Search should be persisted on page reload', () => {
86
+ const repositoryId = '23repo' + Date.now();
87
+ cy.createRepository({id: repositoryId});
88
+ cy.initializeRepository(repositoryId);
89
+ cy.enableAutocomplete(repositoryId);
90
+ cy.presetRepository(repositoryId);
91
+
92
+ cy.visit('/graphs', {
93
+ onBeforeLoad(win) {
94
+ cy.stub(win, 'open').as('window.open');
95
+ }
96
+ });
97
+ cy.get('.ot-splash').should('not.be.visible');
98
+ cy.get('.ot-loader-new-content').should('not.exist');
99
+ // Search rdf button should be visible
100
+ cy.get('.search-rdf-btn').should('be.visible');
101
+ // When I click the button
102
+ HomeSteps.openRdfSearchBox();
103
+ // I should be able to type some text in the input
104
+ cy.get('.search-rdf-input search-resource-input .view-res-input')
105
+ .type('hasPos').then(() => {
106
+ // When I select option from suggestions
107
+ cy.get(".search-rdf-input #auto-complete-results-wrapper p")
108
+ .contains('hasPos')
109
+ .click()
110
+ .then(() => {
111
+ // Search result should be opened in new window
112
+ cy.get('@window.open').should('be.calledWith', 'resource?uri=http%3A%2F%2Fwww.w3.org%2Fns%2Forg%23hasPost');
113
+ });
114
+ });
115
+
116
+ // When I revisit the home page
117
+ cy.visit('/graphs');
118
+ // When I open again the search box
119
+ HomeSteps.openRdfSearchBox();
120
+ // The input should have value 'hasPos' from previous search
121
+ cy.get('.search-rdf-input search-resource-input .view-res-input').should('have.value', 'hasPos');
122
+ // And dropdown should be visible
123
+ cy.get('.search-rdf-input #auto-complete-results-wrapper').should('be.visible');
124
+ // When I press 'escape'
125
+ cy.get('.search-rdf-input search-resource-input .view-res-input')
126
+ .type('{esc}')
127
+ .then(() => {
128
+ // Search box should not be visible
129
+ cy.get('.search-rdf-input').should('not.be.visible');
130
+ });
131
+
132
+ cy.deleteRepository(repositoryId);
133
+ });
134
+
135
+ it('Should test RDF resource search box', () => {
136
+ //Prepare repository, autocomplete and import data.
137
+ const repositoryId = 'repository-' + Date.now();
138
+ cy.createRepository({id: repositoryId});
139
+ cy.initializeRepository(repositoryId);
140
+ cy.presetRepository(repositoryId);
141
+ cy.importServerFile(repositoryId, FILE_TO_IMPORT);
142
+ cy.enableAutocomplete(repositoryId);
143
+ HomeSteps.visitAndWaitLoader();
144
+
145
+ //Verify that the main resource search box is focused
146
+ getRDFResourceSearchBox().click();
147
+ cy.focused().should('have.attr', 'placeholder', 'Search RDF resources...');
148
+
149
+ //Navigate away from the Homepage, to be able to test the new resource search box
150
+ cy.visit('/graphs', {
151
+ onBeforeLoad(win) {
152
+ cy.stub(win, 'open').as('window.open');
153
+ }
154
+ });
155
+
156
+ cy.get('.ot-splash').should('not.be.visible');
157
+ cy.get('.ot-loader-new-content').should('not.exist');
158
+
159
+ getRDFResourceSearchBox().click();
160
+ //Verify that the new resource search box is focused
161
+ cy.focused().should('have.attr', 'placeholder', 'Search RDF resources...');
162
+
163
+ //Verify autocomplete suggestions count
164
+ cy.focused().then(() => {
165
+ cy.get('#search-resource-box input')
166
+ .should('be.visible')
167
+ .type('Dry');
168
+ cy.get('#auto-complete-results-wrapper')
169
+ .should('be.visible')
170
+ .children()
171
+ .should('have.length', 7);
172
+ });
173
+
174
+ //Test table and visual buttons.
175
+ cy.get("#auto_0").should('be.visible').click();
176
+ // Search result should be opened in new window
177
+ cy.get('@window.open').should('be.calledWith', 'resource?uri=http%3A%2F%2Fwww.w3.org%2FTR%2F2003%2FPR-owl-guide-20031209%2Fwine%23Dry');
178
+
179
+ getVisualButton().click();
180
+ cy.get("#auto_0").should('be.visible').click();
181
+ cy.get('@window.open').should('be.calledWith', 'graphs-visualizations?uri=http%3A%2F%2Fwww.w3.org%2FTR%2F2003%2FPR-owl-guide-20031209%2Fwine%23Dry');
182
+ cy.deleteRepository(repositoryId);
183
+ });
184
+ });
185
+
186
+ function getRDFResourceSearchBox() {
187
+ return cy.get('rdf-resource-search').should('be.visible');
188
+ }
189
+
190
+ function getVisualButton() {
191
+ return cy.get('.display-type-visual-btn').should('be.visible');
192
+ }
@@ -0,0 +1,52 @@
1
+ import HomeSteps from '../../steps/home-steps';
2
+
3
+ describe('View resource autocomplete', () => {
4
+
5
+ const FOAT_SNIPPET = '@base <http://example.org/> .\n' +
6
+ '@prefix foaf: <http://xmlns.com/foaf/0.1/> .\n' +
7
+ '<#green-goblin>\n' +
8
+ 'a foaf:Person ; # in the context of the Marvel universe\n' +
9
+ 'foaf:name "Green Goblin" .\n';
10
+ const GOBLIN_URI = 'http://example.org/#green-goblin';
11
+
12
+ beforeEach(() => {
13
+ cy.viewport(1280, 1000);
14
+ });
15
+
16
+ it('Test homepage autocomplete when it is enabled', () => {
17
+ const repositoryId = HomeSteps.createRepo();
18
+ HomeSteps.selectRepo(repositoryId);
19
+
20
+ // Type an invalid resource
21
+ HomeSteps.getAutocompleteInput().type('hfsafa');
22
+ HomeSteps.noAutocompleteToast();
23
+
24
+ cy.importRDFTextSnippet(repositoryId, FOAT_SNIPPET);
25
+ cy.enableAutocomplete(repositoryId);
26
+
27
+ HomeSteps.visitAndWaitLoader(true).then((el) => el)
28
+ .then(() => HomeSteps.getAutocompleteDisplayTypeButton('table').click())
29
+ .then(() => HomeSteps.autocompleteText('Green', GOBLIN_URI))
30
+ .then(() => HomeSteps.getAutocompleteResultElement(GOBLIN_URI).click())
31
+ .then(() => // Search result should be opened in new window
32
+ cy.get('@window.open').should('be.calledWith', 'resource?uri=http%3A%2F%2Fexample.org%2F%23green-goblin'))
33
+ .then(() => HomeSteps.getAutocompleteDisplayTypeButton('visual').click())
34
+ .then(() => HomeSteps.getAutocompleteResultElement(GOBLIN_URI).click())
35
+ .then(() => // Search result should be opened in new window
36
+ cy.get('@window.open').should('be.calledWith', 'graphs-visualizations?uri=http%3A%2F%2Fexample.org%2F%23green-goblin'));
37
+ cy.deleteRepository(repositoryId);
38
+ });
39
+
40
+ it('should not suggest resources in "View resources" when autocomplete is not enabled', () => {
41
+ const repositoryId = HomeSteps.createRepo();
42
+ cy.importRDFTextSnippet(repositoryId, FOAT_SNIPPET);
43
+
44
+ HomeSteps.visitAndWaitLoader();
45
+ HomeSteps.selectRepo(repositoryId);
46
+
47
+ HomeSteps.getAutocompleteInput().type('Green');
48
+ HomeSteps.noAutocompleteToast();
49
+
50
+ cy.deleteRepository(repositoryId);
51
+ });
52
+ });