graphdb-workbench-tests 3.1.0-WBM-9 → 3.1.0-plugins1

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 (71) hide show
  1. package/.nycrc +10 -0
  2. package/cypress-legacy.config.js +9 -1
  3. package/cypress-security.config.js +40 -0
  4. package/cypress.config.js +3 -1
  5. package/e2e-flaky/import/import-user-data-url.spec.js +63 -0
  6. package/e2e-legacy/explore/graphs-overview/graphs.overview.spec.js +1 -1
  7. package/e2e-legacy/graphql/filter-graphql-endpoints-on-management-view.spec.js +1 -4
  8. package/e2e-legacy/graphql/graphql-endpoint-management-view.spec.js +4 -4
  9. package/e2e-legacy/graphql/import-graphql-endpoint-definitions.spec.js +1 -10
  10. package/e2e-legacy/home/cookie-policy.spec.js +78 -59
  11. package/e2e-legacy/home/documentation-link.spec.js +31 -33
  12. package/e2e-legacy/home/google-analytics.spec.js +4 -6
  13. package/e2e-legacy/home/rdf-resource-search.spec.js +106 -138
  14. package/e2e-legacy/home/view-resource-autocomplete.spec.js +28 -15
  15. package/e2e-legacy/import/import-user-data-url.spec.js +0 -23
  16. package/e2e-legacy/import/import-user-data.spec.js +1 -2
  17. package/e2e-legacy/monitor/global-operation-statuses-component.spec.js +13 -9
  18. package/e2e-legacy/repository/repositories.spec.js +6 -6
  19. package/e2e-legacy/setup/autocomplete/autocomplete.spec.js +3 -4
  20. package/e2e-legacy/setup/jdbc/jdbc-create.spec.js +2 -2
  21. package/e2e-legacy/setup/sparql-template/sparql-template-create.js +10 -3
  22. package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +38 -9
  23. package/e2e-legacy/sparql-editor/saved-query/edit-query.spec.js +3 -6
  24. package/e2e-legacy/sparql-editor/saved-query/share-query.spec.js +2 -2
  25. package/e2e-legacy/ttyg/agent-list.spec.js +37 -2
  26. package/e2e-legacy/ttyg/chat-list.spec.js +1 -2
  27. package/e2e-legacy/ttyg/clone-agent.spec.js +1 -0
  28. package/e2e-legacy/ttyg/create-agent.spec.js +7 -6
  29. package/e2e-legacy/ttyg/edit-agent.spec.js +69 -9
  30. package/e2e-legacy/ttyg/ttyg-initial-state-with-selected-repository.spec.js +4 -2
  31. package/e2e-legacy/ttyg/ttyg-permission.spec.js +28 -20
  32. package/e2e-security/setup/home/cookie-policy.spec.js +64 -0
  33. package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +184 -0
  34. package/e2e-security/setup/users-and-access/graphql-user.spec.js +123 -0
  35. package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +69 -0
  36. package/e2e-security/setup/users-and-access/turn-on-security-and-password-change.spec.js +87 -0
  37. package/e2e-security/setup/users-and-access/user-and-access.spec.js +87 -0
  38. package/e2e-security/setup/users-and-access/users-and-access-initial-state.spec.js +38 -0
  39. package/fixtures/repositories/free-access.json +13 -0
  40. package/fixtures/ttyg/agent/get-agent-defaults-assistant-api.json +44 -0
  41. package/fixtures/ttyg/agent/get-agent-defaults.json +2 -0
  42. package/npm-shrinkwrap.json +7574 -1775
  43. package/package.json +9 -3
  44. package/plugins/index.js +1 -0
  45. package/steps/base-steps.js +4 -0
  46. package/steps/error-steps.js +4 -7
  47. package/steps/graphql/graphql-endpoint-management-steps.js +1 -1
  48. package/steps/home-steps.js +57 -32
  49. package/steps/import/import-steps.js +2 -2
  50. package/steps/login-steps.js +11 -0
  51. package/steps/main-menu-steps.js +13 -6
  52. package/steps/operations-statuses-component-steps.js +5 -10
  53. package/steps/rdf-resource-search-steps.js +55 -0
  54. package/steps/repository-steps.js +1 -0
  55. package/steps/setup/autocomplete-steps.js +4 -0
  56. package/steps/setup/settings-steps.js +18 -0
  57. package/steps/setup/user-and-access-steps.js +24 -2
  58. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +74 -11
  59. package/steps/ttyg/ttyg-view-steps.js +19 -4
  60. package/steps/widgets/active-repository-widget-steps.js +4 -0
  61. package/steps/yasgui/yasr-steps.js +4 -0
  62. package/stubs/browser-stubs.js +21 -0
  63. package/stubs/environment-stubs.js +9 -1
  64. package/stubs/repositories/repositories-stubs.js +4 -0
  65. package/stubs/security-stubs.js +4 -0
  66. package/stubs/ttyg/ttyg-stubs.js +18 -2
  67. package/support/e2e.js +2 -1
  68. package/support/repository-commands.js +14 -1
  69. package/e2e-flaky/setup/users-and-access/security-and-free-access.spec.js +0 -57
  70. package/e2e-flaky/ttyg/ttyg-permission.spec.js +0 -67
  71. package/fixtures/locale-en.json +0 -3361
