graphdb-workbench-tests 3.1.3 → 3.2.0-RC1

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.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.1.3",
3
+ "version": "3.2.0-RC1",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
+ "type": "module",
5
6
  "scripts": {
6
7
  "prepack": "npm shrinkwrap",
7
8
  "postpack": "mv npm-shrinkwrap.json package-lock.json",
@@ -16,7 +17,8 @@
16
17
  "cy:run-legacy:coverage": "cypress run --config-file cypress-legacy.config.js --browser chrome",
17
18
  "cy:run-flaky": "cypress run --config-file cypress-flaky.config.js --browser chrome",
18
19
  "test": "npm run cy:run-legacy",
19
- "test:core": "cypress run --spec e2e-legacy/repository/**,e2e-legacy/import/**,e2e-legacy/sparql-editor/**,e2e-legacy/monitor/**,e2e-legacy/cluster/**,e2e-legacy/ttyg/**"
20
+ "test:core": "cypress run --spec e2e-legacy/repository/**,e2e-legacy/import/**,e2e-legacy/sparql-editor/**,e2e-legacy/monitor/**,e2e-legacy/cluster/**,e2e-legacy/ttyg/**",
21
+ "lint": "eslint '**/*.{js,mjs,cjs}'"
20
22
  },
21
23
  "author": {
22
24
  "name": "Ontotext AD",
@@ -33,6 +35,9 @@
33
35
  },
34
36
  "devDependencies": {
35
37
  "@bahmutov/cypress-code-coverage": "^2.7.2",
38
+ "@cypress/webpack-preprocessor": "^7.0.1",
39
+ "@eslint/js": "^9.33.0",
40
+ "babel-loader": "^10.0.0",
36
41
  "babel-plugin-istanbul": "^7.0.0",
37
42
  "cypress": "14.5.1",
38
43
  "cypress-failed-log": "^2.10.0",
@@ -44,7 +49,11 @@
44
49
  "cypress-wait-until": "^3.0.2",
45
50
  "del": "^8.0.0",
46
51
  "dotenv": "^17.0.1",
52
+ "eslint": "^9.33.0",
53
+ "eslint-plugin-cypress": "^5.1.0",
54
+ "globals": "^16.3.0",
47
55
  "minimist": "^1.2.8",
48
- "mocha-junit-reporter": "^2.2.1"
56
+ "mocha-junit-reporter": "^2.2.1",
57
+ "path-browserify": "^1.0.1"
49
58
  }
50
59
  }
package/plugins/index.js CHANGED
@@ -11,17 +11,20 @@
11
11
  // This function is called when a project is opened or re-opened (e.g. due to
12
12
  // the project's config changing)
13
13
 
14
- const deleteSync = require('del').deleteSync;
14
+ import { deleteSync } from 'del';
15
+ import failed from 'cypress-failed-log/src/failed.js';
16
+ import installLogsPrinter from 'cypress-terminal-report/src/installLogsPrinter.js';
17
+
15
18
  const retryTracker = {};
16
19
 
