graphdb-workbench-tests 3.5.1-TR1 → 3.5.1-TR3

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.
@@ -64,6 +64,26 @@ describe('Cluster configuration', () => {
64
64
  });
65
65
  });
66
66
 
67
+ it('should show an alert when there is no elected leader in the cluster', () => {
68
+ // Given there is no elected leader in the cluster
69
+ ClusterStubs.stubClusterGroupStatusWithoutLeader();
70
+
71
+ // When I have opened the cluster management page
72
+ ClusterPageSteps.visit();
73
+ // And I click on edit properties and open Multi-region tab
74
+ ClusterPageSteps.previewClusterConfig();
75
+ ClusterConfigurationSteps.selectMultiRegionConfigTab();
76
+
77
+ // Then I expect to see an alert that the leader is not elected
78
+ ClusterConfigurationSteps.getNoLeaderAlert().should('be.visible')
79
+ .and('contain.text', 'Leader is not elected');
80
+ // And no primary or secondary cluster configuration should be rendered
81
+ ClusterConfigurationSteps.getMultiRegionHeader().should('not.exist');
82
+ ClusterConfigurationSteps.getAddTagButton().should('not.exist');
83
+ ClusterConfigurationSteps.getEnableSecondaryModeButton().should('not.exist');
84
+ ClusterConfigurationSteps.getTagsTable().should('not.exist');
85
+ });
86
+
67
87
  it('should be able to switch modes', () => {
68
88
  ClusterStubs.stubEnableSecondaryMode();
69
89
  const rpcAddress = 'node-name:7300';
@@ -128,7 +128,6 @@ describe('User and Access', () => {
128
128
  UserAndAccessSteps.getCustomRoleFieldError().should('not.be.visible');
129
129
 
130
130
  // When I create the user with a valid custom role
131
- UserAndAccessSteps.toggleWriteAccessAny();
132
131
  SecurityStubs.spyOnUserCreate();
133
132
  UserAndAccessSteps.confirmUserCreate();
134
133
  // Then the user should be created with that custom role
@@ -536,8 +536,10 @@ describe('TTYG create new agent', () => {
536
536
 
537
537
  // WHEN: I enable the temperature setting.
538
538
  TtygAgentSettingsModalSteps.toggleTemperature();
539
- // THEN: I expect the default temperature value to be restored.
540
- TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '0.7');
539
+ // THEN: I expect the last set temperature value to be restored instead of the default one.
540
+ TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '1.2');
541
+ // AND: I expect the high-temperature warning to be displayed again.
542
+ TtygAgentSettingsModalSteps.getTemperatureField().should('have.class', 'has-warning');
541
543
  });
542
544
 
543
545
  it('should toggle the topP setting', () => {
@@ -556,8 +558,8 @@ describe('TTYG create new agent', () => {
556
558
 
557
559
  // WHEN: I enable the topP setting.
558
560
  TtygAgentSettingsModalSteps.toggleTop();
559
- // THEN: I expect the default topP value to be restored.
560
- TtygAgentSettingsModalSteps.getTopPField().should('have.value', '1');
561
+ // THEN: I expect the last set topP value to be restored instead of the default one.
562
+ TtygAgentSettingsModalSteps.getTopPField().should('have.value', '0.3');
561
563
  });
562
564
 
563
565
  it('Should warn the user when he changes the default value of the base instruction', () => {
@@ -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();
@@ -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": "3.5.1-TR1",
3
+ "version": "3.5.1-TR3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.5.1-TR1",
9
+ "version": "3.5.1-TR3",
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": "3.5.1-TR1",
3
+ "version": "3.5.1-TR3",
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
  }
@@ -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`,