@@ -5,11 +5,9 @@ import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
5
5
  import {ToasterSteps} from "../../../steps/toaster-steps";
6
6
  import HomeSteps from "../../../steps/home-steps";
7
7
  import {LoginSteps} from "../../../steps/login-steps";
8
+ import {MainMenuSteps} from "../../../steps/main-menu-steps";
8
9
 
9
10
 
10
- /**
11
- * TODO: Fix me. Broken due to migration (Error: unknown)
12
- */
13
11
  describe('User and Access', () => {
14
12
 
15
13
  const PASSWORD = "password";
@@ -87,22 +85,22 @@ describe('User and Access', () => {
87
85
  // Then the 'create' button should be disabled
88
86
  UserAndAccessSteps.getConfirmUserCreateButton().should('be.disabled');
89
87
  // And the field should show an error
90
- UserAndAccessSteps.getFieldError().should('contain.text', 'Must be at least 2 symbols long');
88
+ UserAndAccessSteps.getCustomRoleFieldError().should('contain.text', 'Must be at least 2 symbols long');
91
89
  // When I add more text to the custom role tag
92
90
  UserAndAccessSteps.addTextToCustomRoleField('A{enter}');
93
91
  // Then the 'create' button should be enabled
94
92
  UserAndAccessSteps.getConfirmUserCreateButton().should('be.enabled');
95
93
  // And the field error should not exist
96
- UserAndAccessSteps.getFieldError().should('not.be.visible');
94
+ UserAndAccessSteps.getCustomRoleFieldError().should('not.be.visible');
97
95
 
98
96
  // When I type an invalid tag
99
97
  UserAndAccessSteps.addTextToCustomRoleField('B{enter}');
100
98
  // And the field shows an error
101
- UserAndAccessSteps.getFieldError().should('contain.text', 'Must be at least 2 symbols long');
99
+ UserAndAccessSteps.getCustomRoleFieldError().should('contain.text', 'Must be at least 2 symbols long');
102
100
  // When I delete the invalid text
103
101
  UserAndAccessSteps.addTextToCustomRoleField('{backspace}');
104
102
  // Then the error should not be visible
105
- UserAndAccessSteps.getFieldError().should('not.be.visible');
103
+ UserAndAccessSteps.getCustomRoleFieldError().should('not.be.visible');
106
104
  });
107
105
 
108
106
  it('Adding a role with a CUSTOM_ prefix shows a warning message', () => {
@@ -120,6 +118,36 @@ describe('User and Access', () => {
120
118
  UserAndAccessSteps.getUsersTable().should('be.visible');
121
119
  UserAndAccessSteps.getSplashLoader().should('not.be.visible');
122
120
  });
121
+
122
+ it('should toggle free access after Admin has logged in', () => {
123
+ // Given I have available repositories to allow Free Access for
124
+ RepositoriesStubs.stubRepositories();
125
+ RepositoriesStubs.stubFreeAccess();
126
+ // When I enable security
127
+ UserAndAccessSteps.toggleSecurity();
128
+ // When I log in as an Admin
129
+ LoginSteps.loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
130
+ // Then the page should load
131
+ UserAndAccessSteps.getSplashLoader().should('not.be.visible');
132
+ UserAndAccessSteps.getUsersTable().should('be.visible');
133
+ // The Free Access toggle should be OFF
134
+ UserAndAccessSteps.getFreeAccessSwitchInput().should('not.be.checked');
135
+ // When I toggle Free Access ON
136
+ UserAndAccessSteps.toggleFreeAccess();
137
+ // And I allow free access to a repository
138
+ ModalDialogSteps.getDialog().should('be.visible');
139
+ // Then I click OK in the modal
140
+ ModalDialogSteps.clickOKButton();
141
+ // Then the toggle button should be ON
142
+ UserAndAccessSteps.getFreeAccessSwitchInput().should('be.checked');
143
+ // And I should see a success message
144
+ ToasterSteps.verifySuccess('Free access has been enabled.');
145
+ UserAndAccessSteps.getUsersTable().should('be.visible');
146
+ // When I toggle Free Access OFF
147
+ UserAndAccessSteps.toggleFreeAccess();
148
+ // Then I should see a success message
149
+ ToasterSteps.verifySuccess('Free access has been disabled.');
150
+ });
123
151
  })
124
152
 
125
153
  context('GraphQL only', () => {
@@ -149,6 +177,7 @@ describe('User and Access', () => {
149
177
  cy.deleteRepository(repositoryId2, true);
150
178
  cy.deleteRepository(repositoryId3, true);
151
179
  cy.deleteUser(graphqlUser, true);
180
+ cy.switchOffFreeAccess(true);
152
181
  cy.switchOffSecurity(true);
153
182
  });
154
183
 
@@ -424,9 +453,9 @@ describe('User and Access', () => {
424
453
  function navigateMenuPath(pathArray, expectedUrl, expectedTitle) {
425
454
  pathArray.forEach((label, index) => {
426
455
  if (index === 0) {
427
- UserAndAccessSteps.clickMenuItem(label);
456
+ MainMenuSteps.clickOnMenu(label);
428
457
  } else {
429
- UserAndAccessSteps.clickSubmenuItem(label);
458
+ MainMenuSteps.clickOnSubMenu(label);
430
459
  const title = expectedTitle ? expectedTitle : label;
431
460
  cy.get('h1').should('contain', title);
432
461
  }
@@ -4,10 +4,8 @@ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
4
4
  import {SavedQuery} from "../../../steps/yasgui/saved-query";
5
5
  import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
6
6
  import {SaveQueryDialog} from "../../../steps/yasgui/save-query-dialog";
7
+ import {RepositorySelectorSteps} from "../../../steps/repository-selector-steps";
7
8
 
8
- /**
9
- * TODO: Fix me. Broken due to migration (Error: beforeEach)
10
- */
11
9
  describe('Edit saved queries', () => {
12
10
 
13
11
  let repositoryId;
@@ -22,7 +20,7 @@ describe('Edit saved queries', () => {
22
20
  QueryStubs.stubDefaultQueryResponse(repositoryId);
23
21
 
24
22
  SparqlEditorSteps.visitSparqlEditorPage();
25
- YasguiSteps.getYasgui().should('be.visible');
23
+ RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
26
24
  });
27
25
 
28
26
  afterEach(() => {
@@ -57,8 +55,7 @@ describe('Edit saved queries', () => {
57
55
  SaveQueryDialog.closeSaveQueryDialog();
58
56
  });
59
57
 
60
- // TODO skipped until .env can be updated with BE version, which includes the API changes
61
- it.skip('should allow renaming saved query', () => {
58
+ it('should allow renaming saved query', () => {
62
59
  // Given I have created a query
63
60
  SavedQuery.create(savedQueryName);
64
61
  // When I open the saved queries popup
@@ -45,8 +45,8 @@ describe('Share saved queries', () => {
45
45
  ApplicationSteps.getSuccessNotifications().should('be.visible');
46
46
  });
47
47
 
48
- // TODO: Fix me. Broken due to migration (Error: unknown)
49
- it.skip('Should be able to open a share link in a new editor tab', () => {
48
+ // FIX: Skipped because the functionality is not working. There is a bug in the application https://graphwise.atlassian.net/browse/GDB-12633
49
+ it('Should be able to open a share link in a new editor tab', () => {
50
50
  // Given I have created a query
51
51
  YasguiSteps.getTabs().should('have.length', 1);
52
52
  const savedQueryName = SavedQuery.generateQueryName();
@@ -2,6 +2,7 @@ import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
2
2
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
4
4
  import {RepositoriesStub} from "../../stubs/repositories-stub";
5
+ import {TtygAgentSettingsModalSteps} from "../../steps/ttyg/ttyg-agent-settings-modal.steps";
5
6
 
6
7
  describe('TTYG agent list', () => {
7
8
  beforeEach(() => {
@@ -80,14 +81,48 @@ describe('TTYG agent list', () => {
80
81
  TTYGViewSteps.visit();
81
82
  // Then: Only the delete action should be available for incompatible agents
82
83
  TTYGViewSteps.expandAgentsSidebar();
83
- TTYGViewSteps.openAgentActionMenu(0);
84
+ TTYGViewSteps.getAgentsPanel(0).should('be.visible');
85
+ TTYGViewSteps.getOpenAgentActionsButton(0).should('be.visible');
86
+ TTYGViewSteps.toggleAgentActionMenu(0);
84
87
  TTYGViewSteps.getDeleteAgentButton(0).should('be.visible');
85
88
  TTYGViewSteps.getCloneAgentButton(0).should('not.exist');
86
89
  TTYGViewSteps.getEditAgentButton(0).should('not.exist');
90
+ TTYGViewSteps.toggleAgentActionMenu(0);
87
91
  // And: All actions should be available for compatible agents
88
- TTYGViewSteps.openAgentActionMenu(1);
92
+ TTYGViewSteps.toggleAgentActionMenu(1);
89
93
  TTYGViewSteps.getDeleteAgentButton(1).should('be.visible');
90
94
  TTYGViewSteps.getCloneAgentButton(1).should('be.visible');
91
95
  TTYGViewSteps.getEditAgentButton(1).should('be.visible');
92
96
  });
97
+
98
+ it('should allow copy of External integration configuration from agent list', () => {
99
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-autocomplete-query.json');
100
+ TTYGStubs.getExternalUrl();
101
+ // Given I have opened the ttyg page
102
+ TTYGViewSteps.visit();
103
+ cy.wait('@get-agent-list');
104
+ // When I select an agent from the sidebar
105
+ TTYGViewSteps.expandAgentsSidebar();
106
+ TTYGViewSteps.toggleAgentActionMenu(0);
107
+ TTYGViewSteps.getExternalIntegrationConfigButton(0).should('be.visible');
108
+ TTYGViewSteps.openExternalIntegrationConfigButton(0);
109
+ cy.wait('@external-url');
110
+ // The url dialog should open
111
+ TtygAgentSettingsModalSteps.getExternalIntegrationModal().should('be.visible');
112
+ // The dialog should have all the fields
113
+ TtygAgentSettingsModalSteps.getAgentUrlField().invoke('val')
114
+ .then((val) => {
115
+ expect(val).to.equal('asst_G8EtHyT8kAGeDmCa3Nh6y74v');
116
+ });
117
+
118
+ TtygAgentSettingsModalSteps.getMethodUrlField().invoke('val')
119
+ .then((val) => {
120
+ expect(val).to.equal('http://user-pc:7200/rest/llm/tool/ttyg/asst_G8EtHyT8kAGeDmCa3Nh6y74v');
121
+ });
122
+
123
+ TtygAgentSettingsModalSteps.getDifyUrlField().invoke('val')
124
+ .then((val) => {
125
+ expect(val).to.equal('http://user-pc:7200/rest/llm/ttyg/asst_G8EtHyT8kAGeDmCa3Nh6y74v/dify');
126
+ });
127
+ });
93
128
  });
@@ -8,8 +8,7 @@ import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
8
8
  import {AlertDialogSteps} from "../../steps/alert-dialog-steps";
9
9
  import {RepositoriesStub} from "../../stubs/repositories-stub";
10
10
 
11
- // TODO: Fix me. Broken due to migration (Error: unknown)
12
- describe.skip('TTYG chat list', () => {
11
+ describe('TTYG chat list', () => {
13
12
 
14
13
  beforeEach(() => {
15
14
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
@@ -51,6 +51,7 @@ describe('TTYG clone an agent', () => {
51
51
  "name": "agent-11",
52
52
  "repositoryId": "starwars",
53
53
  "model": "gpt-4o",
54
+ "contextSize": 128000,
54
55
  "temperature": 0,
55
56
  "topP": 0,
56
57
  "seed": 0,
@@ -105,12 +105,12 @@ describe('TTYG create new agent', () => {
105
105
 
106
106
  // Validate the other agent settings
107
107
 
108
- // gpt model
109
- TtygAgentSettingsModalSteps.getGptModelField().should('have.value', 'gpt-4o');
110
- TtygAgentSettingsModalSteps.clearGptModel();
108
+ // LLM model
109
+ TtygAgentSettingsModalSteps.getLLMModelField().should('have.value', 'gpt-4o');
110
+ TtygAgentSettingsModalSteps.clearLLMModel();
111
111
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
112
- TtygAgentSettingsModalSteps.getGptModelError().should('be.visible').and('contain', 'This field is required');
113
- TtygAgentSettingsModalSteps.typeGptModel('gpt-4o');
112
+ TtygAgentSettingsModalSteps.getLLMModelError().should('be.visible').and('contain', 'This field is required');
113
+ TtygAgentSettingsModalSteps.typeLLMModel('gpt-4o');
114
114
 
115
115
  // temperature
116
116
  TtygAgentSettingsModalSteps.setTemperature('0.2');
@@ -148,6 +148,7 @@ describe('TTYG create new agent', () => {
148
148
  "name": "Test Agent",
149
149
  "repositoryId": "starwars",
150
150
  "model": "gpt-4o",
151
+ "contextSize": 128000,
151
152
  "temperature": "0.2",
152
153
  "topP": "0.2",
153
154
  "seed": 0,
@@ -480,7 +481,7 @@ describe('TTYG create new agent', () => {
480
481
  TtygAgentSettingsModalSteps.setTemperature('1.2');
481
482
  TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '1.2');
482
483
  // Then I should see a warning message
483
- TtygAgentSettingsModalSteps.getTemperatureWarning().should('be.visible');
484
+ TtygAgentSettingsModalSteps.scrollToTemperatureWarning().should('be.visible');
484
485
  TtygAgentSettingsModalSteps.getTemperatureField().should('have.class', 'has-warning');
485
486
  // When I change the temperature to value below 1.0
486
487
  TtygAgentSettingsModalSteps.setTemperature('0.9');
@@ -32,10 +32,7 @@ describe('TTYG edit an agent', () => {
32
32
  cy.wait('@get-agent-list');
33
33
  cy.wait('@get-chat');
34
34
  // When I select an agent that don't have activated additional extraction method
35
- TTYGViewSteps.expandAgentsSidebar();
36
- TTYGViewSteps.openAgentsMenu();
37
- TTYGViewSteps.selectAgent(0);
38
- TTYGViewSteps.editCurrentAgent();
35
+ TTYGViewSteps.openAgentSettingsModalForAgent(0);
39
36
 
40
37
  // Then I expect that the iri discovery checkbox is not checked
41
38
  TtygAgentSettingsModalSteps.getIriDiscoverySearchCheckbox().should('not.be.checked');
@@ -54,7 +51,7 @@ describe('TTYG edit an agent', () => {
54
51
  });
55
52
 
56
53
 
57
- it.skip('should be able to edit Autocomplete extraction method option', {
54
+ it('should be able to edit Autocomplete extraction method option', {
58
55
  retries: {
59
56
  runMode: 1,
60
57
  openMode: 0
@@ -65,10 +62,7 @@ describe('TTYG edit an agent', () => {
65
62
  TTYGViewSteps.visit();
66
63
  cy.wait('@get-agent-list');
67
64
  // When I select an agent that don't have activated additional extraction method
68
- TTYGViewSteps.expandAgentsSidebar();
69
- TTYGViewSteps.openAgentsMenu();
70
- TTYGViewSteps.selectAgent(0);
71
- TTYGViewSteps.editCurrentAgent();
65
+ TTYGViewSteps.openAgentSettingsModalForAgent(0);
72
66
 
73
67
  // Then I expect that the autocomplete iri discovery checkbox is not checked
74
68
  TtygAgentSettingsModalSteps.getAutocompleteSearchCheckbox().should('not.be.checked');
@@ -106,4 +100,70 @@ describe('TTYG edit an agent', () => {
106
100
  // Then: I expect the dialog be disappeared and the disabled message still visible
107
101
  TtygAgentSettingsModalSteps.getAutocompleteDisabledMessage().should('be.visible');
108
102
  });
103
+
104
+ it('should allow copy of External integration configuration', () => {
105
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-autocomplete-query.json');
106
+ TTYGStubs.getExternalUrl();
107
+ // Given I have opened the ttyg page
108
+ TTYGViewSteps.visit();
109
+ cy.wait('@get-agent-list');
110
+ // When I select an agent
111
+ TTYGViewSteps.openAgentSettingsModalForAgent(0);
112
+
113
+ // Then I should see the External integration configuration button
114
+ TtygAgentSettingsModalSteps.getExtIntegrationConfigBtn().should('be.visible');
115
+ // When I click the button
116
+ TtygAgentSettingsModalSteps.openExtIntegrationConfig();
117
+ cy.wait('@external-url');
118
+ // The url dialog should open
119
+ TtygAgentSettingsModalSteps.getExternalIntegrationModal().should('be.visible');
120
+ // The dialog should have all the fields
121
+ TtygAgentSettingsModalSteps.getAgentUrlField().invoke('val')
122
+ .then((val) => {
123
+ expect(val).to.equal('asst_G8EtHyT8kAGeDmCa3Nh6y74v');
124
+ });
125
+
126
+ TtygAgentSettingsModalSteps.getMethodUrlField().invoke('val')
127
+ .then((val) => {
128
+ expect(val).to.equal('http://user-pc:7200/rest/llm/tool/ttyg/asst_G8EtHyT8kAGeDmCa3Nh6y74v');
129
+ });
130
+
131
+ TtygAgentSettingsModalSteps.getDifyUrlField().invoke('val')
132
+ .then((val) => {
133
+ expect(val).to.equal('http://user-pc:7200/rest/llm/ttyg/asst_G8EtHyT8kAGeDmCa3Nh6y74v/dify');
134
+ });
135
+ });
136
+
137
+ it('should show Context size if not openai-assistants API', () => {
138
+ // Open TTYG page and select first agent
139
+ TTYGViewSteps.visit();
140
+ TTYGStubs.stubForApiType('default');
141
+ cy.wait('@get-agent-list');
142
+ TTYGViewSteps.openAgentSettingsModalForAgent(0);
143
+
144
+ // Then I should see the Context size field
145
+ TtygAgentSettingsModalSteps.getContextSizeField().should('be.visible');
146
+ // When I clear the value
147
+ TtygAgentSettingsModalSteps.clearContextSize();
148
+ // And click another field
149
+ TtygAgentSettingsModalSteps.clickLLMModelField();
150
+ // Then the error for required should appear
151
+ TtygAgentSettingsModalSteps.getContextSizeError().should('be.visible');
152
+ // When I type a value
153
+ TtygAgentSettingsModalSteps.enterContextSize('120000');
154
+ // Then the error disappears
155
+ TtygAgentSettingsModalSteps.getContextSizeError().should('not.exist');
156
+ // I should be allowed to reset the value of the Context size
157
+ TtygAgentSettingsModalSteps.resetContextSizeValue();
158
+ });
159
+
160
+ it('should NOT show Context size if openai-assistants API', () => {
161
+ // Open TTYG page and select first agent
162
+ TTYGViewSteps.visit();
163
+ TTYGStubs.stubForApiType('assistants');
164
+ cy.wait('@get-agent-list');
165
+ TTYGViewSteps.openAgentSettingsModalForAgent(0);
166
+ // Then I should see the Context size field
167
+ TtygAgentSettingsModalSteps.getContextSizeField().should('not.exist');
168
+ });
109
169
  });
@@ -10,10 +10,12 @@ function verifyStateWithSelectedRepository() {
10
10
  TTYGViewSteps.getApiKeyMessage().should('be.visible');
11
11
  TTYGViewSteps.getMissingApiKeyToastMessage()
12
12
  .should('be.visible')
13
- .and('contain', 'Set the config property graphdb.openai.api-key to your OpenAI API key');
13
+ .and('contain', 'Set the config property \'graphdb.llm.api-key\' to your LLM API key.');
14
14
  }
15
15
 
16
- describe('TTYG initial state with selected repository', () => {
16
+ // TODO: skipped until BE releases an updated version with the new API key.
17
+ // https://graphwise.atlassian.net/browse/GDB-12738
18
+ describe.skip('TTYG initial state with selected repository', () => {
17
19
  let repositoryId;
18
20
 
19
21
  beforeEach(() => {
@@ -1,9 +1,12 @@
1
1
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
2
2
  import {RepositoriesStub} from "../../stubs/repositories-stub";
3
- import {UserAndAccessSteps} from "../../steps/setup/user-and-access-steps";
4
3
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
5
4
  import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
5
+ import {LoginSteps} from "../../steps/login-steps";
6
+ import {SecurityStubs} from "../../stubs/security-stubs";
7
+ import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
6
8
 
9
+ const REPOSITORY_ID = 'starwars';
7
10
  const USER_WITH_ROLE_USER = 'ttyg_user';
8
11
  const USER_WITH_ROLE_REPO_MANAGER = 'ttyg_repo_manager';
9
12
  const USER_ADMINISTRATOR = 'admin';
@@ -11,42 +14,43 @@ const PASSWORD = 'root';
11
14
  const ENABLED = true;
12
15
  const DISABLED = false;
13
16
 
14
- /**
15
- * TODO: Fix me. Broken due to migration (The issue GDB-11317 not implemented)
16
- */
17
- describe.skip('TTYG permissions', () => {
18
-
17
+ describe('TTYG permissions', () => {
19
18
 
20
19
  before(() => {
21
- RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
22
- RepositoriesStub.stubBaseEndpoints('starwars');
23
- cy.presetRepository('starwars');
20
+ cy.loginAsAdmin();
24
21
  cy.createUser({username: USER_WITH_ROLE_USER, password: PASSWORD});
25
22
  cy.createUser({
26
23
  username: USER_WITH_ROLE_REPO_MANAGER,
27
24
  password: PASSWORD,
28
25
  grantedAuthorities: ["ROLE_REPO_MANAGER", "WRITE_REPO_*", "READ_REPO_*"]
29
26
  });
30
- UserAndAccessSteps.visit();
31
- UserAndAccessSteps.toggleSecurity();
27
+ cy.switchOnSecurity();
32
28
  });
33
29
 
30
+ beforeEach(() => {
31
+ SecurityStubs.spyOnAuthenticatedUser();
32
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
33
+ RepositoriesStub.stubBaseEndpoints(REPOSITORY_ID);
34
+ })
35
+
34
36
  after(() => {
35
- UserAndAccessSteps.visit();
36
- UserAndAccessSteps.loginWithUser(USER_ADMINISTRATOR, PASSWORD);
37
- UserAndAccessSteps.toggleSecurity();
38
- cy.deleteUser(USER_WITH_ROLE_USER);
39
- cy.deleteUser(USER_WITH_ROLE_REPO_MANAGER);
37
+ cy.loginAsAdmin();
38
+ cy.deleteUser(USER_WITH_ROLE_USER, true);
39
+ cy.deleteUser(USER_WITH_ROLE_REPO_MANAGER, true);
40
+ cy.switchOffSecurity(true);
40
41
  });
41
42
 
42
- it('should disable all buttons that can modify the agent', () => {
43
-
43
+ it('should disable all buttons that can modify the agent when user is with ROLE_USER', () => {
44
44
  // When I log in with a user who has the ROLE_USER role, I expect all buttons modifying the agent to be disabled.
45
45
  verifyCanCreateAgentForFirstTime(USER_WITH_ROLE_USER, PASSWORD, DISABLED);
46
+ });
46
47
 
48
+ it('should enable all buttons that can modify the agent when user is with role ROLE_REPO_MANAGER', () => {
47
49
  // When I log in with a user who has the ROLE_REPO_MANAGER role, I expect all buttons modifying the agent to be enabled.
48
50
  verifyCanCreateAgentForFirstTime(USER_WITH_ROLE_REPO_MANAGER, PASSWORD, ENABLED);
51
+ });
49
52
 
53
+ it('should enable all buttons that can modify the agent when user is admin', () => {
50
54
  // When I log in with a user who is administrator, I expect all buttons modifying the agent to be enabled.
51
55
  verifyCanCreateAgentForFirstTime(USER_ADMINISTRATOR, PASSWORD, ENABLED);
52
56
  });
@@ -55,7 +59,12 @@ describe.skip('TTYG permissions', () => {
55
59
  const shouldBe = enable ? 'be.enabled' : 'be.disabled';
56
60
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
57
61
  TTYGViewSteps.visit();
58
- UserAndAccessSteps.loginWithUser(user, password);
62
+ cy.url().should('include', '/login');
63
+ cy.wait('@get-authenticated-user');
64
+ cy.wait('@get-authenticated-user');
65
+ cy.wait('@get-authenticated-user');
66
+ LoginSteps.loginWithUser(user, password);
67
+ RepositorySelectorSteps.selectRepository(REPOSITORY_ID);
59
68
  TTYGViewSteps.getCreateFirstAgentButton().should(shouldBe);
60
69
  TTYGStubs.stubChatsListGet();
61
70
  TTYGStubs.stubAgentListGet();
@@ -64,6 +73,5 @@ describe.skip('TTYG permissions', () => {
64
73
  TTYGViewSteps.getCreateAgentButton().should(shouldBe);
65
74
  TTYGViewSteps.getEditCurrentAgentButton().should(shouldBe);
66
75
  TTYGViewSteps.getToggleAgentsSidebarButton().should(shouldBe);
67
- UserAndAccessSteps.logout();
68
76
  }
69
77
  });
@@ -0,0 +1,64 @@
1
+ import {UserAndAccessSteps} from "../../../steps/setup/user-and-access-steps";
2
+ import {LicenseStubs} from "../../../stubs/license-stubs";
3
+ import {LoginSteps} from "../../../steps/login-steps";
4
+ import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
5
+ import HomeSteps from "../../../steps/home-steps";
6
+
7
+ Cypress.env('set_default_user_data', false);
8
+
9
+ describe('Cookie policy', () => {
10
+
11
+ let repository;
12
+
13
+ beforeEach(() => {
14
+ cy.loginAsAdmin().then(() => {
15
+ cy.switchOffFreeAccess(true);
16
+ cy.switchOffSecurity(true);
17
+ });
18
+ cy.setDefaultUserData(false);
19
+ LicenseStubs.stubFreeLicense();
20
+ repository = 'cypress-test-cookie-policy-security-' + Date.now();
21
+ cy.createRepository({id: repository});
22
+ });
23
+
24
+ afterEach(() => {
25
+ cy.deleteRepository(repository, true);
26
+ cy.loginAsAdmin().then(() => {
27
+ cy.switchOffFreeAccess(true);
28
+ cy.switchOffSecurity(true);
29
+ cy.setDefaultUserData();
30
+ });
31
+ });
32
+
33
+ it('should show the consent popup if free access is on and the user is on the login page', () => {
34
+ // Given: Security is enabled and free access is on
35
+ UserAndAccessSteps.visitInProdMode();
36
+ UserAndAccessSteps.toggleSecurity();
37
+ LoginSteps.loginWithUser('admin', 'root');
38
+ // And: Free access is enabled
39
+ UserAndAccessSteps.getFreeAccessSwitchInput().should('not.be.checked');
40
+ UserAndAccessSteps.toggleFreeAccess();
41
+ UserAndAccessSteps.clickFreeWriteAccessRepo(repository);
42
+ ModalDialogSteps.clickOKButton();
43
+
44
+ // When: The user visits the login page
45
+ LoginSteps.visitInProdMode();
46
+ // Then: The cookie policy popup should be shown
47
+ HomeSteps.getCookieConsentPopup().should('exist').and('be.visible');
48
+ });
49
+
50
+ it('should not show the consent popup if free access is off and the user is on the login page', () => {
51
+ // Given: Security is enabled and free access is off
52
+ UserAndAccessSteps.visitInProdMode();
53
+ UserAndAccessSteps.toggleSecurity();
54
+ LoginSteps.loginWithUser('admin', 'root');
55
+ UserAndAccessSteps.getFreeAccessSwitchInput().should('not.be.checked');
56
+
57
+ // When: The user logs out and visits the login page
58
+ LoginSteps.logout();
59
+ // Then: The cookie policy popup should not be shown
60
+ HomeSteps.getCookieConsentPopup().should('not.exist');
61
+ LoginSteps.visitInProdMode();
62
+ HomeSteps.getCookieConsentPopup().should('not.exist');
63
+ });
64
+ });