17
- module.exports = (on, config) => {
20
+ export default (on, config) => {
18
21
  // `on` is used to hook into various events Cypress emits
19
22
  // `config` is the resolved Cypress config
20
23
  on('task', {
21
- failed: require('cypress-failed-log/src/failed')()
24
+ failed: failed()
22
25
  });
23
26
 
24
- require('cypress-terminal-report/src/installLogsPrinter')(on, {
27
+ installLogsPrinter(on, {
25
28
  logToFilesOnAfterRun: true,
26
29
  printLogsToConsole: 'onFail',
27
30
  outputRoot: config.projectRoot + '/logs/',
@@ -95,5 +98,6 @@ module.exports = (on, config) => {
95
98
  printGroup('[FAIL] Broken tests', broken);
96
99
  console.log('====================================================================================================\n');
97
100
  });
101
+
98
102
  return config;
99
103
  };
@@ -15,7 +15,7 @@ class HomeSteps extends BaseSteps {
15
15
 
16
16
  static visitInProdMode() {
17
17
  cy.visit('/', {
18
- onBeforeLoad: (win) => {
18
+ onBeforeLoad: () => {
19
19
  EnvironmentStubs.stubWbProdMode();
20
20
  }
21
21
  });
@@ -23,7 +23,7 @@ class HomeSteps extends BaseSteps {
23
23
 
24
24
  static visitInDevMode() {
25
25
  cy.visit('/', {
26
- onBeforeLoad: (win) => {
26
+ onBeforeLoad: () => {
27
27
  EnvironmentStubs.stubWbDevMode();
28
28
  }
29
29
  });
@@ -135,11 +135,17 @@ class HomeSteps extends BaseSteps {
135
135
  static selectSPARQLQueryToExecute(query) {
136
136
  cy.contains('ul.saved-queries li', query)
137
137
  .should('be.visible')
138
- .trigger('hover')
138
+ .as('savedQueryItem');
139
+
140
+ cy.get('@savedQueryItem')
141
+ .trigger('hover');
142
+
143
+ cy.get('@savedQueryItem')
139
144
  .find('.execute-saved-query')
140
- .click({force: true});
145
+ .click({ force: true });
141
146
  }
142
147
 
148
+
143
149
  static verifyQueryLink(queryName, modifiesRepoModal) {
144
150
  HomeSteps.selectSPARQLQueryToExecute(queryName);
145
151
  modifiesRepoModal ? cy.get('.modal-body').should('be.visible') : cy.get('.modal-body').should('not.exist');
@@ -188,7 +194,7 @@ class HomeSteps extends BaseSteps {
188
194
  HomeSteps.getCreateRepositoryLink()
189
195
  .click()
190
196
  .url()
191
- .should('eq', Cypress.config("baseUrl") + '/repository/create?previous=home');
197
+ .should('eq', Cypress.config("baseUrl") + '/repository/create?previous=%2F');
192
198
  });
193
199
  cy.get('.big-logo').click();
194
200
  }
@@ -205,9 +211,8 @@ class HomeSteps extends BaseSteps {
205
211
  }
206
212
 
207
213
  static getAutocompleteInput() {
208
- const input = cy.get('.home-rdf-resource-search search-resource-input .view-res-input');
209
- input.should('be.visible');
210
- return input;
214
+ return cy.get('.home-rdf-resource-search search-resource-input .view-res-input')
215
+ .should('be.visible');
211
216
  }
212
217
 
213
218
  static shouldHaveAutocompleteResult(uri) {
@@ -220,9 +225,9 @@ class HomeSteps extends BaseSteps {
220
225
  }
221
226
 
222
227
  static getAutocompleteResultElement(uri) {
223
- const element = cy.get("#auto-complete-results-wrapper p").contains(uri);
224
- element.trigger('mouseover');
225
- return element;
228
+ return cy.get('#auto-complete-results-wrapper p')
229
+ .contains(uri)
230
+ .trigger('mouseover');
226
231
  }
227
232
 
228
233
  static verifyAutocompleteResourceLink(uri) {
@@ -15,15 +15,15 @@ export class OperationsStatusesComponentSteps {
15
15
  }
16
16
 
17
17
  static getQueriesOperationStatusHeaderElement() {
18
- return OperationsStatusesComponentSteps.getOperationStatusHeader('.fa-arrow-right-arrow-left');
18
+ return OperationsStatusesComponentSteps.getOperationStatusHeader('.ri-arrow-left-right-line');
19
19
  }
20
20
 
21
21
  static getBackupAndRestoreOperationStatusHeaderElement() {
22
- return OperationsStatusesComponentSteps.getOperationStatusHeader('.fa-archive');
22
+ return OperationsStatusesComponentSteps.getOperationStatusHeader('.ri-archive-line');
23
23
  }
24
24
 
25
25
  static getClusterOperationStatusHeaderElement() {
26
- return OperationsStatusesComponentSteps.getOperationStatusHeader('.fa-sitemap');
26
+ return OperationsStatusesComponentSteps.getOperationStatusHeader('.ri-organization-chart');
27
27
  }
28
28
 
29
29
  static getOperationStatuses() {
@@ -7,7 +7,7 @@ export class UserAndAccessSteps {
7
7
 
8
8
  static visitInProdMode() {
9
9
  cy.visit('/users', {
10
- onBeforeLoad: (win) => {
10
+ onBeforeLoad: () => {
11
11
  EnvironmentStubs.stubWbProdMode();
12
12
  }
13
13
  });
@@ -186,7 +186,7 @@ export class UserAndAccessSteps {
186
186
  }
187
187
 
188
188
  static getPermissionError() {
189
- return cy.get('.permission-banner');
189
+ return cy.getByTestId('restricted-access-banner');
190
190
  }
191
191
 
192
192
  static getModal() {
@@ -294,7 +294,7 @@ export class UserAndAccessSteps {
294
294
  }
295
295
 
296
296
  static findGraphqlIconAlias(repoLineAlias) {
297
- return cy.get(repoLineAlias).find('.fa-gdb-graphql');
297
+ return cy.get(repoLineAlias).find('.icon-graphql');
298
298
  }
299
299
 
300
300
  static openEditUserPage(username) {
@@ -16,6 +16,10 @@ export class ChatPanelSteps {
16
16
  return ChatPanelSteps.getChatDetailElement(chatDetailIndex).find('.actions').eq(answerIndex);
17
17
  }
18
18
 
19
+ static getAssistantAnswer(index) {
20
+ return ChatPanelSteps.getChatPanel().find('.assistant-message markdown-content').eq(index);
21
+ }
22
+
19
23
  static getQuestionInputElement() {
20
24
  return ChatPanelSteps.getChatPanel().find('.question-input .contenteditable');
21
25
  }
@@ -24,6 +28,10 @@ export class ChatPanelSteps {
24
28
  return ChatPanelSteps.getChatPanel().find('.ask-button');
25
29
  }
26
30
 
31
+ static askQuestion() {
32
+ ChatPanelSteps.getAskButtonElement().scrollIntoView().click();
33
+ }
34
+
27
35
  static getChatDetailQuestionElement(index = 0) {
28
36
  return ChatPanelSteps.getChatDetailElement(index).find('.question');
29
37
  }
@@ -59,4 +67,16 @@ export class ChatPanelSteps {
59
67
  static getCopyToClipboardElement(index = 0) {
60
68
  return ChatPanelSteps.getCopyToClipboardElements().eq(index);
61
69
  }
70
+
71
+ static getCancelButton() {
72
+ return ChatPanelSteps.getChatPanel().find('.cancel-ask-button');
73
+ }
74
+
75
+ static cancelQuestion() {
76
+ ChatPanelSteps.getCancelButton().click();
77
+ }
78
+
79
+ static getAssistantIcon(index) {
80
+ return ChatPanelSteps.getChatDetailElement(index).find('.assistant-icon');
81
+ }
62
82
  }
@@ -227,7 +227,7 @@ export class TtygAgentSettingsModalSteps extends ModalDialogSteps {
227
227
  }
228
228
 
229
229
  static clickOnSimilaritySearchIndexMissingHelp() {
230
- this.getSimilaritySearchIndexMissingHelp().find('a').click();
230
+ this.getSimilaritySearchIndexMissingHelp().find('a').eq(0).click();
231
231
  }
232
232
 
233
233
  static getSimilarityIndexFormGroup() {
@@ -235,7 +235,11 @@ export class TtygAgentSettingsModalSteps extends ModalDialogSteps {
235
235
  }
236
236
 
237
237
  static getSimilarityIndexField() {
238
- return this.getSimilarityIndexFormGroup().find('select');
238
+ return this.getSimilarityIndexFormGroup().find('#connectorInstances');
239
+ }
240
+
241
+ static getSimilarityIndexSelectedOption() {
242
+ return this.getSimilarityIndexField().find('option:selected');
239
243
  }
240
244
 
241
245
  static selectSimilarityIndex(index) {
@@ -246,6 +250,14 @@ export class TtygAgentSettingsModalSteps extends ModalDialogSteps {
246
250
  this.getSimilarityIndexField().find('option:selected').should('have.text', similarityIndex);
247
251
  }
248
252
 
253
+ static getSimilarityIndexVectorFieldsField() {
254
+ return this.getSimilarityIndexFormGroup().find('select#vectorFieldsSelect');
255
+ }
256
+
257
+ static getSimilarityIndexSelectedVectorFieldsValue() {
258
+ return this.getSimilarityIndexVectorFieldsField().find('option:selected');
259
+ }
260
+
249
261
  static getSimilarityIndexThresholdFormGroup() {
250
262
  return this.getExtractionMethodPanel('similarity_search').find('.similarity-index-threshold');
251
263
  }
@@ -86,8 +86,16 @@ export class TTYGStubs extends Stubs {
86
86
  }).as('get-agent-list');
87
87
  }
88
88
 
89
+ static getSimilarityIndexesForRepo(repositoryId, fixture = '/ttyg/agent/get-similarity-indexes.json', delay = 0) {
90
+ cy.intercept('GET', `rest/similarity/${repositoryId}/indexes`, {
91
+ fixture: fixture,
92
+ statusCode: 200,
93
+ delay: delay
94
+ }).as('get-similarity-indexes');
95
+ }
96
+
89
97
  static stubAgentListWithIncompatibleGet(delay = 0) {
90
- this.stubAgentListGet('/ttyg/agent/get-agent-list-with-incompatible-agents.json');
98
+ this.stubAgentListGet('/ttyg/agent/get-agent-list-with-incompatible-agents.json', delay);
91
99
  }
92
100
 
93
101
  static stubAgentGet(fixture = '/ttyg/agent/get-agent.json', delay = 0) {
@@ -143,22 +151,52 @@ export class TTYGStubs extends Stubs {
143
151
  }
144
152
 
145
153
  static stubAnswerQuestion(fixture = '/ttyg/chats/ask-question.json') {
146
- cy.intercept('POST', '/rest/chat/conversations', {
154
+ cy.intercept('POST', '/rest/chat/chats/**/question', {
147
155
  fixture,
148
156
  statusCode: 200
149
157
  }).as('get-agent-defaults');
150
158
  }
151
159
 
152
- static stubCrateNewChat(fixture = 'ttyg/chats/create/create-chat-response.json') {
153
- cy.fixture(fixture).then((fixtureData) => {
160
+ static stubAnswerQuestionWithDelay(fixture = '/ttyg/chats/ask-question-cancel.json', delay = 1000) {
161
+ cy.intercept({
162
+ method: 'POST',
163
+ url: '/rest/chat/chats/**/question',
164
+ }, (req) => {
165
+ req.reply({
166
+ fixture,
167
+ statusCode: 200,
168
+ delay
169
+ });
170
+ }).as('get-cancelled-answer');
171
+ }
172
+
173
+ static stubCancelQuestion(fixture = '/ttyg/chats/cancel-question-response.json', delay = 1000) {
174
+ cy.intercept({
175
+ method: 'POST',
176
+ url: 'rest/chat/chats/**/cancel'
177
+ }, (req) => {
178
+ req.reply({
179
+ fixture,
180
+ statusCode: 200,
181
+ delay
182
+ });
183
+ }).as('get-cancel-response');
184
+ }
185
+
186
+ static stubCreateNewChat() {
187
+ cy.intercept('POST', '/rest/chat/chats', {
188
+ fixture: 'ttyg/chats/create/create-chat-response.json',
189
+ statusCode: 200
190
+ }).as('ask-first-chat-question');
191
+
192
+ cy.fixture('ttyg/chats/create/question-response-after-chat-creation.json').then((fixtureData) => {
154
193
  const today = Math.floor(Date.now() / 1000) + '';
155
194
  const body = JSON.stringify(fixtureData).replace(/"creationDate"/g, today);
156
- cy.intercept('POST', '/rest/chat/conversations', {
195
+ cy.intercept('POST', '/rest/chat/chats/**/question', {
157
196
  statusCode: 200,
158
197
  body: JSON.parse(body)
159
198
  }).as('create-chat');
160
199
  });
161
-
162
200
  }
163
201
 
164
202
  static stubExplainResponse(fixture = '/ttyg/chats/explain-response-1.json') {
package/support/e2e.js CHANGED
@@ -24,14 +24,16 @@ import 'cypress-file-upload';
24
24
  import {LicenseStubs} from "../stubs/license-stubs";
25
25
  import {SecurityStubs} from "../stubs/security-stubs";
26
26
  // https://github.com/bahmutov/cypress-code-coverage
27
- require('@bahmutov/cypress-code-coverage/support');
27
+ import '@bahmutov/cypress-code-coverage/support';
28
28
 
29
29
  // Configures an environment variable with the key used for common actions (cmd on mac, ctrl on other OS).
30
30
  // This variable must be used in all actions that type e.g. ctrl-a to select text.
31
31
  Cypress.env('modifierKey', Cypress.platform === 'darwin' ? '{cmd}' : '{ctrl}');
32
32
 
33
- require('cypress-failed-log');
34
- require('cypress-terminal-report/src/installLogsCollector')();
33
+ import 'cypress-failed-log';
34
+ import * as ctr from 'cypress-terminal-report/src/installLogsCollector';
35
+ const installLogsCollector = ('default' in ctr) ? ctr.default : ctr;
36
+ installLogsCollector();
35
37
 
36
38
  // We don't want any tests to hit real Google
37
39
  beforeEach(() => {