graphdb-workbench-tests 3.3.2-RC1 → 3.3.2-RC3

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.
@@ -3,6 +3,8 @@ import HomeSteps from '../../steps/home-steps.js';
3
3
  import {RepositoryErrorsWidgetSteps} from '../../steps/widgets/repository-errors-widget-steps.js';
4
4
  import {RepositorySteps} from '../../steps/repository-steps.js';
5
5
  import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
6
+ import {ErrorPageSteps} from '../../steps/error-page-steps.js';
7
+ import {MainMenuSteps} from '../../steps/main-menu-steps.js';
6
8
 
7
9
  describe('URL with Repository ID parameter', () => {
8
10
  let repositoryId;
@@ -152,4 +154,27 @@ describe('URL with Repository ID parameter', () => {
152
154
  cy.url().should('include', 'repositoryId=' + repositoryId);
153
155
  });
154
156
  });
157
+
158
+ describe('When navigating between legacy and new workbench', () => {
159
+ beforeEach(() => {
160
+ repositoryId = 'repository-in-url-' + Date.now();
161
+ cy.createRepository({id: repositoryId});
162
+ cy.presetRepository(repositoryId);
163
+ })
164
+
165
+ afterEach(() => {
166
+ cy.deleteRepository(repositoryId);
167
+ });
168
+
169
+ it('should preserve repositoryId parameter when navigating from 404 (new workbench) to legacy page', () => {
170
+ // Given I am on the 404 page which is in the new workbench
171
+ ErrorPageSteps.visit404();
172
+ ErrorPageSteps.get404Page().should('be.visible');
173
+ cy.url().should('not.include', 'repositoryId=');
174
+ // When I navigate to some legacy page
175
+ MainMenuSteps.clickOnSparqlMenu();
176
+ // Then repositoryId parameter should be preserved in the URL
177
+ cy.url().should('include', `repositoryId=${repositoryId}`);
178
+ });
179
+ });
155
180
  });
@@ -0,0 +1,57 @@
1
+ import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
2
+ import {LoginSteps} from '../../steps/login-steps.js';
3
+ import {UserAndAccessSteps} from '../../steps/setup/user-and-access-steps.js';
4
+ import HomeSteps from '../../steps/home-steps.js';
5
+
6
+ describe('URL with Repository ID parameter', () => {
7
+ let repositoryId;
8
+
9
+ beforeEach(() => {
10
+ repositoryId = 'repository-in-url-' + Date.now();
11
+ cy.createRepository({id: repositoryId});
12
+ cy.presetRepository(repositoryId);
13
+ })
14
+
15
+ afterEach(() => {
16
+ cy.loginAsAdmin();
17
+ cy.switchOffSecurity(true);
18
+ cy.deleteRepository(repositoryId);
19
+ });
20
+
21
+ it('should set repositoryId in url after enable security->login', () => {
22
+ enableSecurity(repositoryId);
23
+ // When user logs in again
24
+ LoginSteps.loginWithUser('admin', 'root');
25
+ // Then repositoryId parameter should be present in the URL and repository should be selected in the selector
26
+ UserAndAccessSteps.getUsersCatalogContainer().should('be.visible');
27
+ cy.url().should('include', 'repositoryId=' + repositoryId);
28
+ RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
29
+ });
30
+
31
+ it('should set repositoryId in ur after first login', () => {
32
+ // Given security is on
33
+ cy.switchOnSecurity();
34
+ // And I log in with user admin
35
+ LoginSteps.visitLoginPage();
36
+ LoginSteps.loginWithUser('admin', 'root');
37
+ // Then repositoryId parameter should be present in the URL and repository should be selected in the selector
38
+ HomeSteps.getView().should('be.visible');
39
+ cy.url().should('include', 'repositoryId=' + repositoryId);
40
+ RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
41
+ });
42
+ });
43
+
44
+ function enableSecurity(repositoryId) {
45
+ // Given security is off
46
+ // When user visits user and access page
47
+ UserAndAccessSteps.visit();
48
+ // Then url should contain repositoryId parameter and repository should be selected in the selector
49
+ cy.url().should('include', 'repositoryId=' + repositoryId);
50
+ RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
51
+ // When user toggles security on
52
+ UserAndAccessSteps.toggleSecurity();
53
+ // Then user should be logged out and login page should be shown
54
+ LoginSteps.getLoginPage().should('be.visible');
55
+ // And repositoryId parameter should not be present in the URL
56
+ cy.url().should('not.include', 'repositoryId=');
57
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.3.2-RC1",
3
+ "version": "3.3.2-RC3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.3.2-RC1",
9
+ "version": "3.3.2-RC3",
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": "3.3.2-RC1",
3
+ "version": "3.3.2-RC3",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -0,0 +1,9 @@
1
+ export class ErrorPageSteps {
2
+ static visit404() {
3
+ cy.visit('/404');
4
+ }
5
+
6
+ static get404Page() {
7
+ return cy.get('app-not-found-page');
8
+ }
9
+ }
@@ -18,6 +18,10 @@ export class LoginSteps {
18
18
  cy.visit(`/login?r=${returnURLEncoded}`);
19
19
  }
20
20
 
21
+ static getLoginPage() {
22
+ return cy.get('app-login');
23
+ }
24
+
21
25
  static navigateToLoginPage() {
22
26
  cy.get('onto-user-login').click();
23
27
  }
@@ -13,6 +13,10 @@ export class UserAndAccessSteps {
13
13
  });
14
14
  }
15
15
 
16
+ static getUsersCatalogContainer() {
17
+ return cy.get('#wb-users');
18
+ }
19
+
16
20
  static getUrl() {
17
21
  return cy.url();
18
22
  }
@@ -363,15 +367,15 @@ export class UserAndAccessSteps {
363
367
  }
364
368
 
365
369
  static clickFreeWriteAccessRepo(repoName) {
366
- const repoRow = cy.get('.repo-fields').contains(repoName).parent('.row');
367
- repoRow.scrollIntoView();
368
- repoRow.find('.write').realClick();
370
+ cy.get('.repo-fields').contains(repoName).parent('.row').as('row');
371
+ cy.get('@row').scrollIntoView();
372
+ cy.get('@row').find('.write').realClick();
369
373
  }
370
374
 
371
375
  static clickFreeGraphqlAccessRepo(repoName) {
372
- const repoRow = cy.get('.repo-fields').contains(repoName).parent('.row');
373
- repoRow.scrollIntoView();
374
- repoRow.find('.graphql').realClick();
376
+ cy.get('.repo-fields').contains(repoName).parent('.row').as('row');
377
+ cy.get('@row').scrollIntoView();
378
+ cy.get('@row').find('.graphql').realClick();
375
379
  }
376
380
 
377
381
  }