graphdb-workbench-tests 4.0.0-TR15 → 4.0.0-TR16

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.
@@ -245,48 +245,42 @@ describe('Ontop repositories', () => {
245
245
  context('Repository maintenance permission', () => {
246
246
 
247
247
  const PASSWORD = 'root';
248
- const REPOSITORY_MAINTAINER_USERNAME = 'repoMaintainer';
249
- const REPOSITORY_MANAGER_USERNAME = 'repoManager';
248
+ let repositoryMaintainerUsername;
250
249
 
251
250
  beforeEach(() => {
252
- cy.createUser({
253
- username: REPOSITORY_MAINTAINER_USERNAME,
254
- password: PASSWORD,
255
- grantedAuthorities: [
256
- `READ_REPO_${repositoryId}`,
257
- `MAINTAIN_REPO_${repositoryId}`,
258
- `WRITE_REPO_${repositoryId}`
259
- ]
260
- });
261
- cy.createUser({
262
- username: REPOSITORY_MANAGER_USERNAME,
263
- password: PASSWORD,
264
- grantedAuthorities: [
265
- 'ROLE_USER',
266
- 'ROLE_MONITORING',
267
- 'ROLE_REPO_MANAGER'
268
- ]
269
- });
270
- cy.switchOnSecurity();
251
+ repositoryMaintainerUsername = 'repo-maintainer-' + Date.now();
271
252
  });
272
253
 
273
254
  afterEach(() => {
274
255
  cy.loginAsAdmin()
275
256
  .then(() => {
276
- cy.deleteUser(REPOSITORY_MAINTAINER_USERNAME, true);
277
- cy.deleteUser(REPOSITORY_MANAGER_USERNAME, true);
257
+ cy.deleteUser(repositoryMaintainerUsername, true);
278
258
  cy.switchOffSecurity(true);
279
259
  });
280
260
  });
281
261
  it('should allow a repository maintainer to edit an Ontop repository', () => {
282
262
  RepositoryStubs.spyGetJDBCProperties();
283
263
  // GIVEN: An Ontop repository exists
284
- cy.loginAs(REPOSITORY_MANAGER_USERNAME, PASSWORD);
285
264
  OntopRepositorySteps.visitCreate();
286
265
  createOntopRepository(repositoryId);
266
+ RepositorySteps.waitUntilRepositoriesPageIsLoaded();
267
+ RepositorySteps.getRepositoryFromList(repositoryId).should('exist');
268
+
269
+ // AND: A user with maintenance permission for it is created after the repository,
270
+ // because creating a repository removes the permissions already granted for its ID.
271
+ cy.createUser({
272
+ username: repositoryMaintainerUsername,
273
+ password: PASSWORD,
274
+ grantedAuthorities: [
275
+ `READ_REPO_${repositoryId}`,
276
+ `MAINTAIN_REPO_${repositoryId}`,
277
+ `WRITE_REPO_${repositoryId}`
278
+ ]
279
+ });
280
+ cy.switchOnSecurity();
287
281
 
288
282
  // WHEN: I log in as a user with maintenance permission
289
- cy.loginAs(REPOSITORY_MAINTAINER_USERNAME, PASSWORD);
283
+ cy.loginAs(repositoryMaintainerUsername, PASSWORD);
290
284
  RepositorySteps.visit();
291
285
 
292
286
  // THEN: The repository is visible because the user can maintain it
@@ -326,8 +320,7 @@ describe('Ontop repositories', () => {
326
320
  .should('contain.value', 'ontop.cardinalityMode=LOOSE');
327
321
  // Saving of the OBDA file verifies that the repository maintainer can access rest/repositories/file/upload
328
322
  OntopRepositorySteps.editOBDAFile();
329
- ModalDialogSteps.getDialogBody()
330
- .find('textarea')
323
+ OntopRepositorySteps.getFileContentEditor()
331
324
  .invoke('val')
332
325
  .should('include', 'edited ODBA file');
333
326
  ModalDialogSteps.close();
@@ -339,8 +332,7 @@ describe('Ontop repositories', () => {
339
332
  ModalDialogSteps.getDialogHeader()
340
333
  .should('contain', 'Edit "OBDA or R2RML file" contents');
341
334
 
342
- ModalDialogSteps.getDialogBody()
343
- .find('textarea')
335
+ OntopRepositorySteps.getFileContentEditor()
344
336
  .type('{moveToStart}Add commentary for testing purpose');
345
337
 
346
338
  ModalDialogSteps.clickOKButton();
@@ -354,8 +346,7 @@ describe('Ontop repositories', () => {
354
346
  cy.wait('@getJDBCProperties');
355
347
  OntopRepositorySteps.editOBDAFile();
356
348
 
357
- ModalDialogSteps.getDialogBody()
358
- .find('textarea')
349
+ OntopRepositorySteps.getFileContentEditor()
359
350
  .invoke('val')
360
351
  .should('include', 'Add commentary for testing purpose');
361
352
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "4.0.0-TR15",
3
+ "version": "4.0.0-TR16",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "4.0.0-TR15",
9
+ "version": "4.0.0-TR16",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "@bahmutov/cypress-code-coverage": "^2.7.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "4.0.0-TR15",
3
+ "version": "4.0.0-TR16",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -25,6 +25,10 @@ export class OntopRepositorySteps {
25
25
  OntopRepositorySteps.getOBDAFileFieldEditButton().click();
26
26
  }
27
27
 
28
+ static getFileContentEditor() {
29
+ return cy.getByTestId('repository-file-content');
30
+ }
31
+
28
32
  static getOntologyFileField() {
29
33
  return cy.get('div').contains("Ontology file");
30
34
  }