graphdb-workbench-tests 2.7.6 → 2.8.0-RC2
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 +3 -0
- 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.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/connectors/get-connectors.json +8 -0
- package/fixtures/connectors/get-retrieval-connector-0.json +1 -0
- package/fixtures/connectors/get-retrieval-connector.json +29 -0
- package/fixtures/connectors/get-ttyg-chatgpt-connectors.json +188 -0
- package/fixtures/locale-en.json +630 -61
- package/fixtures/namespaces/get-repository-starwars-namespaces.json +252 -0
- 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 +67 -0
- package/fixtures/repositories/get-repositories.json +106 -0
- package/fixtures/repositories/get-repository-config-starwars-disabled-fts.json +201 -0
- package/fixtures/repositories/get-repository-config-starwars-enabled-fts.json +201 -0
- package/fixtures/repositories/get-ttyg-repositories.json +74 -0
- package/fixtures/similarity/get-similarity-indexes-0.json +1 -0
- package/fixtures/similarity/get-similarity-indexes.json +15 -0
- package/fixtures/similarity/get-ttyg-similarity-connectors.json +46 -0
- package/fixtures/ttyg/agent/create-agent.json +20 -0
- package/fixtures/ttyg/agent/get-agent-defaults.json +42 -0
- package/fixtures/ttyg/agent/get-agent-list-0.json +1 -0
- package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +56 -0
- package/fixtures/ttyg/agent/get-agent-list-new-agent.json +22 -0
- package/fixtures/ttyg/agent/get-agent-list.json +77 -0
- 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/deleted-chat.json +3 -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/export-chat.json +34 -0
- package/fixtures/ttyg/chats/get-chat-list-0.json +1 -0
- package/fixtures/ttyg/chats/get-chat-list-with-deleted-chat.json +17 -0
- package/fixtures/ttyg/chats/get-chat-list-with-renamed-chat.json +22 -0
- package/fixtures/ttyg/chats/get-chat-list.json +22 -0
- package/fixtures/ttyg/chats/get-chat.json +199 -0
- package/fixtures/ttyg/chats/renamed-chat.json +4 -0
- package/integration/cluster/cluster-management.spec.js +0 -170
- package/integration/cluster/edit-cluster-nodes-modal.spec.js +425 -0
- package/integration/explore/graphs.overview.spec.js +4 -0
- package/integration/home/cookie-policy.spec.js +65 -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 +8 -2
- package/integration/import/import-view.spec.js +6 -1
- package/integration/repository/attach-remote-location.spec.js +203 -0
- package/integration/repository/ontop-repository.spec.js +87 -1
- package/integration/repository/repositories.spec.js +4 -19
- package/integration/setup/my-settings.spec.js +2 -0
- package/integration/ttyg/agent-list.spec.js +76 -0
- package/integration/ttyg/agent-select-menu.spec.js +141 -0
- package/integration/ttyg/chat-list.spec.js +286 -0
- package/integration/ttyg/chat-panel.spec.js +175 -0
- package/integration/ttyg/clone-agent.spec.js +75 -0
- package/integration/ttyg/create-agent.spec.js +560 -0
- package/integration/ttyg/create-chat.spec.js +69 -0
- package/integration/ttyg/delete-agent.spec.js +51 -0
- package/integration/ttyg/edit-agent.spec.js +54 -0
- package/integration/ttyg/ttyg-permission.spec.js +66 -0
- package/integration/ttyg/ttyg-view.spec.js +75 -0
- package/npm-shrinkwrap.json +215 -220
- package/package.json +5 -6
- package/steps/alert-dialog-steps.js +25 -0
- package/steps/cluster/cluster-page-steps.js +8 -0
- package/steps/cluster/custer-nodes-configuration-steps.js +107 -0
- package/steps/home-steps.js +48 -5
- package/steps/import/import-steps.js +11 -11
- package/steps/modal-dialog-steps.js +8 -0
- package/steps/ontop-repository-steps.js +26 -0
- package/steps/repositories/attach-repository-steps.js +118 -0
- package/steps/repository-steps.js +53 -5
- package/steps/setup/settings-steps.js +17 -0
- package/steps/ttyg/chat-panel-steps.js +62 -0
- package/steps/ttyg/ttyg-agent-settings-modal.steps.js +462 -0
- package/steps/ttyg/ttyg-view-steps.js +333 -0
- package/steps/window-steps.js +5 -0
- package/stubs/cluster/cluster-stubs.js +127 -7
- package/stubs/cluster/remote-location-stubs.js +46 -0
- package/stubs/connector-stubs.js +39 -0
- package/stubs/environment-stubs.js +27 -0
- package/stubs/license-stubs.js +101 -0
- package/stubs/repositories/repositories-stubs.js +133 -0
- package/stubs/repositories-stub.js +15 -0
- package/stubs/security-stubs.js +7 -0
- package/stubs/similarity-index-stubs.js +32 -0
- package/stubs/stubs.js +4 -0
- package/stubs/ttyg/ttyg-stubs.js +166 -0
- package/support/commands.js +2 -0
- package/support/index.js +17 -0
- package/support/security-command.js +25 -0
- package/support/settings-commands.js +4 -5
- package/support/user-commands.js +31 -0
- 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,101 @@
|
|
|
1
|
+
export class LicenseStubs {
|
|
2
|
+
|
|
3
|
+
static stubFreeLicense() {
|
|
4
|
+
cy.intercept('GET', '/rest/graphdb-settings/license', {
|
|
5
|
+
statusCode: 200,
|
|
6
|
+
body: LicenseStubs.freeLicense()
|
|
7
|
+
}).as('freeLicense');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static stubEnterpriseLicense() {
|
|
11
|
+
cy.intercept('GET', '/rest/graphdb-settings/license', {
|
|
12
|
+
statusCode: 200,
|
|
13
|
+
body: LicenseStubs.enterpriseLicense()
|
|
14
|
+
}).as('enterpriseLicense');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static stubEvaluationLicense() {
|
|
18
|
+
cy.intercept('GET', '/rest/graphdb-settings/license', {
|
|
19
|
+
statusCode: 200,
|
|
20
|
+
body: LicenseStubs.evaluationLicense()
|
|
21
|
+
}).as('evaluationLicense');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
static freeLicense() {
|
|
26
|
+
return {
|
|
27
|
+
"message": "OK",
|
|
28
|
+
"valid": true,
|
|
29
|
+
"version": "10.7",
|
|
30
|
+
"expiryDate": null,
|
|
31
|
+
"licensee": "Freeware",
|
|
32
|
+
"product": "GRAPHDB_LITE",
|
|
33
|
+
"maxCpuCores": 1,
|
|
34
|
+
"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.",
|
|
35
|
+
"latestPublicationDate": null,
|
|
36
|
+
"licenseCapabilities": [
|
|
37
|
+
"Lucene connector"
|
|
38
|
+
],
|
|
39
|
+
"productType": "free",
|
|
40
|
+
"installationId": "1234-abcd-5678"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static enterpriseLicense() {
|
|
45
|
+
return {
|
|
46
|
+
message: "OK",
|
|
47
|
+
valid: true,
|
|
48
|
+
version: null,
|
|
49
|
+
expiryDate: 8640000000000000,
|
|
50
|
+
licensee: "ONTOTEXT_INTERNAL",
|
|
51
|
+
product: "GRAPHDB_ENTERPRISE",
|
|
52
|
+
maxCpuCores: null,
|
|
53
|
+
typeOfUse: "Non-commercial research only",
|
|
54
|
+
latestPublicationDate: null,
|
|
55
|
+
licenseCapabilities: [
|
|
56
|
+
"OpenSearch connector",
|
|
57
|
+
"Lucene connector",
|
|
58
|
+
"Kafka connector",
|
|
59
|
+
"Solr connector",
|
|
60
|
+
"Cluster",
|
|
61
|
+
"Elasticsearch connector"
|
|
62
|
+
],
|
|
63
|
+
productType: "enterprise",
|
|
64
|
+
installationId: "1234-abcd-5678"
|
|
65
|
+
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static evaluationLicense() {
|
|
70
|
+
return {
|
|
71
|
+
message: "OK",
|
|
72
|
+
valid: true,
|
|
73
|
+
version: null,
|
|
74
|
+
expiryDate: 8640000000000000,
|
|
75
|
+
licensee: "ONTOTEXT_INTERNAL",
|
|
76
|
+
product: "GRAPHDB_ENTERPRISE",
|
|
77
|
+
maxCpuCores: null,
|
|
78
|
+
typeOfUse: "this is an evaluation license",
|
|
79
|
+
latestPublicationDate: null,
|
|
80
|
+
licenseCapabilities: [
|
|
81
|
+
"OpenSearch connector",
|
|
82
|
+
"Lucene connector",
|
|
83
|
+
"Kafka connector",
|
|
84
|
+
"Solr connector",
|
|
85
|
+
"Cluster",
|
|
86
|
+
"Elasticsearch connector"
|
|
87
|
+
],
|
|
88
|
+
productType: "enterprise",
|
|
89
|
+
installationId: "1234-abcd-5678"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static stubGoogleCalls() {
|
|
94
|
+
cy.intercept('GET', 'https://www.googletagmanager.com/**', {
|
|
95
|
+
statusCode: 503
|
|
96
|
+
});
|
|
97
|
+
cy.intercept('POST', 'https://region1.google-analytics.com/**', {
|
|
98
|
+
statusCode: 500
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {Stubs} from "../stubs";
|
|
2
|
+
import {REPOSITORIES_URL} from "../../support/repository-commands";
|
|
3
|
+
import {RepositoriesStub} from "../repositories-stub";
|
|
4
|
+
|
|
5
|
+
export class RepositoriesStubs extends Stubs {
|
|
6
|
+
static stubRepositories(withDelay = 0, fixture = '/repositories/get-repositories.json') {
|
|
7
|
+
RepositoriesStubs.stubGetQueryResponse('/rest/repositories/all', fixture, 'get-all-repositories', withDelay);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static stubLocations(withDelay = 0) {
|
|
11
|
+
RepositoriesStubs.stubQueryResponse('/rest/locations', '/repositories/get-locations.json', 'get-locations', withDelay);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static stubEditOntopResponse(repositoryId) {
|
|
15
|
+
this.interceptRepository(repositoryId, 200);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static stubGetRepositoryConfig(repositoryId, fixture = '/repositories/get-repository-config.json', widthDelay = 0) {
|
|
19
|
+
RepositoriesStubs.stubQueryResponse(`/rest/repositories/${repositoryId}`, fixture, 'get-repository-config');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static getFixtureParams() {
|
|
23
|
+
return {
|
|
24
|
+
"propertiesFile": {
|
|
25
|
+
"name": "propertiesFile",
|
|
26
|
+
"label": "JDBC properties file",
|
|
27
|
+
"value": "repositories/ontop/ontop_jdbc.properties"
|
|
28
|
+
},
|
|
29
|
+
"lensesFile": {
|
|
30
|
+
"name": "lensesFile",
|
|
31
|
+
"label": "Lenses file",
|
|
32
|
+
"value": ""
|
|
33
|
+
},
|
|
34
|
+
"isShacl": {
|
|
35
|
+
"name": "isShacl",
|
|
36
|
+
"label": "Enable SHACL validation",
|
|
37
|
+
"value": "false"
|
|
38
|
+
},
|
|
39
|
+
"owlFile": {
|
|
40
|
+
"name": "owlFile",
|
|
41
|
+
"label": "Ontology file",
|
|
42
|
+
"value": ""
|
|
43
|
+
},
|
|
44
|
+
"member": {
|
|
45
|
+
"name": "member",
|
|
46
|
+
"label": "FedX repo members",
|
|
47
|
+
"value": []
|
|
48
|
+
},
|
|
49
|
+
"constraintFile": {
|
|
50
|
+
"name": "constraintFile",
|
|
51
|
+
"label": "Constraint file",
|
|
52
|
+
"value": ""
|
|
53
|
+
},
|
|
54
|
+
"obdaFile": {
|
|
55
|
+
"name": "obdaFile",
|
|
56
|
+
"label": "OBDA or R2RML file",
|
|
57
|
+
"value": "repositories/ontop/university-complete.obda"
|
|
58
|
+
},
|
|
59
|
+
"dbMetadataFile": {
|
|
60
|
+
"name": "dbMetadataFile",
|
|
61
|
+
"label": "DB metadata file",
|
|
62
|
+
"value": ""
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static interceptRepository(id, statusCode, extraParams = {}) {
|
|
68
|
+
cy.intercept(`${REPOSITORIES_URL}${id}?location=`, {
|
|
69
|
+
statusCode,
|
|
70
|
+
body: {
|
|
71
|
+
"id": id,
|
|
72
|
+
"title": "",
|
|
73
|
+
"type": "ontop",
|
|
74
|
+
"sesameType": "graphdb:OntopRepository",
|
|
75
|
+
"location": "",
|
|
76
|
+
"hostName": "localhost",
|
|
77
|
+
"params": { ...this.getFixtureParams(), ...extraParams }
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static stubRepoCreationEndpoints(repositoryId) {
|
|
83
|
+
cy.intercept(REPOSITORIES_URL + 'all', {
|
|
84
|
+
statusCode: 200,
|
|
85
|
+
body: {
|
|
86
|
+
"": [
|
|
87
|
+
{
|
|
88
|
+
"id": repositoryId,
|
|
89
|
+
"title": "",
|
|
90
|
+
"uri": "http://address:5423/repositories/ontop",
|
|
91
|
+
"externalUrl": "http://address:5423/repositories/ontop",
|
|
92
|
+
"local": true,
|
|
93
|
+
"type": "ontop",
|
|
94
|
+
"sesameType": "graphdb:OntopRepository",
|
|
95
|
+
"location": "",
|
|
96
|
+
"readable": true,
|
|
97
|
+
"writable": true,
|
|
98
|
+
"unsupported": false,
|
|
99
|
+
"state": "ACTIVE"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}).as('getMockRepositories');
|
|
104
|
+
|
|
105
|
+
cy.intercept(`${REPOSITORIES_URL}${repositoryId}/restart?location=*`, {
|
|
106
|
+
statusCode: 200,
|
|
107
|
+
body: {}
|
|
108
|
+
}).as('restartRepository');
|
|
109
|
+
|
|
110
|
+
RepositoriesStub.stubBaseEndpoints(repositoryId, [{
|
|
111
|
+
"type": "literal",
|
|
112
|
+
"value": "http://jena.apache.org/ARQ/function/aggregate#"
|
|
113
|
+
}]);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static stubSaveOntopResponse(repositoryId) {
|
|
117
|
+
cy.intercept(`${REPOSITORIES_URL}ontop/jdbc-properties?driverType=*`, {
|
|
118
|
+
statusCode: 200,
|
|
119
|
+
body: {
|
|
120
|
+
"id": repositoryId,
|
|
121
|
+
"title": "",
|
|
122
|
+
"type": "ontop",
|
|
123
|
+
"sesameType": "graphdb:OntopRepository",
|
|
124
|
+
"location": "",
|
|
125
|
+
"hostName": "localhost",
|
|
126
|
+
"driverClass": "postgresql",
|
|
127
|
+
"params": this.getFixtureParams()
|
|
128
|
+
}
|
|
129
|
+
}).as('saveChanges');
|
|
130
|
+
|
|
131
|
+
cy.intercept(`/rest/repositories/${repositoryId}`, { statusCode: 200 });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -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,13 @@ 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
|
+
|
|
15
22
|
static getAdminResponse(infer, sameAs) {
|
|
16
23
|
return {
|
|
17
24
|
"username": "admin",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {Stubs} from "./stubs";
|
|
2
|
+
|
|
3
|
+
export class SimilarityIndexStubs extends Stubs {
|
|
4
|
+
static stubGetSimilarityIndexes(fixture = '/similarity/get-similarity-indexes.json', delay = 0) {
|
|
5
|
+
this.stubQueryResponse('/rest/similarity', fixture, 'get-similarity-indexes', delay);
|
|
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
|
+
}
|
|
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
|
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import {Stubs} from "../stubs";
|
|
2
|
+
|
|
3
|
+
export class TTYGStubs extends Stubs {
|
|
4
|
+
static stubChatsListGet(fixture = '/ttyg/chats/get-chat-list.json', delay = 0) {
|
|
5
|
+
cy.intercept('GET', '/rest/chat/conversations', {
|
|
6
|
+
fixture: fixture,
|
|
7
|
+
statusCode: 200,
|
|
8
|
+
delay: delay
|
|
9
|
+
}).as('get-chat-list');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static stubChatListGetError() {
|
|
13
|
+
cy.intercept('GET', '/rest/chat/conversations', {
|
|
14
|
+
statusCode: 500,
|
|
15
|
+
response: {
|
|
16
|
+
error: 'Internal Server Error'
|
|
17
|
+
}
|
|
18
|
+
}).as('get-chat-list');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static stubChatsListGetNoResults() {
|
|
22
|
+
cy.intercept('GET', '/rest/chat/conversations', {
|
|
23
|
+
fixture: '/ttyg/chats/get-chat-list-0.json',
|
|
24
|
+
statusCode: 200
|
|
25
|
+
}).as('get-chat-list');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Loads the specified <code>fixture</code> and updates the chatId in the fixture with the actual ID passed in the endpoint call.
|
|
30
|
+
*
|
|
31
|
+
* @param {number} delay - Optional delay in milliseconds before responding with the fixture.
|
|
32
|
+
*/
|
|
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) => {
|
|
39
|
+
const chatId = req.url.split('/').pop();
|
|
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
|
+
});
|
|
47
|
+
}).as('get-chat');
|
|
48
|
+
});
|
|
49
|
+
}
|
|
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
|
+
|
|
60
|
+
static stubChatUpdate() {
|
|
61
|
+
cy.intercept('PUT', '/rest/chat/conversations/*', {
|
|
62
|
+
fixture: '/ttyg/chats/renamed-chat.json',
|
|
63
|
+
statusCode: 200
|
|
64
|
+
}).as('update-chat');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static stubChatDelete() {
|
|
68
|
+
cy.intercept('DELETE', '/rest/chat/conversations/*', {
|
|
69
|
+
fixture: '/ttyg/chats/deleted-chat.json',
|
|
70
|
+
statusCode: 200
|
|
71
|
+
}).as('delete-chat');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static stubChatExport() {
|
|
75
|
+
cy.intercept('GET', '/rest/chat/conversations/export/*', {
|
|
76
|
+
fixture: '/ttyg/chats/export-chat.json',
|
|
77
|
+
statusCode: 200
|
|
78
|
+
}).as('export-chat');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static stubAgentListGet(fixture = '/ttyg/agent/get-agent-list.json', delay = 0) {
|
|
82
|
+
cy.intercept('GET', '/rest/chat/agents', {
|
|
83
|
+
fixture: fixture,
|
|
84
|
+
statusCode: 200,
|
|
85
|
+
delay: delay
|
|
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');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static stubAgentListGetError() {
|
|
98
|
+
cy.intercept('GET', '/rest/chat/agents', {
|
|
99
|
+
statusCode: 500,
|
|
100
|
+
response: {
|
|
101
|
+
error: 'Internal Server Error'
|
|
102
|
+
}
|
|
103
|
+
}).as('get-agent-list-error');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static stubAgentCreate(delay = 0) {
|
|
107
|
+
cy.intercept('POST', '/rest/chat/agents', {
|
|
108
|
+
fixture: '/ttyg/agent/create-agent.json',
|
|
109
|
+
statusCode: 200,
|
|
110
|
+
delay: delay
|
|
111
|
+
}).as('create-agent');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static stubAgentEdit() {
|
|
115
|
+
cy.intercept({
|
|
116
|
+
method: 'PUT',
|
|
117
|
+
url: '/rest/chat/agents'
|
|
118
|
+
}, (req) => {
|
|
119
|
+
const requestBody = req.body;
|
|
120
|
+
req.reply({
|
|
121
|
+
statusCode: 200,
|
|
122
|
+
body: requestBody
|
|
123
|
+
});
|
|
124
|
+
}).as('edit-agent');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
static stubAgentDelete(delay = 0) {
|
|
128
|
+
cy.intercept('DELETE', '/rest/chat/agents/**', {
|
|
129
|
+
statusCode: 200,
|
|
130
|
+
delay: delay
|
|
131
|
+
}).as('delete-agent');
|
|
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
|
+
}
|
|
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,18 @@ 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.stubUpdateUserData('admin');
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -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,11 +0,0 @@
|
|
|
1
|
-
import {ModalDialogSteps} from "../modal-dialog-steps";
|
|
2
|
-
|
|
3
|
-
export class AddRemoteLocationDialogSteps extends ModalDialogSteps {
|
|
4
|
-
static typeLocation(location) {
|
|
5
|
-
this.getDialog().find('#sesameLocation').type(location);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
static addLocation() {
|
|
9
|
-
this.getDialogFooter().find('.add-location-btn').click();
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {ModalDialogSteps} from "../modal-dialog-steps";
|
|
2
|
-
|
|
3
|
-
export class CreateClusterDialogSteps extends ModalDialogSteps {
|
|
4
|
-
static getCreateClusterDialog() {
|
|
5
|
-
return this.getDialog().find('.create-cluster-dialog');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
static getClusterNodesPanel() {
|
|
9
|
-
return this.getCreateClusterDialog().find('.cluster-nodes');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static getClusterNodesList() {
|
|
13
|
-
return this.getClusterNodesPanel().find('.nodes-list .list-group-item');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static getRemoteLocationsList() {
|
|
17
|
-
return this.getCreateClusterDialog().find('.remote-locations .location-item');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static getSaveClusterConfigButton() {
|
|
21
|
-
return this.getDialogFooter().find('.create-cluster-btn');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static saveClusterConfig() {
|
|
25
|
-
return this.getSaveClusterConfigButton().click();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static openAddRemoteLocationDialog() {
|
|
29
|
-
this.getDialog().find('#addLocation').click();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static selectRemoteLocation(index) {
|
|
33
|
-
this.getRemoteLocationsList().eq(index).click();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static getNoSelectedNodesWarning() {
|
|
37
|
-
return this.getDialog().find('.no-selected-nodes');
|
|
38
|
-
}
|
|
39
|
-
}
|