graphdb-workbench-tests 2.8.8 → 2.8.9-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.
@@ -66,4 +66,28 @@ describe('Autocomplete ', () => {
66
66
  .should('be.visible')
67
67
  .and('not.be.disabled');
68
68
  });
69
+
70
+ it('should allow add and edit of autocomplete label', () => {
71
+ // Given I'm on the Autocomplete page
72
+ AutocompleteSteps.visit();
73
+ cy.wait('@get-license');
74
+ AutocompleteSteps.waitUntilAutocompletePageIsLoaded();
75
+ // The table should not contain this label
76
+ AutocompleteSteps.getAutocompleteLabels().should('not.contain.text', 'http://xmlns.com/foaf/0.1/name');
77
+
78
+ // When I add a label
79
+ AutocompleteSteps.addLabelAndLanguage('http://xmlns.com/foaf/0.1/name', 'fr');
80
+ // Then the list should have my new label
81
+ AutocompleteSteps.getAutocompleteLabels().should('contain.text', 'http://xmlns.com/foaf/0.1/name');
82
+
83
+ // When I edit the new label
84
+ AutocompleteSteps.editLabelOnRow(0);
85
+ AutocompleteSteps.typeLabelIri('http://purl.org/dc/elements/1.1/title');
86
+ AutocompleteSteps.saveLabel();
87
+ // Then the list should no longer have the old label
88
+ AutocompleteSteps.getAutocompleteLabels().should('not.contain.text', 'http://xmlns.com/foaf/0.1/name');
89
+ // And instead have the edited label
90
+ AutocompleteSteps.getAutocompleteLabels().should('contain.text', 'http://purl.org/dc/elements/1.1/title');
91
+ AutocompleteSteps.getAutocompleteLabels().should('contain.text', 'fr');
92
+ });
69
93
  });
@@ -0,0 +1,53 @@
1
+ import {UserAndAccessSteps} from "../../../steps/setup/user-and-access-steps";
2
+ import {RepositoriesStubs} from "../../../stubs/repositories/repositories-stubs";
3
+ import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
4
+ import {ToasterSteps} from "../../../steps/toaster-steps";
5
+
6
+ const DEFAULT_ADMIN_PASSWORD = "root";
7
+ // Moved out of the standard test suite, because Cypress can't verify Free Access is ON in CI
8
+ describe('Security and Free Access', () => {
9
+ beforeEach(() => {
10
+ UserAndAccessSteps.visit();
11
+ cy.window();
12
+ // Users table should be visible
13
+ UserAndAccessSteps.getUsersTable().should('be.visible');
14
+ });
15
+
16
+ afterEach(() => {
17
+ UserAndAccessSteps.visit();
18
+ UserAndAccessSteps.getToggleSecurityCheckbox()
19
+ .then(($toggle) => {
20
+ if ($toggle.prop('checked')) {
21
+ // Uncheck the security toggle button at the end of each test, if it is checked
22
+ UserAndAccessSteps.toggleSecurity();
23
+ }
24
+ });
25
+ });
26
+
27
+ it('should toggle free access after Admin has logged in', () => {
28
+ // Given I have available repositories to allow Free Access for
29
+ RepositoriesStubs.stubRepositories();
30
+ // When I enable security
31
+ UserAndAccessSteps.toggleSecurity();
32
+ // When I log in as an Admin
33
+ UserAndAccessSteps.loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
34
+ // Then the page should load
35
+ UserAndAccessSteps.getSplashLoader().should('not.be.visible');
36
+ UserAndAccessSteps.getUsersTable().should('be.visible');
37
+ // The Free Access toggle should be OFF
38
+ UserAndAccessSteps.getFreeAccessSwitchInput().should('not.be.checked');
39
+ // When I toggle Free Access ON
40
+ UserAndAccessSteps.toggleFreeAccess();
41
+ // Then I click OK in the modal
42
+ ModalDialogSteps.clickOKButton();
43
+ // Then the toggle button should be ON
44
+ UserAndAccessSteps.getFreeAccessSwitchInput().should('be.checked');
45
+ // And I should see a success message
46
+ ToasterSteps.verifySuccess('Free access has been enabled.');
47
+ UserAndAccessSteps.getUsersTable().should('be.visible');
48
+ // When I toggle Free Access OFF
49
+ UserAndAccessSteps.toggleFreeAccess();
50
+ // Then I should see a success message
51
+ ToasterSteps.verifySuccess('Free access has been disabled.');
52
+ });
53
+ });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.8.8",
3
+ "version": "2.8.9-RC1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "2.8.8",
9
+ "version": "2.8.9-RC1",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "cypress": "^13.3.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.8.8",
3
+ "version": "2.8.9-RC1",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
@@ -39,6 +39,10 @@ export class ModalDialogSteps {
39
39
  ModalDialogSteps.getConfirmButton().click();
40
40
  }
