graphdb-workbench-tests 4.0.0-reactodia-blank-nodes-TR3 → 4.0.0-revert-explain-query-tests

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 (34) hide show
  1. package/e2e-flaky/import/import-server-files-operations.spec.js +9 -9
  2. package/e2e-flaky/import/import-user-data-batch-operations.spec.js +7 -7
  3. package/e2e-flaky/import/import-user-data-url.spec.js +1 -1
  4. package/e2e-legacy/cluster/cluster-configuration/cluster-configuration-multi-region.spec.js +20 -0
  5. package/e2e-legacy/guides/import-rdf-file/confirm-duplicate-rdf-file.spec.js +1 -1
  6. package/e2e-legacy/guides/main-menu/main-menu-guide.spec.js +6 -14
  7. package/e2e-legacy/guides/ttyg/configure-agent/configure-agent-guide.spec.js +26 -30
  8. package/e2e-legacy/guides/ttyg/edit-agent/edit-ttyg-agent-guide.spec.js +12 -20
  9. package/e2e-legacy/import/import-server-files-batch-operations.spec.js +5 -5
  10. package/e2e-legacy/import/import-server-files.spec.js +23 -23
  11. package/e2e-legacy/import/import-user-data-file-upload.spec.js +21 -21
  12. package/e2e-legacy/import/import-user-data-text-snippet.spec.js +8 -8
  13. package/e2e-legacy/import/import-user-data-url.spec.js +3 -3
  14. package/e2e-legacy/import/import-view.spec.js +2 -2
  15. package/e2e-legacy/repository/rename-repository-restrictions.spec.js +125 -0
  16. package/e2e-legacy/repository/repositories.spec.js +3 -3
  17. package/e2e-legacy/resource/resource.spec.js +4 -17
  18. package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +18 -19
  19. package/e2e-legacy/ttyg/create-agent.spec.js +6 -4
  20. package/e2e-legacy/ttyg/edit-agent.spec.js +57 -0
  21. package/e2e-legacy/ttyg/ttyg-initial-state-with-configured-api-key.spec.js +1 -1
  22. package/e2e-legacy/ttyg/ttyg-initial-state-with-selected-repository.spec.js +1 -1
  23. package/e2e-legacy/ttyg/ttyg-initial-state-without-repositories.spec.js +1 -1
  24. package/fixtures/cluster/3-nodes-cluster-group-status-no-leader.json +41 -0
  25. package/npm-shrinkwrap.json +2 -2
  26. package/package.json +1 -1
  27. package/steps/cluster/cluster-configuration-steps.js +4 -0
  28. package/steps/import/import-steps.js +26 -6
  29. package/steps/main-menu-steps.js +5 -23
  30. package/steps/resource/resource-steps.js +0 -8
  31. package/steps/setup/user-and-access-steps.js +18 -14
  32. package/stubs/cluster/cluster-stubs.js +8 -1
  33. package/e2e-legacy/reactodia/reactodia.spec.js +0 -122
  34. package/steps/reactodia-steps.js +0 -42
@@ -45,6 +45,55 @@ describe('TTYG edit an agent', () => {
45
45
  ToasterSteps.verifySuccess('The agent \'agent-1\' was saved successfully.');
46
46
  });
47
47
 
