graphdb-workbench-tests 3.5.0 → 3.5.1-TR1

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.
@@ -2,7 +2,7 @@ import {MainMenuSteps} from "../../../steps/main-menu-steps";
2
2
  import HomeSteps from "../../../steps/home-steps";
3
3
  import {SettingsSteps} from "../../../steps/setup/settings-steps";
4
4
 
5
- function verifyInitialState(repositoryId) {
5
+ function verifyInitialState() {
6
6
  // Password change field is for admin.
7
7
  // explicitly state that the fields must be of type password
8
8
  SettingsSteps.getPasswordField().should('be.visible')
@@ -43,14 +43,8 @@ function verifyInitialState(repositoryId) {
43
43
  // Repository rights
44
44
  // - Admin has read and write access to all repositories."
45
45
  SettingsSteps.getUserRepositoryTable().should('be.visible');
46
- SettingsSteps.getReadRightsCheckbox(repositoryId)
47
- .should('be.visible')
48
- .and('be.checked')
49
- .and('be.disabled');
50
- SettingsSteps.getWriteRightsCheckbox(repositoryId)
51
- .should('be.visible')
52
- .and('be.checked')
53
- .and('be.disabled');
46
+ // And Admin doesn't see the list of the repositories
47
+ SettingsSteps.getRepositoryRightsRows().should('not.exist');
54
48
  }
55
49
 
56
50
  describe('My Settings initial state', () => {
@@ -69,7 +63,7 @@ describe('My Settings initial state', () => {
69
63
  // Given, I visit the My Settings page via URL
70
64
  SettingsSteps.visit();
71
65
  // Then,
72
- verifyInitialState(repositoryId);
66
+ verifyInitialState();
73
67
  });
74
68
 
75
69
  it('Should display the correct initial state when navigating via the navigation bar', () => {
@@ -77,6 +71,6 @@ describe('My Settings initial state', () => {
77
71
  HomeSteps.visit();
78
72
  MainMenuSteps.clickOnMySettings();
79
73
  // Then,
80
- verifyInitialState(repositoryId);
74
+ verifyInitialState();
81
75
  });
82
76
  });
@@ -318,6 +318,8 @@ describe('User and Access', () => {
318
318
  verifyDisabledUserAuth('*', {read: false, write: false, maintain: true, graphql: true});
319
319
  verifyCheckedUserAuth(repoName, {read: false, write: false, maintain: false, graphql: false});
320
320
  verifyDisabledUserAuth(repoName, {read: false, write: false, maintain: false, graphql: true});
321
+ // The GraphQL checkbox is disabled for the lack of read/write rights, not because of the role
322
+ UserAndAccessSteps.getGraphqlAnyRoleTooltip().should('not.exist');
321
323
  });
322
324
 
323
325
  context('for non user roles', () => {
@@ -327,8 +329,7 @@ describe('User and Access', () => {
327
329
  verifyCheckedUserAuth('*', {read: true, write: true, maintain: true, graphql: false});
328
330
  verifyDisabledUserAuth('*', {read: true, write: true, maintain: true, graphql: true});
329
331
 
330
- verifyCheckedUserAuth(repoName, {read: true, write: true, maintain: true, graphql: false});
331
- verifyDisabledUserAuth(repoName, {read: true, write: true, maintain: true, graphql: true});
332
+ UserAndAccessSteps.getRepositoryRightsRows().should('not.exist');
332
333
  });
333
334
 
334
335
  it('repository manager', () => {
@@ -338,8 +339,7 @@ describe('User and Access', () => {
338
339
  verifyCheckedUserAuth('*', {read: true, write: true, maintain: true, graphql: false});
339
340
  verifyDisabledUserAuth('*', {read: true, write: true, maintain: true, graphql: true});
340
341
 
341
- verifyCheckedUserAuth(repoName, {read: true, write: true, maintain: true, graphql: false});
342
- verifyDisabledUserAuth(repoName, {read: true, write: true, maintain: true, graphql: true});
342
+ UserAndAccessSteps.getRepositoryRightsRows().should('not.exist');
343
343
  });
344
344
  });
345
345
 
@@ -464,6 +464,27 @@ describe('User and Access', () => {
464
464
  createUser(graphqlUser, PASSWORD, ROLE_USER, {read: true, graphql: true, repoName: repositoryId2});
465
465
  });
466
466
 
467
+ it('Should not allow GraphQL access for Ontop and FedX repositories', () => {
468
+ // GIVEN Ontop and FedX repositories alongside a GraphDB one
469
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-repositories-with-unsupported-graphql-types.json');
470
+ UserAndAccessSteps.visit();
471
+ UserAndAccessSteps.clickCreateNewUserButton();
472
+ // WHEN the user is granted read access to all of them
473
+ UserAndAccessSteps.toggleReadAccessAny();
474
+
475
+ // THEN GraphQL should be available only for the GraphDB repository
476
+ UserAndAccessSteps.validateGraphqlAccessForRepo('graphdb-repo', {disabled: false});
477
+ UserAndAccessSteps.getGraphqlRepositoryTypeTooltipForRepo('graphdb-repo').should('not.exist');
478
+
479
+ // AND it should be permanently disabled for the Ontop and the FedX ones
480
+ ['ontop-repo', 'fedx-repo'].forEach((repository) => {
481
+ UserAndAccessSteps.validateGraphqlAccessForRepo(repository, {checked: false, disabled: true});
482
+ UserAndAccessSteps.hoverGraphQlRightsCheckbox(repository)
483
+ UserAndAccessSteps.getAngularTooltip().should('have.text', 'Not available for this repository type');
484
+ UserAndAccessSteps.blurGraphQlRightsCheckbox(repository)
485
+ });
486
+ });
487
+
467
488
  // Fails for unknown reason only in CI
468
489
  it('Can create user with different auth combinations', () => {
469
490
  cy.wait('@getRepositories');
@@ -172,6 +172,60 @@ describe('TTYG create new agent', () => {
172
172
  TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
173
173
  });
174
174
 
175
+ it('should create an agent without temperature or topP parameters', () => {
176
+ // GIVEN: I have opened the Create Agent dialog and filled in the minimum required fields.
177
+ openCreateAgentDialog(repositoryId)
178
+ TtygAgentSettingsModalSteps.getDialog().should('be.visible');
179
+
180
+ fillAgentName('Test Agent');
181
+ TtygAgentSettingsModalSteps.enableSparqlExtractionMethod();
182
+ TtygAgentSettingsModalSteps.selectSparqlMethodSparqlQuery();
183
+
184
+ // WHEN: I disable the temperature setting.
185
+ TtygAgentSettingsModalSteps.toggleTemperature();
186
+
187
+ // AND: I disable the topP setting.
188
+ TtygAgentSettingsModalSteps.toggleTop();
189
+
190
+ // AND: I save the agent.
191
+ TTYGStubs.stubAgentCreate(1000);
192
+ TTYGStubs.stubAgentListGet(
193
+ '/ttyg/agent/get-agent-list-new-agent.json',
194
+ 1000,
195
+ );
196
+
197
+ TtygAgentSettingsModalSteps.saveAgent();
198
+ TtygAgentSettingsModalSteps.getCreatingAgentLoader().should('be.visible');
199
+
200
+ // THEN: I expect the create-agent request not to contain the temperature and topP parameters.
201
+ cy.wait('@create-agent').then((interception) => {
202
+ // eslint-disable-next-line no-undef
203
+ assert.deepEqual(interception.request.body, {
204
+ id: 'id',
205
+ name: 'Test Agent',
206
+ repositoryId: 'starwars',
207
+ model: 'gpt-4o',
208
+ contextSize: 128000,
209
+ seed: 0,
210
+ assistantsInstructions: {
211
+ systemInstruction: '',
212
+ userInstruction: 'If you need to write a SPARQL query, use only the classes and properties provided in the schema and don\'t invent or guess any. Always try to return human-readable names or labels and not only the IRIs. If SPARQL fails to provide the necessary information you can try another tool too.',
213
+ },
214
+ assistantExtractionMethods: [
215
+ {
216
+ method: 'sparql_search',
217
+ sparqlQuery: 'CONSTRUCT {?s ?p ?o} WHERE {GRAPH <http://example.org/ontology> {?s ?p ?o .}}',
218
+ addMissingNamespaces: false,
219
+ },
220
+ ],
221
+ additionalExtractionMethods: [],
222
+ });
223
+ });
224
+
225
+ // AND: I expect the modal to be closed.
226
+ TtygAgentSettingsModalSteps.getDialog().should('not.exist');
227
+ });
228
+
175
229
  it('Should require FTS to be enabled for selected repository when creating agent with FTS extraction method', () => {
176
230
  RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-disabled-fts.json');
177
231
  TTYGStubs.stubChatsListGetNoResults();
@@ -461,6 +515,51 @@ describe('TTYG create new agent', () => {
461
515
  TtygAgentSettingsModalSteps.getTemperatureField().should('not.have.class', 'has-warning');
462
516
  });
463
517
 
518
+ it('should toggle the temperature setting', () => {
519
+ // GIVEN: I have opened the Create Agent dialog.
520
+ openCreateAgentDialog(repositoryId);
521
+
522
+ // WHEN: I set a high temperature value.
523
+ TtygAgentSettingsModalSteps.setTemperature('1.2');
524
+ // THEN: I expect a warning message to be displayed.
525
+ TtygAgentSettingsModalSteps.getTemperatureField().should('have.class', 'has-warning');
526
+ TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '1.2');
527
+
528
+ // WHEN: I disable the temperature setting.
529
+ TtygAgentSettingsModalSteps.toggleTemperature();
530
+ // THEN: I expect the high-temperature warning to be hidden.
531
+ TtygAgentSettingsModalSteps.getTemperatureWarning().should('not.exist');
532
+ TtygAgentSettingsModalSteps.getTemperatureField().should('not.have.class', 'has-warning');
533
+ // AND: I expect the temperature controls to be disabled.
534
+ TtygAgentSettingsModalSteps.getTemperatureField().should('be.disabled');
535
+ TtygAgentSettingsModalSteps.getTemperatureSliderField().should('be.disabled');
536
+
537
+ // WHEN: I enable the temperature setting.
538
+ TtygAgentSettingsModalSteps.toggleTemperature();
539
+ // THEN: I expect the default temperature value to be restored.
540
+ TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '0.7');
541
+ });
542
+
543
+ it('should toggle the topP setting', () => {
544
+ // GIVEN: I have opened the Create Agent dialog.
545
+ openCreateAgentDialog(repositoryId);
546
+
547
+ // WHEN: I set a custom topP value.
548
+ TtygAgentSettingsModalSteps.setTopP('0.3');
549
+ // THEN: I expect the topP value to be updated.
550
+ TtygAgentSettingsModalSteps.getTopPField().should('have.value', '0.3');
551
+
552
+ // WHEN: I disable the topP setting.
553
+ TtygAgentSettingsModalSteps.toggleTop();
554
+ // THEN: I expect the topP control to be disabled.
555
+ TtygAgentSettingsModalSteps.getTopPField().should('be.disabled');
556
+
557
+ // WHEN: I enable the topP setting.
558
+ TtygAgentSettingsModalSteps.toggleTop();
559
+ // THEN: I expect the default topP value to be restored.
560
+ TtygAgentSettingsModalSteps.getTopPField().should('have.value', '1');
561
+ });
562
+
464
563
  it('Should warn the user when he changes the default value of the base instruction', () => {
465
564
  RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-enabled-fts.json');
466
565
  TTYGStubs.stubChatsListGetNoResults();
@@ -541,3 +640,13 @@ function fillAgentName(name) {
541
640
  TtygAgentSettingsModalSteps.getAgentNameError().should('be.visible').and('contain', 'This field is required');
542
641
  TtygAgentSettingsModalSteps.typeAgentName(name);
543
642
  }
643
+
644
+ const openCreateAgentDialog = (repositoryId) => {
645
+ TTYGStubs.stubChatsListGetNoResults();
646
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
647
+ ConnectorStubs.stubGetConnectors();
648
+ TTYGStubs.getSimilarityIndexesForRepo(repositoryId );
649
+ TTYGViewSteps.visit();
650
+ cy.wait('@get-all-repositories');
651
+ TTYGViewSteps.createFirstAgent();
652
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "": [
3
+ {
4
+ "id": "graphdb-repo",
5
+ "title": "",
6
+ "uri": "http://localhost:8080/graphdb/repositories/graphdb-repo",
7
+ "externalUrl": "http://localhost:8080/graphdb/repositories/graphdb-repo",
8
+ "local": true,
9
+ "type": "graphdb",
10
+ "sesameType": "graphdb:SailRepository",
11
+ "location": "",
12
+ "readable": true,
13
+ "writable": true,
14
+ "unsupported": false,
15
+ "state": "RUNNING"
16
+ },
17
+ {
18
+ "id": "ontop-repo",
19
+ "title": "",
20
+ "uri": "http://localhost:8080/graphdb/repositories/ontop-repo",
21
+ "externalUrl": "http://localhost:8080/graphdb/repositories/ontop-repo",
22
+ "local": true,
23
+ "type": "ontop",
24
+ "sesameType": "graphdb:OntopRepository",
25
+ "location": "",
26
+ "readable": true,
27
+ "writable": true,
28
+ "unsupported": false,
29
+ "state": "RUNNING"
30
+ },
31
+ {
32
+ "id": "fedx-repo",
33
+ "title": "",
34
+ "uri": "http://localhost:8080/graphdb/repositories/fedx-repo",
35
+ "externalUrl": "http://localhost:8080/graphdb/repositories/fedx-repo",
36
+ "local": true,
37
+ "type": "fedx",
38
+ "sesameType": "graphdb:FedXRepository",
39
+ "location": "",
40
+ "readable": true,
41
+ "writable": true,
42
+ "unsupported": false,
43
+ "state": "RUNNING"
44
+ }
45
+ ]
46
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.5.0",
3
+ "version": "3.5.1-TR1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.5.0",
9
+ "version": "3.5.1-TR1",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "@bahmutov/cypress-code-coverage": "^2.7.2",
@@ -2082,9 +2082,9 @@
2082
2082
  }
2083
2083
  },
2084
2084
  "node_modules/@eslint/eslintrc/node_modules/js-yaml": {
2085
- "version": "4.3.0",
2086
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
2087
- "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
2085
+ "version": "4.3.1",
2086
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
2087
+ "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
2088
2088
  "dev": true,
2089
2089
  "funding": [
2090
2090
  {
@@ -5407,9 +5407,9 @@
5407
5407
  "license": "MIT"
5408
5408
  },
5409
5409
  "node_modules/fast-uri": {
5410
- "version": "3.1.4",
5411
- "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.4.tgz",
5412
- "integrity": "sha512-8JnbkQ4juDyvYs4mgFGQqg4yCYtFDtUtmp2QIQq11ZZe5CFQ5wcqm1rqDgAh/QdMySuBnPzMUiJUNZG5N/AiQw==",
5410
+ "version": "3.1.5",
5411
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz",
5412
+ "integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==",
5413
5413
  "dev": true,
5414
5414
  "funding": [
5415
5415
  {
@@ -7776,9 +7776,9 @@
7776
7776
  }
7777
7777
  },
7778
7778
  "node_modules/mocha/node_modules/js-yaml": {
7779
- "version": "4.3.0",
7780
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
7781
- "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
7779
+ "version": "4.3.1",
7780
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
7781
+ "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
7782
7782
  "dev": true,
7783
7783
  "funding": [
7784
7784
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.5.0",
3
+ "version": "3.5.1-TR1",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -94,6 +94,10 @@ export class SettingsSteps {
94
94
  return this.getSettingsPage().find('.user-repositories .table');
95
95
  }
96
96
 
97
+ static getRepositoryRightsRows() {
98
+ return this.getUserRepositoryTable().getByTestId('repository-rights-rows');
99
+ }
100
+
97
101
  static getUserRepository(name) {
98
102
  return this.getUserRepositoryTable().find(`.repository-name:contains('${name}')`).closest('tr');
99
103
  }
@@ -405,11 +405,8 @@ export class UserAndAccessSteps {
405
405
  // ============= GraphQL Access Toggles and Validations =============
406
406
 
407
407
  static getGraphqlAccessForRepo(repoName) {
408
- const matchText = (repoName === '*') ? 'Global (any data repository)' : repoName;
409
- return cy.get('#user-repos')
410
- .contains(matchText)
411
- .parent('tr')
412
- .find('.graphql')
408
+ const testId = (repoName === '*') ? 'graphql-any-checkbox' : 'graphql-repository-checkbox';
409
+ return this.getRepositoryRightsLine(repoName).getByTestId(testId);
413
410
  }
414
411
 
415
412
  static toggleGraphqlAccessForRepo(repoName) {
@@ -421,6 +418,30 @@ export class UserAndAccessSteps {
421
418
  this.validateRightsForRepo(repoName, graphqlAccessCheckbox, expectedState);
422
419
  }
423
420
 
421
+ static getRepositoryRightsRows() {
422
+ return cy.getByTestId('repository-rights-rows');
423
+ }
424
+
425
+ static getGraphqlAnyRoleTooltip() {
426
+ return cy.getByTestId('graphql-any-role-tooltip');
427
+ }
428
+
429
+ static getGraphqlRepositoryTypeTooltipForRepo(repoName) {
430
+ return this.getRepositoryRightsLine(repoName).getByTestId('graphql-repository-type-tooltip');
431
+ }
432
+
433
+ static hoverGraphQlRightsCheckbox(repoName) {
434
+ this.getGraphqlRepositoryTypeTooltipForRepo(repoName).trigger('mouseover');
435
+ }
436
+
437
+ static blurGraphQlRightsCheckbox(repoName) {
438
+ this.getGraphqlRepositoryTypeTooltipForRepo(repoName).trigger('mouseout');
439
+ }
440
+
441
+ static getAngularTooltip() {
442
+ return cy.get('.angular-tooltip');
443
+ }
444
+
424
445
  static clickMenuItem(label) {
425
446
  return cy.get('.main-menu').contains(label).click({force: true});
426
447
  }
@@ -451,6 +451,14 @@ export class TtygAgentSettingsModalSteps extends ModalDialogSteps {
451
451
  return this.getDialog().find('.temperature');
452
452
  }
453
453
 
454
+ static getTemperatureToggle() {
455
+ return TtygAgentSettingsModalSteps.getTemperatureFormGroup().find('.temperature-toggle label');
456
+ }
457
+
458
+ static toggleTemperature() {
459
+ TtygAgentSettingsModalSteps.getTemperatureToggle().click();
460
+ }
461
+
454
462
  static getTemperatureField() {
455
463
  return this.getTemperatureFormGroup().find('#temperature');
456
464
  }
@@ -477,6 +485,14 @@ export class TtygAgentSettingsModalSteps extends ModalDialogSteps {
477
485
  return this.getDialog().find('.top-p');
478
486
  }
479
487
 
488
+ static getTopPToggle() {
489
+ return TtygAgentSettingsModalSteps.getTopPFormGroup().find('.top-p-toggle label');
490
+ }
491
+
492
+ static toggleTop() {
493
+ TtygAgentSettingsModalSteps.getTopPToggle().click();
494
+ }
495
+
480
496
  static getTopPField() {
481
497
  return this.getTopPFormGroup().find('#topP');
482
498
  }