41
41
 
42
+ static clickOKButton() {
43
+ ModalDialogSteps.getDialogFooter().find('.btn-primary').click();
44
+ }
45
+
42
46
  static confirm() {
43
47
  ModalDialogSteps.getConfirmButton().click();
44
48
  }
@@ -57,11 +57,42 @@ export class AutocompleteSteps {
57
57
  return this.getAutocompletePage().find('#wb-autocomplete-addLabel');
58
58
  }
59
59
 
60
+ static addLabelAndLanguage(label, language) {
61
+ this.getAddLabelButton().click();
62
+ this.typeLabelIri(label);
63
+ this.typeLabelLanguages(language);
64
+ this.saveLabel();
65
+ }
66
+
67
+ static typeLabelIri(iri) {
68
+ this.getAddLabelForm().find('#wb-autocomplete-iri').click().clear().type(iri);
69
+ }
70
+
71
+ static typeLabelLanguages(languages) {
72
+ this.getAddLabelForm().find('#wb-autocomplete-languages').click().type(languages);
73
+ }
74
+
60
75
  static getAutocompleteLabels() {
61
76
  return this.getAutocompletePage().find('#wb-autocomplete-labels');
62
77
  }
63
78
 
79
+ static getTableRows() {
80
+ return cy.get('.wb-autocomplete-labels-row');
81
+ }
82
+
64
83
  static getSuccessStatusElement() {
65
84
  return cy.get('.autocomplete-status').find('.tag.tag-success.ng-binding');
66
85
  }
86
+
87
+ static getAddLabelForm() {
88
+ return cy.get('#addLabelForm');
89
+ }
90
+
91
+ static saveLabel() {
92
+ cy.get('#wb-autocomplete-savegraph-submit').click();
93
+ }
94
+
95
+ static editLabelOnRow(rowIndex) {
96
+ this.getTableRows().eq(rowIndex).find('.actions-bar .icon-edit').click();
97
+ }
67
98
  }
@@ -23,10 +23,25 @@ export class UserAndAccessSteps {
23
23
  return cy.get('#toggle-security span.switch');
24
24
  }
25
25
 
26
+ static getToggleSecurityCheckbox() {
27
+ return cy.get('#toggle-security input[type="checkbox"]');
28
+ }
26
29
  static toggleSecurity() {
27
30
  this.getToggleSecuritySwitch().click();
28
31
  }
29
32
 
33
+ static getFreeAccessSwitchInput() {
34
+ return cy.get('#toggle-freeaccess .switch input');
35
+ }
36
+
37
+ static getFreeAccessSwitch() {
38
+ return cy.get('#toggle-freeaccess span.switch');
39
+ }
40
+
41
+ static toggleFreeAccess() {
42
+ this.getFreeAccessSwitch().click();
43
+ }
44
+
30
45
  static getSecuritySwitchLabel() {
31
46
  return cy.get('#toggle-security').find('.security-switch-label');
32
47
  }