48
+ it('should preserve the temperature and topP values of the edited agent', () => {
49
+ TTYGStubs.stubChatsListGet();
50
+ TTYGStubs.stubAgentListGet();
51
+ TTYGStubs.stubChatGet();
52
+ // GIVEN: I have opened the ttyg page
53
+ TTYGViewSteps.visit();
54
+ cy.wait('@get-chat-list');
55
+ cy.wait('@get-agent-list');
56
+ cy.wait('@get-chat');
57
+
58
+ // WHEN: I open the settings of an agent whose temperature and topP differ from the default values
59
+ TTYGViewSteps.openAgentSettingsModalForAgent(0);
60
+
61
+ // THEN: I expect the values of the agent to be loaded instead of the default ones
62
+ TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '0');
63
+ TtygAgentSettingsModalSteps.getTopPField().should('have.value', '0');
64
+
65
+ // WHEN: I disable the temperature setting
66
+ TtygAgentSettingsModalSteps.toggleTemperature();
67
+ // THEN: I expect the temperature controls to be disabled
68
+ TtygAgentSettingsModalSteps.getTemperatureField().should('be.disabled');
69
+ TtygAgentSettingsModalSteps.getTemperatureSliderField().should('be.disabled');
70
+
71
+ // WHEN: I enable the temperature setting again
72
+ TtygAgentSettingsModalSteps.toggleTemperature();
73
+ // THEN: I expect the temperature value of the agent to be restored instead of the default one
74
+ TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '0');
75
+
76
+ // WHEN: I disable the topP setting
77
+ TtygAgentSettingsModalSteps.toggleTop();
78
+ // THEN: I expect the topP control to be disabled
79
+ TtygAgentSettingsModalSteps.getTopPField().should('be.disabled');
80
+
81
+ // WHEN: I enable the topP setting again
82
+ TtygAgentSettingsModalSteps.toggleTop();
83
+ // THEN: I expect the topP value of the agent to be restored instead of the default one
84
+ TtygAgentSettingsModalSteps.getTopPField().should('have.value', '0');
85
+
86
+ // WHEN: I save the agent
87
+ TTYGStubs.stubAgentEdit();
88
+ TtygAgentSettingsModalSteps.saveAgent();
89
+ // THEN: I expect the values of the agent to be sent instead of the default ones
90
+ cy.wait('@edit-agent').then((interception) => {
91
+ expect(interception.request.body.temperature).to.equal(0);
92
+ expect(interception.request.body.topP).to.equal(0);
93
+ });
94
+ ToasterSteps.verifySuccess('The agent \'agent-1\' was saved successfully.');
95
+ });
96
+
48
97
  it('should not be able to edit an agent if an extraction method is selected but the precondition has failed', () => {
49
98
  TTYGStubs.stubChatsListGet();
50
99
  TTYGStubs.stubAgentListGet();
@@ -60,6 +109,14 @@ describe('TTYG edit an agent', () => {
60
109
 
61
110
  // THEN: The Save Agent button should be disabled
62
111
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
112
+ // AND: The panel of the FTS extraction method should be expanded, so that the reason is visible
113
+ TtygAgentSettingsModalSteps.getFtsDisabledHelp().should('be.visible');
114
+
115
+ // WHEN: I try to collapse the panel of the FTS extraction method
116
+ TtygAgentSettingsModalSteps.toggleFTSExtractionMethodPanel();
117
+ // THEN: The panel should remain expanded, because the precondition error is not resolved yet
118
+ TtygAgentSettingsModalSteps.getFtsDisabledHelp().should('be.visible');
119
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
63
120
  });
64
121
 
65
122
  it('should be able to edit Autocomplete extraction method option', () => {
@@ -39,7 +39,7 @@ describe('TTYG initial state with API key', () => {
39
39
  it('Should display the correct initial state when navigating via the navigation menu', () => {
40
40
  // Given, I visit the TTYG page via the navigation menu
41
41
  HomeSteps.visit();
42
- MainMenuSteps.clickOnTTYG();
42
+ MainMenuSteps.clickOnMenuTTYG();
43
43
  // Then,
44
44
  verifyStateWithApiKey();
45
45
  });
@@ -38,7 +38,7 @@ describe.skip('TTYG initial state with selected repository', () => {
38
38
  it('Should display the correct initial state when navigating via the navigation menu', () => {
39
39
  // Given, I visit the TTYG page via the navigation menu with a repository selected
40
40
  HomeSteps.visit();
41
- MainMenuSteps.clickOnTTYG();
41
+ MainMenuSteps.clickOnMenuTTYG();
42
42
  // Then,
43
43
  verifyStateWithSelectedRepository();
44
44
  });
@@ -14,7 +14,7 @@ describe('TTYG initial state without selected repository', () => {
14
14
  it('Should display the correct initial state when navigating via the navigation menu', () => {
15
15
  // Given, I visit the TTYG page via the navigation menu without a repository selected
16
16
  HomeSteps.visit();
17
- MainMenuSteps.clickOnTTYG();
17
+ MainMenuSteps.clickOnMenuTTYG();
18
18
  // Then,
19
19
  ErrorSteps.verifyNoConnectedRepoMessage();
20
20
  });
@@ -0,0 +1,41 @@
1
+ [
2
+ {
3
+ "address": "pc-desktop:7300",
4
+ "nodeState": "FOLLOWER",
5
+ "term": 2,
6
+ "syncStatus": {},
7
+ "lastLogTerm": 0,
8
+ "lastLogIndex": 0,
9
+ "endpoint": "http://pc-desktop:7200",
10
+ "recoveryStatus": {},
11
+ "topologyStatus": {
12
+ "state": "PRIMARY_NODE"
13
+ }
14
+ },
15
+ {
16
+ "address": "pc-desktop:7301",
17
+ "nodeState": "FOLLOWER",
18
+ "term": 2,
19
+ "syncStatus": {},
20
+ "lastLogTerm": 0,
21
+ "lastLogIndex": 0,
22
+ "endpoint": "http://pc-desktop:7201",
23
+ "recoveryStatus": {},
24
+ "topologyStatus": {
25
+ "state": "PRIMARY_NODE"
26
+ }
27
+ },
28
+ {
29
+ "address": "pc-desktop:7302",
30
+ "nodeState": "FOLLOWER",
31
+ "term": 2,
32
+ "syncStatus": {},
33
+ "lastLogTerm": 0,
34
+ "lastLogIndex": 0,
35
+ "endpoint": "http://pc-desktop:7202",
36
+ "recoveryStatus": {},
37
+ "topologyStatus": {
38
+ "state": "PRIMARY_NODE"
39
+ }
40
+ }
41
+ ]
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "4.0.0-reactodia-blank-nodes-TR3",
3
+ "version": "4.0.0-revert-explain-query-tests",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "4.0.0-reactodia-blank-nodes-TR3",
9
+ "version": "4.0.0-revert-explain-query-tests",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "@bahmutov/cypress-code-coverage": "^2.7.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "4.0.0-reactodia-blank-nodes-TR3",
3
+ "version": "4.0.0-revert-explain-query-tests",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -119,6 +119,10 @@ export class ClusterConfigurationSteps {
119
119
  return this.getMultiRegionTabContent().find('.title');
120
120
  }
121
121
 
122
+ static getNoLeaderAlert() {
123
+ return this.getMultiRegionTabContent().find('.no-leader-alert');
124
+ }
125
+
122
126
  static getAddTagButton() {
123
127
  return this.getMultiRegionTabContent().find('.create-tag-btn');
124
128
  }
@@ -161,17 +161,29 @@ class ImportSteps {
161
161
  return this.getSelectedResources().eq(index).closest('.title-row');
162
162
  }
163
163
 
164
- static getResource(index) {
164
+ static getResourceTitleRow(index) {
165
165
  return this.getResources().eq(index);
166
166
  }
167
167
 
168
+ static getResourceByIndex(index) {
169
+ return this.getResourcesTable().find(`[data-test="resource-${index}"]`);
170
+ }
171
+
172
+ static getResourceNameByIndex(index) {
173
+ return this.getResourceByIndex(index).find('.cell-title').invoke('text');
174
+ }
175
+
176
+ static getResourceStatusByIndex(index) {
177
+ return this.getResourceByIndex(index).find('.import-resource-message');
178
+ }
179
+
168
180
  static getResourceByName(name) {
169
181
  return this.getResources().find('.cell-title').contains(name)
170
182
  .closest('.row.title-row');
171
183
  }
172
184
 
173
185
  static selectFileByIndex(index) {
174
- this.getResource(index).find('.select-checkbox').click();
186
+ this.getResourceTitleRow(index).find('.select-checkbox').click();
175
187
  }
176
188
 
177
189
  static selectFileByName(name) {
@@ -194,8 +206,16 @@ class ImportSteps {
194
206
  return this.getResources().find('.import-resource-message');
195
207
  }
196
208
 
197
- static checkImportedResource(index, resourceName, expectedStatus) {
209
+ static checkImportedResourceByIndex(index, resourceName, expectedStatus) {
198
210
  const status = expectedStatus || 'Imported successfully';
211
+
212
+ this.getResourceNameByIndex(index).should('contain', resourceName);
213
+ this.getResourceStatusByIndex(index).should('contain', status);
214
+ }
215
+
216
+ static checkImportedResourceByName(resourceName, expectedStatus) {
217
+ const status = expectedStatus || 'Imported successfully';
218
+
199
219
  this.getResourceByName(resourceName).should('contain', resourceName);
200
220
  this.getResourceStatus(resourceName).should('contain', status);
201
221
  }
@@ -263,11 +283,11 @@ class ImportSteps {
263
283
  }
264
284
 
265
285
  static deleteUploadedFile(index) {
266
- this.getResource(index).find('.import-resource-action-remove-btn').invoke('show').trigger('click');
286
+ this.getResourceTitleRow(index).find('.import-resource-action-remove-btn').invoke('show').trigger('click');
267
287
  }
268
288
 
269
289
  static importFile(index) {
270
- this.getResource(index).find('.import-resource-action-import-btn').invoke('show').trigger('click');
290
+ this.getResourceTitleRow(index).find('.import-resource-action-import-btn').invoke('show').trigger('click');
271
291
  }
272
292
 
273
293
  static importResourceByName(name) {
@@ -275,7 +295,7 @@ class ImportSteps {
275
295
  }
276
296
 
277
297
  static resetFileStatus(index) {
278
- this.getResource(index).find('.import-resource-action-reset-btn').click();
298
+ this.getResourceTitleRow(index).find('.import-resource-action-reset-btn').click();
279
299
  }
280
300
 
281
301
  static resetResourceStatusByName(name) {
@@ -107,15 +107,6 @@ export class MainMenuSteps {
107
107
  this.getSubMenuButton('sub-menu-visual-graph').click();
108
108
  }
109
109
 
110
- static clickOnReactodia() {
111
- this.clickOnExplore();
112
- this.clickOnSubmenuReactodia();
113
- }
114
-
115
- static clickOnSubmenuReactodia() {
116
- this.getSubMenuButton('menu-reactodia').click();
117
- }
118
-
119
110
  static clickOnClassRelationships() {
120
111
  this.clickOnExplore();
121
112
  this.clickOnSubmenuClassRelationships();
@@ -281,23 +272,14 @@ export class MainMenuSteps {
281
272
  }
282
273
 
283
274
  // --------------------------
284
- // -- Lab menu --
275
+ // -- TTYG menu --
285
276
  // --------------------------
286
- static getMenuLab() {
287
- return this.getMainMenu().getByTestId('menu-lab');
288
- }
289
-
290
- static clickOnMenuLab() {
291
- return this.getMenuLab().click();
292
- }
293
-
294
- static clickOnTTYG() {
295
- this.clickOnMenuLab();
296
- this.clickOnTTYGSubmenu()
277
+ static getMenuTTYG() {
278
+ return this.getMainMenu().getByTestId('menu-ttyg');
297
279
  }
298
280
 
299
- static clickOnTTYGSubmenu() {
300
- this.getSubMenuButton('sub-menu-ttyg').click();
281
+ static clickOnMenuTTYG() {
282
+ return this.getMenuTTYG().click();
301
283
  }
302
284
 
303
285
  // --------------------------
@@ -147,12 +147,4 @@ export class ResourceSteps {
147
147
  static getDataTable() {
148
148
  return cy.get('.dataTable');
149
149
  }
150
-
151
- static getVisualizeReactodiaButton() {
152
- return cy.getByTestId('visualize-reactodia-button');
153
- }
154
-
155
- static clickOnVisualizeReactodiaButton() {
156
- ResourceSteps.getVisualizeReactodiaButton().click();
157
- }
158
150
  }
@@ -1,5 +1,7 @@
1
1
  import {EnvironmentStubs} from "../../stubs/environment-stubs";
2
2
 
3
+ const CENTER_SCROLL = {scrollBehavior: 'center'};
4
+
3
5
  export class UserAndAccessSteps {
4
6
  static visit() {
5
7
  cy.visit('/users');
@@ -118,7 +120,9 @@ export class UserAndAccessSteps {
118
120
  }
119
121
 
120
122
  static typeUsername(text) {
121
- this.getUsernameField().type(text);
123
+ this.getUsernameField()
124
+ .focus()
125
+ .type(text);
122
126
  }
123
127
 
124
128
  static getPasswordField() {
@@ -238,13 +242,13 @@ export class UserAndAccessSteps {
238
242
  .contains('Global (any data repository)')
239
243
  .parent('tr')
240
244
  .find('.graphql')
241
- .realClick();
245
+ .click(CENTER_SCROLL);
242
246
  }
243
247
 
244
248
  static clickGraphqlAccessRepo(repoName) {
245
249
  this.getRepositoryRightsLine(repoName)
246
250
  .find('.graphql')
247
- .realClick();
251
+ .click(CENTER_SCROLL);
248
252
  }
249
253
 
250
254
  static clickReadAccessAny() {
@@ -252,7 +256,7 @@ export class UserAndAccessSteps {
252
256
  .contains('Global (any data repository)')
253
257
  .parent('tr')
254
258
  .find('.read')
255
- .realClick();
259
+ .click(CENTER_SCROLL);
256
260
  }
257
261
 
258
262
  static clickReadAccessRepo(repoName) {
@@ -260,7 +264,7 @@ export class UserAndAccessSteps {
260
264
  .contains(repoName)
261
265
  .parent('tr')
262
266
  .find('.read')
263
- .realClick();
267
+ .click(CENTER_SCROLL);
264
268
  }
265
269
 
266
270
  static clickWriteAccessAny() {
@@ -268,7 +272,7 @@ export class UserAndAccessSteps {
268
272
  .contains('Global (any data repository)')
269
273
  .parent('tr')
270
274
  .find('.write')
271
- .realClick();
275
+ .click(CENTER_SCROLL);
272
276
  }
273
277
 
274
278
  static clickWriteAccessRepo(repoName) {
@@ -276,7 +280,7 @@ export class UserAndAccessSteps {
276
280
  .contains(repoName)
277
281
  .parent('tr')
278
282
  .find('.write')
279
- .realClick();
283
+ .click(CENTER_SCROLL);
280
284
  }
281
285
 
282
286
  static findUserRowAlias(username, aliasName = 'userRow') {
@@ -351,7 +355,7 @@ export class UserAndAccessSteps {
351
355
  }
352
356
 
353
357
  static toggleReadAccessForRepo(repoName) {
354
- return this.getReadAccessForRepo(repoName).realClick();
358
+ return this.getReadAccessForRepo(repoName).click(CENTER_SCROLL);
355
359
  }
356
360
 
357
361
  static validateReadAccessForRepo(repoName, expectedState) {
@@ -374,7 +378,7 @@ export class UserAndAccessSteps {
374
378
  }
375
379
 
376
380
  static toggleWriteAccessForRepo(repoName) {
377
- return this.getWriteAccessForRepo(repoName).realClick();
381
+ return this.getWriteAccessForRepo(repoName).click(CENTER_SCROLL);
378
382
  }
379
383
 
380
384
  static validateWriteAccessForRepo(repoName, expectedState) {
@@ -390,7 +394,7 @@ export class UserAndAccessSteps {
390
394
  }
391
395
 
392
396
  static clickMaintainAccessRepo(repoName) {
393
- UserAndAccessSteps.getMaintainAccessRepoCheckbox(repoName).realClick();
397
+ UserAndAccessSteps.getMaintainAccessRepoCheckbox(repoName).click(CENTER_SCROLL);
394
398
  }
395
399
 
396
400
  static toggleMaintainRepoForRepo(repoName) {
@@ -410,7 +414,7 @@ export class UserAndAccessSteps {
410
414
  }
411
415
 
412
416
  static toggleGraphqlAccessForRepo(repoName) {
413
- return this.getGraphqlAccessForRepo(repoName).realClick();
417
+ return this.getGraphqlAccessForRepo(repoName).click(CENTER_SCROLL);
414
418
  }
415
419
 
416
420
  static validateGraphqlAccessForRepo(repoName, expectedState) {
@@ -455,19 +459,19 @@ export class UserAndAccessSteps {
455
459
  .contains(repoName)
456
460
  .parent('.row')
457
461
  .find('.read')
458
- .realClick();
462
+ .click(CENTER_SCROLL);
459
463
  }
460
464
 
461
465
  static clickFreeWriteAccessRepo(repoName) {
462
466
  cy.get('.repo-fields').contains(repoName).parent('.row').as('row');
463
467
  cy.get('@row').scrollIntoView();
464
- cy.get('@row').find('.write').realClick();
468
+ cy.get('@row').find('.write').click(CENTER_SCROLL);
465
469
  }
466
470
 
467
471
  static clickFreeGraphqlAccessRepo(repoName) {
468
472
  cy.get('.repo-fields').contains(repoName).parent('.row').as('row');
469
473
  cy.get('@row').scrollIntoView();
470
- cy.get('@row').find('.graphql').realClick();
474
+ cy.get('@row').find('.graphql').click(CENTER_SCROLL);
471
475
  }
472
476
 
473
477
  }
@@ -132,7 +132,7 @@ export class ClusterStubs extends Stubs {
132
132
  added.forEach((node) => {
133
133
  response[node] = "Node was successfully added in the cluster.";
134
134
  });
135
- added.forEach((node) => {
135
+ removed.forEach((node) => {
136
136
  response[node] = "Node was successfully removed from the cluster.";
137
137
  });
138
138
 
@@ -210,6 +210,13 @@ export class ClusterStubs extends Stubs {
210
210
  }).as('3-nodes-cluster-group-status-tag');
211
211
  }
212
212
 
213
+ static stubClusterGroupStatusWithoutLeader() {
214
+ cy.intercept('/rest/cluster/group/status', {
215
+ fixture: '/cluster/3-nodes-cluster-group-status-no-leader.json',
216
+ statusCode: 200
217
+ }).as('3-nodes-cluster-group-status-no-leader');
218
+ }
219
+
213
220
  static stubDeleteTag(uri) {
214
221
  cy.intercept(`rest/cluster/config/tag`, {
215
222
  body: `"Removed primary tag '${uri}' from cluster`,
@@ -1,122 +0,0 @@
1
- import {ReactodiaSteps} from '../../steps/reactodia-steps.js';
2
- import {LanguageSelectorSteps} from '../../steps/language-selector-steps.js';
3
- import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
4
- import {MainMenuSteps} from '../../steps/main-menu-steps.js';
5
-
6
- const FILE_TO_IMPORT = 'resource-test-data.ttl';
7
- const SEED_RESOURCE_ENCODED = 'http:%2F%2Fexample.com%2Fontology%23CustomerLoyalty';
8
- const SEED_RESOURCE_LABEL = 'CustomerLoyalty';
9
-
10
- const CONSTRUCT_QUERY = 'CONSTRUCT { <http://example.com/ontology#CustomerLoyalty> ?p ?o } WHERE { <http://example.com/ontology#CustomerLoyalty> ?p ?o }';
11
- const CONSTRUCT_TARGET_LABEL = 'Metric';
12
-
13
- describe('Reactodia graph explorer', () => {
14
- let repositoryId;
15
-
16
- beforeEach(() => {
17
- repositoryId = 'repository-' + Date.now();
18
- cy.createRepository({id: repositoryId});
19
- cy.presetRepository(repositoryId);
20
- cy.importServerFile(repositoryId, FILE_TO_IMPORT);
21
- });
22
-
23
- afterEach(() => {
24
- cy.deleteRepository(repositoryId);
25
- });
26
-
27
- it('should mount the reactodia workspace when a repository is active', () => {
28
- // Given I open the reactodia view without a start resource.
29
- ReactodiaSteps.visit();
30
-
31
- // Then I expect the reactodia workspace and its canvas to be rendered.
32
- ReactodiaSteps.getWorkspace().should('exist');
33
- ReactodiaSteps.getCanvas().should('exist');
34
-
35
- // And I expect the canvas to start empty because no start resource was provided.
36
- ReactodiaSteps.getElements().should('not.exist');
37
- });
38
-
39
- it('should place the start resource on the canvas as a seed', () => {
40
- // Given I open the reactodia view with a start resource.
41
- ReactodiaSteps.visit(SEED_RESOURCE_ENCODED);
42
-
43
- // Then I expect the start resource to be placed on the canvas as a seed element.
44
- ReactodiaSteps.getElements().should('have.length', 1);
45
- ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
46
- });
47
-
48
- it('should seed the canvas with the graph computed from a CONSTRUCT query', () => {
49
- // Given I open the reactodia view with a CONSTRUCT query, as sent from the SPARQL editor.
50
- ReactodiaSteps.visitWithQuery(CONSTRUCT_QUERY);
51
-
52
- // Then I expect the computed graph to be seeded on the canvas: the subject and its related resource.
53
- ReactodiaSteps.getElements().should('have.length', 2);
54
- ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
55
- ReactodiaSteps.getElement(CONSTRUCT_TARGET_LABEL).should('exist');
56
- });
57
-
58
- it('should keep the displayed resources when the language is switched', () => {
59
- // Given the reactodia view is opened with a start resource that gets seeded on the canvas.
60
- ReactodiaSteps.visit(SEED_RESOURCE_ENCODED);
61
- ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
62
- ReactodiaSteps.getElements().should('have.length', 1);
63
-
64
- // When I switch the language.
65
- LanguageSelectorSteps.switchToFr();
66
-
67
- // Then I expect the same resources to remain visible because the layout is carried across the remount.
68
- ReactodiaSteps.getElements().should('have.length', 1);
69
- ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
70
- });
71
-
72
- it('should keep the diagram on refresh but clear it when navigating away and back', () => {
73
- // Given the reactodia view is opened with a start resource that gets seeded on the canvas.
74
- ReactodiaSteps.visit(SEED_RESOURCE_ENCODED);
75
- ReactodiaSteps.getElements().should('have.length', 1);
76
- ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
77
-
78
- // When I refresh the page.
79
- cy.reload();
80
-
81
- // Then I expect the diagram state to be preserved across the refresh.
82
- ReactodiaSteps.getElements().should('have.length', 1);
83
- ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
84
-
85
- // When I navigate to another view via the navigation bar.
86
- MainMenuSteps.clickOnSparqlMenu();
87
- ReactodiaSteps.getComponent().should('not.exist');
88
-
89
- // And I return to the reactodia view via the navigation bar.
90
- MainMenuSteps.clickOnReactodia();
91
-
92
- // Then I expect the canvas to be cleared, because leaving the view drops the persisted diagram state.
93
- ReactodiaSteps.getWorkspace().should('exist');
94
- ReactodiaSteps.getElements().should('not.exist');
95
- });
96
-
97
- describe('Repository switch', () => {
98
- let secondRepositoryId;
99
-
100
- beforeEach(() => {
101
- secondRepositoryId = 'repository-second-' + Date.now();
102
- cy.createRepository({id: secondRepositoryId});
103
- });
104
-
105
- afterEach(() => {
106
- cy.deleteRepository(secondRepositoryId);
107
- });
108
-
109
- it('should clear the canvas when the repository is switched', () => {
110
- // Given the reactodia view is opened with a start resource that gets seeded on the canvas.
111
- ReactodiaSteps.visit(SEED_RESOURCE_ENCODED);
112
- ReactodiaSteps.getElements().should('have.length', 1);
113
-
114
- // When I switch to another repository.
115
- RepositorySelectorSteps.selectRepository(secondRepositoryId);
116
-
117
- // Then I expect the workspace to still be mounted, but the canvas to be cleared.
118
- ReactodiaSteps.getWorkspace().should('exist');
119
- ReactodiaSteps.getElements().should('not.exist');
120
- });
121
- });
122
- });
@@ -1,42 +0,0 @@
1
- import {BaseSteps} from "./base-steps.js";
2
-
3
- const VIEW_URL = '/reactodia';
4
-
5
- export class ReactodiaSteps extends BaseSteps {
6
-
7
- static visit(uri) {
8
- cy.visit(`${VIEW_URL}${uri ? ('?uri=' + uri) : ''}`);
9
- }
10
-
11
- static visitWithQuery(query, {inference = false, sameAs = false} = {}) {
12
- cy.visit(`${VIEW_URL}?query=${encodeURIComponent(query)}&inference=${inference}&sameAs=${sameAs}`);
13
- }
14
-
15
- static verifyUrl() {
16
- this.validateUrl(`${Cypress.config('baseUrl')}${VIEW_URL}`);
17
- }
18
-
19
- static verifyStartResourceUri(uri) {
20
- cy.getQueryParam('uri').should('eq', uri);
21
- }
22
-
23
- static getComponent() {
24
- return cy.get('graphwise-reactodia');
25
- }
26
-
27
- static getWorkspace() {
28
- return ReactodiaSteps.getComponent().find('.reactodia-workspace');
29
- }
30
-
31
- static getCanvas() {
32
- return ReactodiaSteps.getComponent().find('.reactodia-canvas');
33
- }
34
-
35
- static getElements() {
36
- return ReactodiaSteps.getCanvas().find('[data-element-id]');
37
- }
38
-
39
- static getElement(text) {
40
- return ReactodiaSteps.getCanvas().find(`[data-element-id]`).contains(text).first();
41
- }
42
- }