graphdb-workbench-tests 2.8.0-Test → 2.8.1-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/cypress.config.js +4 -1
- package/fixtures/cluster/2-nodes-cluster-group-status-deleted.json +30 -0
- package/fixtures/cluster/2-nodes-cluster-group-status.json +30 -0
- package/fixtures/cluster/3-nodes-cluster-group-status-after-replace.json +44 -0
- package/fixtures/cluster/3-nodes-cluster-group-status-building-snapshot.json +4 -1
- package/fixtures/cluster/3-nodes-cluster-group-status-receiving-snapshot.json +4 -1
- package/fixtures/cluster/3-nodes-cluster-group-status-sending-snapshot.json +4 -1
- package/fixtures/cluster/3-nodes-cluster-group-status-waiting-for-snapshot.json +4 -1
- package/fixtures/cluster/3-nodes-cluster-group-status-with-tag.json +47 -0
- package/fixtures/cluster/3-nodes-cluster-group-status.json +12 -3
- package/fixtures/cluster/4-nodes-cluster-group-status.json +58 -0
- package/fixtures/cluster/cluster-config.json +1 -0
- package/fixtures/cluster/cluster-node-status.json +4 -1
- package/fixtures/cluster/no-cluster-group-status.json +2 -1
- package/fixtures/cluster/no-cluster-node-status.json +2 -1
- package/fixtures/cluster/save-cluster-configuration-response.json +10 -0
- package/fixtures/connectors/get-retrieval-connector.json +1 -1
- package/fixtures/connectors/get-ttyg-chatgpt-connectors.json +188 -0
- package/fixtures/locale-en.json +386 -103
- package/fixtures/remote-location/get-0-remote-locations.json +1 -2
- package/fixtures/remote-location/get-1-remote-locations.json +2 -4
- package/fixtures/remote-location/get-2-remote-locations.json +3 -6
- package/fixtures/remote-location/get-3-remote-locations.json +4 -8
- package/fixtures/remote-location/get-4-remote-locations.json +54 -0
- package/fixtures/remote-location/remote-location-status-in-cluster.json +1 -2
- package/fixtures/remote-location/remote-location-status-not-in-cluster.json +1 -2
- package/fixtures/remote-location/remote-locations-filter.json +1 -2
- package/fixtures/repositories/get-locations.json +5 -10
- package/fixtures/repositories/get-remote-and-local-repositories.json +34 -0
- package/fixtures/repositories/get-ttyg-repositories.json +28 -0
- package/fixtures/security/get-admin-user.json +22 -0
- package/fixtures/similarity/get-ttyg-similarity-connectors.json +46 -0
- package/fixtures/ttyg/agent/create-agent.json +2 -1
- package/fixtures/ttyg/agent/get-agent-defaults.json +42 -0
- package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +1 -1
- package/fixtures/ttyg/agent/get-agent-list-new-agent.json +2 -73
- package/fixtures/ttyg/agent/get-agent-list.json +1 -1
- package/fixtures/ttyg/agent/get-agent.json +25 -0
- package/fixtures/ttyg/chats/ask-question.json +25 -0
- package/fixtures/ttyg/chats/create/create-chat-response.json +16 -0
- package/fixtures/ttyg/chats/create/get-chats-after-create.json +12 -0
- package/fixtures/ttyg/chats/create/get-chats-before-create.json +7 -0
- package/fixtures/ttyg/chats/explain-response-1.json +59 -0
- package/fixtures/ttyg/chats/explain-response-2.json +59 -0
- package/fixtures/ttyg/chats/get-chat.json +199 -0
- package/integration/cluster/cluster-configuration/cluster-configuration-multi-region.spec.js +97 -0
- package/integration/cluster/cluster-configuration/cluster-configuration-nodes.spec.js +70 -0
- package/integration/cluster/cluster-configuration/cluster-configuration-properties.spec.js +95 -0
- package/integration/cluster/cluster-configuration/cluster-configuration.spec.js +38 -0
- package/integration/cluster/cluster-legend.spec.js +1 -0
- package/integration/cluster/edit-cluster-nodes-modal.spec.js +425 -0
- package/integration/explore/graphs.overview.spec.js +4 -0
- package/integration/explore/{similariti-index-create.spec.js → similarity-index/similarity-index-create.spec.js} +4 -4
- package/integration/explore/{similarity-index.spec.js → similarity-index/similarity-index.spec.js} +6 -6
- package/integration/explore/{similarity.spec.js → similarity-index/similarity.spec.js} +7 -8
- package/integration/explore/visual-graph/visual.graph.spec.js +34 -35
- package/integration/home/cookie-policy.spec.js +83 -0
- package/integration/home/create-repository.spec.js +35 -0
- package/integration/home/documentation-link.spec.js +60 -0
- package/integration/home/google-analytics.spec.js +60 -0
- package/integration/home/language-selector.spec.js +19 -0
- package/integration/home/rdf-resource-search.spec.js +192 -0
- package/integration/home/view-resource-autocomplete.spec.js +52 -0
- package/integration/home/workbench.home.spec.js +1 -277
- package/integration/import/import-user-data-file-upload.spec.js +13 -0
- package/integration/import/import-user-data.spec.js +6 -1
- package/integration/import/import-view.spec.js +6 -1
- package/integration/license/license.spec.js +26 -0
- package/integration/repository/attach-remote-location.spec.js +94 -40
- package/integration/repository/repositories.spec.js +40 -7
- package/integration/setup/autocomplete.spec.js +21 -70
- package/integration/setup/{jdbc-create.spec.js → jdbc/jdbc-create.spec.js} +9 -10
- package/integration/setup/{jdbc.spec.js → jdbc/jdbc.spec.js} +56 -25
- package/integration/setup/my-settings.spec.js +13 -21
- package/integration/setup/namespaces.spec.js +132 -264
- package/integration/setup/plugins.spec.js +22 -51
- package/integration/setup/rdf-rank.spec.js +42 -138
- package/integration/ttyg/agent-list.spec.js +27 -25
- package/integration/ttyg/agent-select-menu.spec.js +18 -16
- package/integration/ttyg/chat-list.spec.js +72 -9
- package/integration/ttyg/chat-panel.spec.js +106 -10
- package/integration/ttyg/clone-agent.spec.js +8 -4
- package/integration/ttyg/create-agent.spec.js +303 -51
- package/integration/ttyg/create-chat.spec.js +68 -0
- package/integration/ttyg/delete-agent.spec.js +6 -5
- package/integration/ttyg/edit-agent.spec.js +16 -5
- package/integration/ttyg/ttyg-permission.spec.js +66 -0
- package/integration/ttyg/ttyg-view.spec.js +8 -4
- package/npm-shrinkwrap.json +215 -220
- package/package.json +5 -6
- package/steps/alert-dialog-steps.js +25 -0
- package/steps/cluster/cluster-configuration-steps.js +173 -5
- package/steps/cluster/cluster-page-steps.js +8 -0
- package/steps/cluster/custer-nodes-configuration-steps.js +107 -0
- package/steps/guides/guide-steps.js +1 -1
- package/steps/home-steps.js +48 -5
- package/steps/import/import-steps.js +11 -7
- package/steps/license-steps.js +25 -0
- package/steps/repositories/attach-repository-steps.js +33 -0
- package/steps/repository-steps.js +40 -11
- package/steps/setup/autocomplete-steps.js +59 -0
- package/steps/setup/namespace-steps.js +211 -0
- package/steps/setup/plugins-steps.js +37 -0
- package/steps/setup/rdf-rank-steps.js +106 -0
- package/steps/setup/settings-steps.js +17 -0
- package/steps/ttyg/chat-panel-steps.js +31 -6
- package/steps/ttyg/ttyg-agent-settings-modal.steps.js +82 -4
- package/steps/ttyg/ttyg-view-steps.js +77 -3
- package/steps/visual-graph-steps.js +29 -1
- package/steps/yasgui/yasqe-steps.js +3 -0
- package/stubs/cluster/cluster-stubs.js +162 -7
- package/stubs/cluster/remote-location-stubs.js +46 -0
- package/stubs/connector-stubs.js +24 -0
- package/stubs/environment-stubs.js +27 -0
- package/stubs/jdbc/jdbc-stubs.js +19 -0
- package/stubs/license-stubs.js +112 -0
- package/stubs/namespace-stubs.js +5 -0
- package/stubs/repositories/repositories-stubs.js +11 -8
- package/stubs/repositories-stub.js +15 -0
- package/stubs/security-stubs.js +29 -0
- package/stubs/setup/plugins-stubs.js +5 -0
- package/stubs/similarity-index-stubs.js +25 -0
- package/stubs/stubs.js +4 -0
- package/stubs/ttyg/ttyg-stubs.js +79 -40
- package/support/commands.js +2 -0
- package/support/index.js +18 -0
- package/support/security-command.js +25 -0
- package/support/settings-commands.js +4 -5
- package/support/user-commands.js +31 -0
- package/fixtures/ttyg/chats/get-chat-1.json +0 -43
- package/integration/cluster/cluster-management.spec.js +0 -220
- package/steps/autocomplete-steps.js +0 -10
- package/steps/cluster/add-remote-location-dialog-steps.js +0 -11
- package/steps/cluster/create-cluster-dialog-steps.js +0 -39
- package/steps/cluster/replace-nodes-dialog-steps.js +0 -39
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export class LicenseStubs {
|
|
2
|
+
|
|
3
|
+
static spyGetLicense() {
|
|
4
|
+
cy.intercept('GET', '/rest/graphdb-settings/license').as('get-license');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
static stubFreeLicense() {
|
|
8
|
+
cy.intercept('GET', '/rest/graphdb-settings/license', {
|
|
9
|
+
statusCode: 200,
|
|
10
|
+
body: LicenseStubs.freeLicense()
|
|
11
|
+
}).as('freeLicense');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static stubEnterpriseLicense() {
|
|
15
|
+
cy.intercept('GET', '/rest/graphdb-settings/license', {
|
|
16
|
+
statusCode: 200,
|
|
17
|
+
body: LicenseStubs.enterpriseLicense()
|
|
18
|
+
}).as('enterpriseLicense');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static stubEvaluationLicense() {
|
|
22
|
+
cy.intercept('GET', '/rest/graphdb-settings/license', {
|
|
23
|
+
statusCode: 200,
|
|
24
|
+
body: LicenseStubs.evaluationLicense()
|
|
25
|
+
}).as('evaluationLicense');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
static freeLicense() {
|
|
30
|
+
return {
|
|
31
|
+
"message": "OK",
|
|
32
|
+
"valid": true,
|
|
33
|
+
"version": "10.7",
|
|
34
|
+
"expiryDate": null,
|
|
35
|
+
"licensee": "Freeware",
|
|
36
|
+
"product": "GRAPHDB_LITE",
|
|
37
|
+
"maxCpuCores": 1,
|
|
38
|
+
"typeOfUse": "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
|
|
39
|
+
"latestPublicationDate": null,
|
|
40
|
+
"licenseCapabilities": [
|
|
41
|
+
"Lucene connector"
|
|
42
|
+
],
|
|
43
|
+
"productType": "free",
|
|
44
|
+
"installationId": "1234-abcd-5678"
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static enterpriseLicense() {
|
|
49
|
+
return {
|
|
50
|
+
message: "OK",
|
|
51
|
+
valid: true,
|
|
52
|
+
version: null,
|
|
53
|
+
expiryDate: 8640000000000000,
|
|
54
|
+
licensee: "ONTOTEXT_INTERNAL",
|
|
55
|
+
product: "GRAPHDB_ENTERPRISE",
|
|
56
|
+
maxCpuCores: null,
|
|
57
|
+
typeOfUse: "Non-commercial research only",
|
|
58
|
+
latestPublicationDate: null,
|
|
59
|
+
licenseCapabilities: [
|
|
60
|
+
"OpenSearch connector",
|
|
61
|
+
"Lucene connector",
|
|
62
|
+
"Kafka connector",
|
|
63
|
+
"Solr connector",
|
|
64
|
+
"Cluster",
|
|
65
|
+
"Elasticsearch connector"
|
|
66
|
+
],
|
|
67
|
+
productType: "enterprise",
|
|
68
|
+
installationId: "1234-abcd-5678"
|
|
69
|
+
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static evaluationLicense() {
|
|
74
|
+
return {
|
|
75
|
+
message: "OK",
|
|
76
|
+
valid: true,
|
|
77
|
+
version: null,
|
|
78
|
+
expiryDate: 8640000000000000,
|
|
79
|
+
licensee: "ONTOTEXT_INTERNAL",
|
|
80
|
+
product: "GRAPHDB_ENTERPRISE",
|
|
81
|
+
maxCpuCores: null,
|
|
82
|
+
typeOfUse: "this is an evaluation license",
|
|
83
|
+
latestPublicationDate: null,
|
|
84
|
+
licenseCapabilities: [
|
|
85
|
+
"OpenSearch connector",
|
|
86
|
+
"Lucene connector",
|
|
87
|
+
"Kafka connector",
|
|
88
|
+
"Solr connector",
|
|
89
|
+
"Cluster",
|
|
90
|
+
"Elasticsearch connector"
|
|
91
|
+
],
|
|
92
|
+
productType: "enterprise",
|
|
93
|
+
installationId: "1234-abcd-5678"
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static stubGoogleCalls() {
|
|
98
|
+
cy.intercept('GET', 'https://www.googletagmanager.com/**', {
|
|
99
|
+
statusCode: 503
|
|
100
|
+
});
|
|
101
|
+
cy.intercept('POST', 'https://region1.google-analytics.com/**', {
|
|
102
|
+
statusCode: 500
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static stubLicenseHardcoded(hardcoded = false) {
|
|
107
|
+
cy.intercept('GET', '/rest/graphdb-settings/license/hardcoded', {
|
|
108
|
+
statusCode: 200,
|
|
109
|
+
body: hardcoded + ''
|
|
110
|
+
}).as('license-hardcoded');
|
|
111
|
+
}
|
|
112
|
+
}
|
package/stubs/namespace-stubs.js
CHANGED
|
@@ -7,4 +7,9 @@ export class NamespaceStubs {
|
|
|
7
7
|
static stubNameSpaceResponse(repositoryId, fixture, withDelay = 0) {
|
|
8
8
|
cy.intercept(`/repositories/${repositoryId}/namespaces`, {fixture, delay: withDelay}).as(`${repositoryId}-stub-namespaces`);
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
static stubErrorOnNamespaceUpdate(repositoryId) {
|
|
12
|
+
cy.intercept('PUT', `/repositories/${repositoryId}/namespaces/*`,
|
|
13
|
+
{statusCode: 500, body: 'Internal Server Error'}).as(`stub-namespace-update-error`);
|
|
14
|
+
}
|
|
10
15
|
}
|
|
@@ -4,11 +4,19 @@ import {RepositoriesStub} from "../repositories-stub";
|
|
|
4
4
|
|
|
5
5
|
export class RepositoriesStubs extends Stubs {
|
|
6
6
|
static stubRepositories(withDelay = 0, fixture = '/repositories/get-repositories.json') {
|
|
7
|
-
RepositoriesStubs.
|
|
7
|
+
RepositoriesStubs.stubGetQueryResponse('/rest/repositories/all', fixture, 'get-all-repositories', withDelay);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
static stubLocations(withDelay = 0) {
|
|
11
|
-
RepositoriesStubs.stubQueryResponse('/rest/locations
|
|
11
|
+
RepositoriesStubs.stubQueryResponse('/rest/locations', '/repositories/get-locations.json', 'get-locations', withDelay);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static spyCreateLocation() {
|
|
15
|
+
cy.intercept('POST', '/rest/locations').as('createLocation');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static spyDeleteLocation() {
|
|
19
|
+
cy.intercept('DELETE', '/rest/locations?**').as('deleteLocation');
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
static stubEditOntopResponse(repositoryId) {
|
|
@@ -107,12 +115,7 @@ export class RepositoriesStubs extends Stubs {
|
|
|
107
115
|
body: {}
|
|
108
116
|
}).as('restartRepository');
|
|
109
117
|
|
|
110
|
-
|
|
111
|
-
statusCode: 200,
|
|
112
|
-
body: {}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
RepositoriesStub.stubNameSpaces(repositoryId, [{
|
|
118
|
+
RepositoriesStub.stubBaseEndpoints(repositoryId, [{
|
|
116
119
|
"type": "literal",
|
|
117
120
|
"value": "http://jena.apache.org/ARQ/function/aggregate#"
|
|
118
121
|
}]);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {GlobalOperationsStatusesStub} from "./global-operations-statuses-stub";
|
|
2
|
+
|
|
1
3
|
export class RepositoriesStub {
|
|
2
4
|
|
|
3
5
|
static stubOntopRepository(repositoryId) {
|
|
@@ -55,4 +57,17 @@ export class RepositoriesStub {
|
|
|
55
57
|
body: namespacesResponse
|
|
56
58
|
});
|
|
57
59
|
}
|
|
60
|
+
|
|
61
|
+
static stubAutocomplete() {
|
|
62
|
+
cy.intercept(`/rest/autocomplete/enabled`, {
|
|
63
|
+
statusCode: 200,
|
|
64
|
+
body: {}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static stubBaseEndpoints(repositoryId, namespaces) {
|
|
69
|
+
RepositoriesStub.stubNameSpaces(repositoryId, namespaces);
|
|
70
|
+
RepositoriesStub.stubAutocomplete();
|
|
71
|
+
GlobalOperationsStatusesStub.stubNoOperationsResponse('starwars');
|
|
72
|
+
}
|
|
58
73
|
}
|
package/stubs/security-stubs.js
CHANGED
|
@@ -12,6 +12,35 @@ export class SecurityStubs {
|
|
|
12
12
|
}).as('security-all');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
static stubUpdateUserData(userName) {
|
|
16
|
+
cy.intercept('PATCH', `/rest/security/users/${userName}`, {
|
|
17
|
+
statusCode: 200,
|
|
18
|
+
body: {}
|
|
19
|
+
}).as('updateUser');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static stubGetAdminUser() {
|
|
23
|
+
cy.intercept('GET', 'rest/security/users/admin', {
|
|
24
|
+
fixture: '/security/get-admin-user.json',
|
|
25
|
+
statusCode: 200
|
|
26
|
+
}).as('getAdminUser');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Disables the globally configured interceptor for the GET request to get the admin user.
|
|
31
|
+
* This is useful when you want to test the real response from the server.
|
|
32
|
+
*
|
|
33
|
+
* This should be called in each test where you want to test the real response.
|
|
34
|
+
*/
|
|
35
|
+
static resetGetAdminUserStub() {
|
|
36
|
+
cy.intercept('GET', 'rest/security/users/admin', (req) => {
|
|
37
|
+
req.reply((res) => {
|
|
38
|
+
res.send({});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
).as('getAdminUser');
|
|
42
|
+
}
|
|
43
|
+
|
|
15
44
|
static getAdminResponse(infer, sameAs) {
|
|
16
45
|
return {
|
|
17
46
|
"username": "admin",
|
|
@@ -4,4 +4,29 @@ export class SimilarityIndexStubs extends Stubs {
|
|
|
4
4
|
static stubGetSimilarityIndexes(fixture = '/similarity/get-similarity-indexes.json', delay = 0) {
|
|
5
5
|
this.stubQueryResponse('/rest/similarity', fixture, 'get-similarity-indexes', delay);
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Stubs Similarity indexes for three repositories:
|
|
11
|
+
* <ol>
|
|
12
|
+
* <li> "starwars" - it has two similarity indexes "similarity_index_starwars_one" and "similarity_index_starwars_two"
|
|
13
|
+
* <li> "biomarkers" - it has one similarity index "similarity_index_biomarkers_one"
|
|
14
|
+
* <li> "ttyg-repo-1725518186812" - it has no any similarity indexes.
|
|
15
|
+
* </ol>
|
|
16
|
+
* @param {number} delay
|
|
17
|
+
*/
|
|
18
|
+
static stubTTYGSimilarityIndexes(delay = 0) {
|
|
19
|
+
cy.fixture('/similarity/get-ttyg-similarity-connectors.json').then((body) => {
|
|
20
|
+
cy.intercept('/rest/similarity', (req) => {
|
|
21
|
+
const repositoryId = req.headers['x-graphdb-repository'];
|
|
22
|
+
const connectors = body[repositoryId];
|
|
23
|
+
// Respond with the modified body
|
|
24
|
+
req.reply({
|
|
25
|
+
statusCode: 200,
|
|
26
|
+
body: JSON.stringify(connectors),
|
|
27
|
+
delay: delay
|
|
28
|
+
});
|
|
29
|
+
}).as('get-ttyg-similarity-indexes');
|
|
30
|
+
});
|
|
31
|
+
}
|
|
7
32
|
}
|
package/stubs/stubs.js
CHANGED
|
@@ -2,4 +2,8 @@ export class Stubs {
|
|
|
2
2
|
static stubQueryResponse(url, fixture, alias, withDelay = 0) {
|
|
3
3
|
cy.intercept(url, {fixture, delay: withDelay}).as(alias);
|
|
4
4
|
}
|
|
5
|
+
|
|
6
|
+
static stubGetQueryResponse(url, fixture, alias, withDelay = 0) {
|
|
7
|
+
cy.intercept('GET', url, {fixture, delay: withDelay}).as(alias);
|
|
8
|
+
}
|
|
5
9
|
}
|
package/stubs/ttyg/ttyg-stubs.js
CHANGED
|
@@ -2,8 +2,7 @@ import {Stubs} from "../stubs";
|
|
|
2
2
|
|
|
3
3
|
export class TTYGStubs extends Stubs {
|
|
4
4
|
static stubChatsListGet(fixture = '/ttyg/chats/get-chat-list.json', delay = 0) {
|
|
5
|
-
cy.intercept('/rest/chat/conversations', {
|
|
6
|
-
method: 'GET',
|
|
5
|
+
cy.intercept('GET', '/rest/chat/conversations', {
|
|
7
6
|
fixture: fixture,
|
|
8
7
|
statusCode: 200,
|
|
9
8
|
delay: delay
|
|
@@ -11,8 +10,7 @@ export class TTYGStubs extends Stubs {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
static stubChatListGetError() {
|
|
14
|
-
cy.intercept('/rest/chat/conversations', {
|
|
15
|
-
method: 'GET',
|
|
13
|
+
cy.intercept('GET', '/rest/chat/conversations', {
|
|
16
14
|
statusCode: 500,
|
|
17
15
|
response: {
|
|
18
16
|
error: 'Internal Server Error'
|
|
@@ -21,86 +19,95 @@ export class TTYGStubs extends Stubs {
|
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
static stubChatsListGetNoResults() {
|
|
24
|
-
cy.intercept('/rest/chat/conversations', {
|
|
25
|
-
method: 'GET',
|
|
22
|
+
cy.intercept('GET', '/rest/chat/conversations', {
|
|
26
23
|
fixture: '/ttyg/chats/get-chat-list-0.json',
|
|
27
24
|
statusCode: 200
|
|
28
25
|
}).as('get-chat-list');
|
|
29
26
|
}
|
|
30
27
|
|
|
31
|
-
static stubChatCreate() {
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
28
|
/**
|
|
36
29
|
* Loads the specified <code>fixture</code> and updates the chatId in the fixture with the actual ID passed in the endpoint call.
|
|
37
30
|
*
|
|
38
|
-
* @param {string} fixture - Path to the JSON file containing the chat conversation.
|
|
39
31
|
* @param {number} delay - Optional delay in milliseconds before responding with the fixture.
|
|
40
32
|
*/
|
|
41
|
-
static stubChatGet(
|
|
42
|
-
cy.fixture(
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
static stubChatGet(delay = 0) {
|
|
34
|
+
cy.fixture('/ttyg/chats/get-chat.json').then((body) => {
|
|
35
|
+
cy.intercept({
|
|
36
|
+
method: 'GET',
|
|
37
|
+
url: '/rest/chat/conversations/*'
|
|
38
|
+
}, (req) => {
|
|
45
39
|
const chatId = req.url.split('/').pop();
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
const chat = body[chatId];
|
|
41
|
+
// Respond with the modified body
|
|
42
|
+
req.reply({
|
|
43
|
+
statusCode: 200,
|
|
44
|
+
body: JSON.stringify(chat),
|
|
45
|
+
delay: delay
|
|
46
|
+
});
|
|
52
47
|
}).as('get-chat');
|
|
53
48
|
});
|
|
54
49
|
}
|
|
55
50
|
|
|
51
|
+
static stubChatGet404Error() {
|
|
52
|
+
cy.intercept('GET', '/rest/chat/conversations/*', {
|
|
53
|
+
statusCode: 404,
|
|
54
|
+
response: {
|
|
55
|
+
error: 'Not Found'
|
|
56
|
+
}
|
|
57
|
+
}).as('get-chat');
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
static stubChatUpdate() {
|
|
57
|
-
cy.intercept('/rest/chat/conversations/*', {
|
|
58
|
-
method: 'PUT',
|
|
61
|
+
cy.intercept('PUT', '/rest/chat/conversations/*', {
|
|
59
62
|
fixture: '/ttyg/chats/renamed-chat.json',
|
|
60
63
|
statusCode: 200
|
|
61
64
|
}).as('update-chat');
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
static stubChatDelete() {
|
|
65
|
-
cy.intercept('/rest/chat/conversations/*', {
|
|
66
|
-
method: 'DELETE',
|
|
68
|
+
cy.intercept('DELETE', '/rest/chat/conversations/*', {
|
|
67
69
|
fixture: '/ttyg/chats/deleted-chat.json',
|
|
68
70
|
statusCode: 200
|
|
69
71
|
}).as('delete-chat');
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
static stubChatExport() {
|
|
73
|
-
cy.intercept('/rest/chat/conversations/export/*', {
|
|
74
|
-
method: 'GET',
|
|
75
|
+
cy.intercept('GET', '/rest/chat/conversations/export/*', {
|
|
75
76
|
fixture: '/ttyg/chats/export-chat.json',
|
|
76
77
|
statusCode: 200
|
|
77
78
|
}).as('export-chat');
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
static stubAgentListGet(fixture = '/ttyg/agent/get-agent-list.json', delay = 0
|
|
81
|
-
cy.intercept('/rest/chat/agents', {
|
|
82
|
-
method: 'GET',
|
|
81
|
+
static stubAgentListGet(fixture = '/ttyg/agent/get-agent-list.json', delay = 0) {
|
|
82
|
+
cy.intercept('GET', '/rest/chat/agents', {
|
|
83
83
|
fixture: fixture,
|
|
84
84
|
statusCode: 200,
|
|
85
85
|
delay: delay
|
|
86
|
-
}).as('get-agent-list
|
|
86
|
+
}).as('get-agent-list');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static stubAgentGet(fixture = '/ttyg/agent/get-agent.json', delay = 0) {
|
|
90
|
+
cy.intercept('GET', '/rest/chat/agents/*', {
|
|
91
|
+
fixture: fixture,
|
|
92
|
+
statusCode: 200,
|
|
93
|
+
delay: delay
|
|
94
|
+
}).as('get-agent');
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
static stubAgentListGetError() {
|
|
90
|
-
cy.intercept('/rest/chat/agents', {
|
|
91
|
-
method: 'GET',
|
|
98
|
+
cy.intercept('GET', '/rest/chat/agents', {
|
|
92
99
|
statusCode: 500,
|
|
93
100
|
response: {
|
|
94
101
|
error: 'Internal Server Error'
|
|
95
102
|
}
|
|
96
|
-
}).as('get-agent-list');
|
|
103
|
+
}).as('get-agent-list-error');
|
|
97
104
|
}
|
|
98
105
|
|
|
99
|
-
static stubAgentCreate() {
|
|
100
|
-
cy.intercept('/rest/chat/agents', {
|
|
101
|
-
method: 'POST',
|
|
106
|
+
static stubAgentCreate(delay = 0) {
|
|
107
|
+
cy.intercept('POST', '/rest/chat/agents', {
|
|
102
108
|
fixture: '/ttyg/agent/create-agent.json',
|
|
103
|
-
statusCode: 200
|
|
109
|
+
statusCode: 200,
|
|
110
|
+
delay: delay
|
|
104
111
|
}).as('create-agent');
|
|
105
112
|
}
|
|
106
113
|
|
|
@@ -118,10 +125,42 @@ export class TTYGStubs extends Stubs {
|
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
static stubAgentDelete(delay = 0) {
|
|
121
|
-
cy.intercept('/rest/chat/agents/**', {
|
|
122
|
-
method: 'DELETE',
|
|
128
|
+
cy.intercept('DELETE', '/rest/chat/agents/**', {
|
|
123
129
|
statusCode: 200,
|
|
124
130
|
delay: delay
|
|
125
131
|
}).as('delete-agent');
|
|
126
132
|
}
|
|
133
|
+
|
|
134
|
+
static stubAgentDefaultsGet() {
|
|
135
|
+
cy.intercept('GET', '/rest/chat/agents/default', {
|
|
136
|
+
fixture: '/ttyg/agent/get-agent-defaults.json',
|
|
137
|
+
statusCode: 200
|
|
138
|
+
}).as('get-agent-defaults');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static stubAnswerQuestion(fixture = '/ttyg/chats/ask-question.json') {
|
|
142
|
+
cy.intercept('POST', '/rest/chat/conversations', {
|
|
143
|
+
fixture,
|
|
144
|
+
statusCode: 200
|
|
145
|
+
}).as('get-agent-defaults');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
static stubCrateNewChat(fixture = 'ttyg/chats/create/create-chat-response.json') {
|
|
149
|
+
cy.fixture(fixture).then((fixtureData) => {
|
|
150
|
+
const today = Math.floor(Date.now() / 1000) + '';
|
|
151
|
+
const body = JSON.stringify(fixtureData).replace(/"creationDate"/g, today);
|
|
152
|
+
cy.intercept('POST', '/rest/chat/conversations', {
|
|
153
|
+
statusCode: 200,
|
|
154
|
+
body: JSON.parse(body)
|
|
155
|
+
}).as('create-chat');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static stubExplainResponse(fixture = '/ttyg/chats/explain-response-1.json') {
|
|
161
|
+
cy.intercept('POST', 'rest/chat/conversations/explain', {
|
|
162
|
+
fixture,
|
|
163
|
+
statusCode: 200
|
|
164
|
+
}).as('explain-response');
|
|
165
|
+
}
|
|
127
166
|
}
|
package/support/commands.js
CHANGED
package/support/index.js
CHANGED
|
@@ -21,6 +21,8 @@ import './commands';
|
|
|
21
21
|
|
|
22
22
|
import 'cypress-real-events';
|
|
23
23
|
import 'cypress-file-upload';
|
|
24
|
+
import {LicenseStubs} from "../stubs/license-stubs";
|
|
25
|
+
import {SecurityStubs} from "../stubs/security-stubs";
|
|
24
26
|
|
|
25
27
|
// Configures an environment variable with the key used for common actions (cmd on mac, ctrl on other OS).
|
|
26
28
|
// This variable must be used in all actions that type e.g. ctrl-a to select text.
|
|
@@ -29,3 +31,19 @@ Cypress.env('modifierKey', Cypress.platform === 'darwin' ? '{cmd}' : '{ctrl}');
|
|
|
29
31
|
require('cypress-failed-log');
|
|
30
32
|
require('cypress-terminal-report/src/installLogsCollector')();
|
|
31
33
|
|
|
34
|
+
// We don't want any tests to hit real Google
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
LicenseStubs.stubGoogleCalls();
|
|
37
|
+
// This env variable is set globally in the cypress.config.js and
|
|
38
|
+
// can be changed from within the spec files if needed like this
|
|
39
|
+
// Cypress.env('set_default_user_data', false);
|
|
40
|
+
if (Cypress.env('set_default_user_data')) {
|
|
41
|
+
// cy.setDefaultUserData();
|
|
42
|
+
// Stub the request for updating user data instead of making request
|
|
43
|
+
// to modify it because for some reason this request gets a 401 response
|
|
44
|
+
// for some reason.
|
|
45
|
+
// It'll be good to investigate it a bit sometime.
|
|
46
|
+
SecurityStubs.stubGetAdminUser();
|
|
47
|
+
// SecurityStubs.stubUpdateUserData('admin');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Cypress.Commands.add('switchOnSecurity', () => {
|
|
2
|
+
cy.request({
|
|
3
|
+
method: 'POST',
|
|
4
|
+
url: `/rest/security`,
|
|
5
|
+
body: 'true',
|
|
6
|
+
headers: {
|
|
7
|
+
'Content-Type': 'application/json'
|
|
8
|
+
},
|
|
9
|
+
// Prevent Cypress from failing the test on non-2xx status codes
|
|
10
|
+
failOnStatusCode: false
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
Cypress.Commands.add('switchOffSecurity', () => {
|
|
15
|
+
cy.request({
|
|
16
|
+
method: 'POST',
|
|
17
|
+
url: `/rest/security`,
|
|
18
|
+
body: 'false',
|
|
19
|
+
headers: {
|
|
20
|
+
'Content-Type': 'application/json'
|
|
21
|
+
},
|
|
22
|
+
// Prevent Cypress from failing the test on non-2xx status codes
|
|
23
|
+
failOnStatusCode: true
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
Cypress.Commands.add('setDefaultUserData', () => {
|
|
1
|
+
Cypress.Commands.add('setDefaultUserData', (cookieConsent = true) => {
|
|
2
2
|
const defaultUserSettings = {
|
|
3
|
+
'COOKIE_CONSENT': cookieConsent,
|
|
3
4
|
'DEFAULT_SAMEAS': true,
|
|
4
5
|
'DEFAULT_INFERENCE': true,
|
|
5
6
|
'EXECUTE_COUNT': true,
|
|
@@ -10,10 +11,8 @@ Cypress.Commands.add('setDefaultUserData', () => {
|
|
|
10
11
|
method: 'PATCH',
|
|
11
12
|
url: `rest/security/users/${encodeURIComponent('admin')}`,
|
|
12
13
|
body: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'password': 'root'
|
|
16
|
-
}
|
|
14
|
+
"appSettings": defaultUserSettings,
|
|
15
|
+
'password': 'root'
|
|
17
16
|
}
|
|
18
17
|
}).then((response) => {
|
|
19
18
|
cy.waitUntil(() => response && response.status === 200); // 201 Created
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Cypress.Commands.add('createUser', (options = {}) => {
|
|
2
|
+
cy.request({
|
|
3
|
+
method: 'POST',
|
|
4
|
+
url: `/rest/security/users/${options.username}`,
|
|
5
|
+
body: {
|
|
6
|
+
"password": options.password || "root",
|
|
7
|
+
"appSettings": {
|
|
8
|
+
"DEFAULT_SAMEAS": true,
|
|
9
|
+
"DEFAULT_INFERENCE": true,
|
|
10
|
+
"EXECUTE_COUNT": true,
|
|
11
|
+
"IGNORE_SHARED_QUERIES": false,
|
|
12
|
+
"DEFAULT_VIS_GRAPH_SCHEMA": true
|
|
13
|
+
},
|
|
14
|
+
"grantedAuthorities": options.grantedAuthorities || ["ROLE_USER", "WRITE_REPO_*", "READ_REPO_*"]
|
|
15
|
+
},
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json'
|
|
18
|
+
}
|
|
19
|
+
}).then((response) => {
|
|
20
|
+
cy.waitUntil(() => response && response.status === 201); // 201 Created
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
Cypress.Commands.add('deleteUser', (username = {}) => {
|
|
25
|
+
cy.request({
|
|
26
|
+
method: 'DELETE',
|
|
27
|
+
url: `/rest/security/users/${username}`,
|
|
28
|
+
// Prevent Cypress from failing the test on non-2xx status codes
|
|
29
|
+
failOnStatusCode: false
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "{chatId}",
|
|
3
|
-
"name": "Han Solo is a fictional character in the...",
|
|
4
|
-
"messages": [
|
|
5
|
-
{
|
|
6
|
-
"id": "msg_YbtWCL64HPu9Kf7SbsssseRlrwCc",
|
|
7
|
-
"conversationId": "thread_gy2K7D3efStfchq2v5VvpEvn",
|
|
8
|
-
"agentId": "asst_uoKp5kgnPlyZHhRXY7P2r9D7",
|
|
9
|
-
"role": "assistant",
|
|
10
|
-
"message": "Han Solo is a fictional character in the Star ",
|
|
11
|
-
"timestamp": "1725875332",
|
|
12
|
-
"name": null
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"id": "msg_1niL7yYidTfiGZynCiryiMMd",
|
|
16
|
-
"conversationId": "thread_gy2K7D3efStfchq2v5VvpEvn",
|
|
17
|
-
"agentId": null,
|
|
18
|
-
"role": "user",
|
|
19
|
-
"message": "Who are the Han Solo's children?",
|
|
20
|
-
"timestamp": "1725875483",
|
|
21
|
-
"name": null
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"id": "msg_YbtWCL64HPu9Kf7SbeRlrwCc",
|
|
25
|
-
"conversationId": "thread_gy2K7D3efStfchq2v5VvpEvn",
|
|
26
|
-
"agentId": "asst_uoKp5kgnPlyZHhRXY7P2r9D7",
|
|
27
|
-
"role": "assistant",
|
|
28
|
-
"message": "Han Solo is a fictional character in the Star Wars franchise.",
|
|
29
|
-
"timestamp": "1725875332",
|
|
30
|
-
"name": null
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"id": "msg_A9UeOFT9SF3pKzJzar1HwM7d",
|
|
34
|
-
"conversationId": "thread_gy2K7D3efStfchq2v5VvpEvn",
|
|
35
|
-
"agentId": null,
|
|
36
|
-
"role": "user",
|
|
37
|
-
"message": "Who is Han Solo?",
|
|
38
|
-
"timestamp": "1725875323",
|
|
39
|
-
"name": null
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"timestamp": "1725875483"
|
|
43
|
-
}
|