graphdb-workbench-tests 3.4.0-TR6 → 3.4.0-TR7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,21 @@ import {RepositorySteps} from "../../steps/repository-steps";
2
2
  import {AttachRepositorySteps} from "../../steps/repositories/attach-repository-steps";
3
3
  import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
4
4
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
5
+ import {RemoteLocationStubs} from '../../stubs/cluster/remote-location-stubs.js';
5
6
 
6
7
  describe('Attach remote location', () => {
8
+ let remoteLocationName;
9
+
10
+ beforeEach(() => {
11
+ remoteLocationName = 'http://location-' + Date.now();
12
+ });
13
+
14
+ afterEach(() => {
15
+ cy.deleteRemoteLocation(remoteLocationName);
16
+ })
7
17
 
8
18
  it('Should create and delete remote instance', () => {
9
- cy.visit('/repository');
10
- RepositorySteps.waitLoader();
11
- RepositorySteps.waitUntilRepositoriesPageIsLoaded();
19
+ RepositorySteps.visit();
12
20
 
13
21
  // When I open the "Attach a remote instance" dialog.
14
22
  AttachRepositorySteps.openAttachRemoteLocationDialog();
@@ -114,12 +122,43 @@ describe('Attach remote location', () => {
114
122
  RepositorySteps.getSparqlOntopicTable().should('not.exist');
115
123
  });
116
124
 
125
+ it('should be able to create a remote location with encrypted password', () => {
126
+ // Given I have a running GDB instance and I am on the Repositories view
127
+ RepositorySteps.visit();
128
+ // When I start the location creation
129
+ AttachRepositorySteps.openAttachRemoteLocationDialog();
130
+ AttachRepositorySteps.enterURL(remoteLocationName);
131
+ // And I select basic auth type
132
+ AttachRepositorySteps.selectBasicRadioBtn();
133
+ // Then I expect to see a security warning
134
+ AttachRepositorySteps.getUnencryptedPasswordWarning().should('be.visible');
135
+ // And I should not see the warning for the backward compatibility issues when encrypting the password
136
+ AttachRepositorySteps.getBackwardCompatibilityWarning().should('not.exist');
137
+ // When I select to encrypt the password
138
+ AttachRepositorySteps.encryptPassword();
139
+ // Then I should see the backward compatibility warning
140
+ AttachRepositorySteps.getBackwardCompatibilityWarning().should('be.visible');
141
+ // And the unencrypted password warning should not be visible
142
+ AttachRepositorySteps.getUnencryptedPasswordWarning().should('not.exist');
143
+ // When I fill in username and password
144
+ AttachRepositorySteps.enterUsername('locationadmin');
145
+ AttachRepositorySteps.enterPassword('admin123');
146
+ // And I save the location
147
+ RemoteLocationStubs.spyRemoteLocationCreate();
148
+ AttachRepositorySteps.attachRemoteLocation();
149
+ // Then encrypt password flag should be sent
150
+ cy.wait('@add-remote-location')
151
+ .its('request.body')
152
+ .should('include', {
153
+ encryptPassword: true,
154
+ username: 'locationadmin'
155
+ });
156
+ });
157
+
117
158
  it('Should render different location types in separate tables: error, location with and without repositories', () => {
118
159
  RepositoriesStubs.stubRepositories();
119
160
  RepositoriesStubs.stubLocations();
120
- cy.visit('/repository');
121
- RepositorySteps.waitLoader();
122
- RepositorySteps.waitUntilRepositoriesPageIsLoaded();
161
+ RepositorySteps.visit();
123
162
  cy.wait('@get-all-repositories');
124
163
 
125
164
  // When I open the Repositories view that contains all possible kind of locations.
@@ -137,9 +176,7 @@ describe('Attach remote location', () => {
137
176
  });
138
177
 
139
178
  it('Should be able to open edit remote location dialog', () => {
140
- cy.visit('/repository');
141
- RepositorySteps.waitLoader();
142
- RepositorySteps.waitUntilRepositoriesPageIsLoaded();
179
+ RepositorySteps.visit();
143
180
 
144
181
  const locationId = 'http://local';
145
182
  addRemoteSPARQLLocation(locationId, 'username', 'password');
@@ -161,9 +198,7 @@ describe('Attach remote location', () => {
161
198
  });
162
199
 
163
200
  it('Should create and delete SPARQL endpoint instance', () => {
164
- cy.visit('/repository');
165
- RepositorySteps.waitLoader();
166
- RepositorySteps.waitUntilRepositoriesPageIsLoaded();
201
+ RepositorySteps.visit();
167
202
 
168
203
  const locationId = 'http://endpoint/repo/ex';
169
204
  addRemoteSPARQLLocation(locationId, 'username', 'password');
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.4.0-TR6",
3
+ "version": "3.4.0-TR7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.4.0-TR6",
9
+ "version": "3.4.0-TR7",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "@bahmutov/cypress-code-coverage": "^2.7.2",
@@ -1071,9 +1071,9 @@
1071
1071
  }
1072
1072
  },
1073
1073
  "node_modules/@babel/plugin-transform-modules-systemjs": {
1074
- "version": "7.29.0",
1075
- "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.29.0.tgz",
1076
- "integrity": "sha512-PrujnVFbOdUpw4UHiVwKvKRLMMic8+eC0CuNlxjsyZUiBjhFdPsewdXCkveh2KqBA9/waD0W1b4hXSOBQJezpQ==",
1074
+ "version": "7.29.4",
1075
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.29.4.tgz",
1076
+ "integrity": "sha512-N7QmZ0xRZfjHOfZeQLJjwgX2zS9pdGHSVl/cjSGlo4dXMqvurfxXDMKY4RqEKzPozV78VMcd0lxyG13mlbKc4w==",
1077
1077
  "dev": true,
1078
1078
  "license": "MIT",
1079
1079
  "dependencies": {
@@ -5420,9 +5420,9 @@
5420
5420
  "license": "MIT"
5421
5421
  },
5422
5422
  "node_modules/fast-uri": {
5423
- "version": "3.1.0",
5424
- "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz",
5425
- "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==",
5423
+ "version": "3.1.2",
5424
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.2.tgz",
5425
+ "integrity": "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==",
5426
5426
  "dev": true,
5427
5427
  "funding": [
5428
5428
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.4.0-TR6",
3
+ "version": "3.4.0-TR7",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,5 +1,9 @@
1
1
  export class AttachRepositorySteps {
2
2
 
3
+ static getRemoteLocationSettingsForm() {
4
+ return cy.get('#remoteLocationForm');
5
+ }
6
+
3
7
  static getAttachRemoteLocationBtn() {
4
8
  return cy.get('#addAttachRemoteLocation');
5
9
  }
@@ -115,4 +119,16 @@ export class AttachRepositorySteps {
115
119
  static clearPassword() {
116
120
  AttachRepositorySteps.getPasswordInput().clear();
117
121
  }
122
+
123
+ static getUnencryptedPasswordWarning() {
124
+ return this.getRemoteLocationSettingsForm().find('.unencrypted-password-warning');
125
+ }
126
+
127
+ static getBackwardCompatibilityWarning() {
128
+ return this.getRemoteLocationSettingsForm().find('.backward-compatibility-warning');
129
+ }
130
+
131
+ static encryptPassword() {
132
+ this.getRemoteLocationSettingsForm().find('#encryptPassword').check();
133
+ }
118
134
  }
@@ -7,6 +7,10 @@ export class RemoteLocationStubs extends Stubs {
7
7
  }).as('add-remote-location');
8
8
  }
9
9
 
10
+ static spyRemoteLocationCreate() {
11
+ cy.intercept('POST', '/rest/locations').as('add-remote-location');
12
+ }
13
+
10
14
  static stubGetRemoteLocations(count = 'no') {
11
15
  cy.intercept('GET', '/rest/locations', {
12
16
  fixture: `/remote-location/get-${count}-remote-locations.json`,
@@ -78,6 +78,25 @@ Cypress.Commands.add('initializeRepository', (id) => {
78
78
  });
79
79
  });
80
80
 
81
+ /**
82
+ * A command for deleting remote locations by URI. It sends a DELETE request to the appropriate endpoint and waits until
83
+ * the response is received.
84
+ *
85
+ * @param {string} uri - The URI of the remote location to be deleted.
86
+ */
87
+ Cypress.Commands.add('deleteRemoteLocation', (uri) => {
88
+ cy.request({
89
+ method: 'DELETE',
90
+ url: '/rest/locations?uri=' + encodeURIComponent(uri),
91
+ headers: {
92
+ 'Content-Type': 'application/json'
93
+ },
94
+ failOnStatusCode: false
95
+ }).then((response) => {
96
+ cy.waitUntil(() => response);
97
+ });
98
+ });
99
+
81
100
  Cypress.Commands.add('enableAutocomplete', (repositoryId) => {
82
101
  toggleAutocomplete(repositoryId, true);
83
102
  });