graphdb-workbench-tests 2.7.0-TR15 → 2.7.0-TR17

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.
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "ab": "http://learningsparql.com/ns/addressbook#"
4
+ },
5
+ "@id": "ab:richard",
6
+ "ab:homeTel": "(229)276-5135",
7
+ "ab:email": "richard491@hotmail.com"
8
+ }
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0"?>
2
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:ex="http://example.org/stuff/1.0/">
5
+
6
+ <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"
7
+ dc:title="RDF1.1 XML Syntax">
8
+ <ex:editor>
9
+ </rdf:Description>
10
+ </ex:editor>
11
+ </rdf:Description>
12
+
13
+ </rdf:RDF>
@@ -484,6 +484,7 @@
484
484
  "security.count.all.results": "Count all SPARQL results",
485
485
  "security.read.write.access": "Repositories read/write access",
486
486
  "security.user.rights": "Users should have rights to at least one repository!",
487
+ "security.user.role.too.short": "Must be at least 2 symbols long",
487
488
  "security.no.active.location": "There is no active location.",
488
489
  "security.repository.title": "Repository",
489
490
  "security.tooltip.read": "Read",
@@ -1010,9 +1011,9 @@
1010
1011
  },
1011
1012
  "on_file_size_limit": {
1012
1013
  "file_import_options_info_1": "Explore other file import options - ",
1013
- "file_import_options_info_2": "import (opens Server files tab) or ",
1014
+ "file_import_options_info_2": "import and the ",
1014
1015
  "server_files_link": "Server files",
1015
- "api_link": "API"
1016
+ "api_link": "GraphDB REST API."
1016
1017
  }
1017
1018
  },
1018
1019
  "import_resource_tree": {
@@ -1,5 +1,6 @@
1
1
  import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
2
2
  import {ImportServerFilesSteps} from "../../steps/import/import-server-files-steps";
3
+ import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
3
4
 
4
5
  describe('Import server files', () => {
5
6
 
@@ -11,7 +12,7 @@ describe('Import server files', () => {
11
12
  repositoryId = 'server-import-' + Date.now();
12
13
  cy.createRepository({id: repositoryId});
13
14
  ImportServerFilesSteps.visitServerImport(repositoryId);
14
- ImportServerFilesSteps.getResources().should('have.length', 14);
15
+ ImportServerFilesSteps.getResources().should('have.length', 17);
15
16
  });
16
17
 
17
18
  afterEach(() => {
@@ -41,22 +42,17 @@ describe('Import server files', () => {
41
42
 
42
43
  it('Should be able to toggle the server file import help', () => {
43
44
  // When the page is loaded
44
- // Then I expect import help message to be hidden because it is not an empty state
45
+ // Then I should not see the server files import help
45
46
  ImportServerFilesSteps.getHelpMessage().should('not.exist');
46
- // When I click on the help button
47
- ImportServerFilesSteps.openHelpMessage();
48
- // Then the help should appear
49
- ImportServerFilesSteps.getHelpMessage().should('be.visible');
50
- // When I close the help
51
- ImportServerFilesSteps.closeHelpMessage();
47
+ // When I open the help
48
+ ImportServerFilesSteps.toggleHelpMessage();
52
49
  // Then the help should disappear
53
- ImportServerFilesSteps.getHelpMessage().should('not.exist');
50
+ ImportServerFilesSteps.getHelpMessage().should('be.visible');
54
51
  });
55
52
 
56
53
  it('Should be able to filter the files', () => {
57
54
  // When the server files tab is loaded
58
55
  // Then I should see all the files
59
- ImportServerFilesSteps.getResources().should('have.length', 14);
60
56
  // When I type in the filter filed
61
57
  ImportServerFilesSteps.typeInFilterField('007');
62
58
  // Then I should see only the files matching the filter
@@ -68,15 +64,46 @@ describe('Import server files', () => {
68
64
  // When the server files tab is loaded
69
65
  // Then I should see all the files and folders by default
70
66
  ImportServerFilesSteps.getShowAllResourceTypesButton().should('have.class', 'active');
71
- ImportServerFilesSteps.getResources().should('have.length', 14);
67
+ ImportServerFilesSteps.getResources().should('have.length', 17);
72
68
  // When I select the folders only filter
73
69
  ImportServerFilesSteps.selectFoldersOnlyFilter();
74
70
  // Then I should see only the folders
75
71
  ImportServerFilesSteps.getShowOnlyFoldersButton().should('have.class', 'active');
76
- ImportServerFilesSteps.getResources().should('have.length', 1);
72
+ ImportServerFilesSteps.getResources().should('have.length', 2);
77
73
  // When I select the files only filter
78
74
  ImportServerFilesSteps.selectFilesOnlyFilter();
79
75
  // Then I should see only the files
80
- ImportServerFilesSteps.getResources().should('have.length', 13);
76
+ ImportServerFilesSteps.getResources().should('have.length', 15);
77
+ });
78
+
79
+ it('should be able to import the whole directory', () => {
80
+ // When the server files tab is loaded
81
+ // When I try to import a directory that contains resources with correct rdf data.
82
+ ImportServerFilesSteps.importResourceByName('more-files');
83
+ ImportSettingsDialogSteps.import();
84
+
85
+ // Then I expect all files to be successfully imported.
86
+ ImportServerFilesSteps.checkImportedResource(0, 'more-files', 'Imported successfully in');
87
+ ImportServerFilesSteps.checkImportedResource(1, 'jsonld-file.jsonld', 'Imported successfully in');
88
+ ImportServerFilesSteps.checkImportedResource(2, 'rdfxml.rdf', 'Imported successfully in');
89
+
90
+ // When I try to import a directory that contains resources with incorrect rdf data.
91
+ ImportServerFilesSteps.importResourceByName('more-files-with-error');
92
+ ImportSettingsDialogSteps.import();
93
+ // Then I expect no one file be imported.
94
+ ImportServerFilesSteps.checkImportedResource(0, 'more-files-with-error', 'RDF Parse Error: The element type "ex:editor" must be terminated by the matching end-ta');
95
+ ImportServerFilesSteps.checkImportedStatusIsEmpty('import-resource-with-correct-data.jsonld');
96
+ ImportServerFilesSteps.checkImportedStatusIsEmpty('import-resource-with-incorrect-data.rdf');
97
+
98
+ // When I click on a directory reset status button
99
+ ImportServerFilesSteps.resetResourceStatusByName('more-files');
100
+
101
+ // Then I expect all sub-resource statuses to be reset.
102
+ ImportServerFilesSteps.checkImportedStatusIsEmpty('more-files');
103
+ // TODO: When the status of a given folder is reset, all sub-folder/file statuses should be reset. This works correctly
104
+ // when the scenario is executed manually or if the test is run locally. For some reason, in the Jenkins environment, the status is cleared
105
+ // only for the folder. The next two lines are correct but are commented out to be tried again later.
106
+ // ImportServerFilesSteps.checkImportedStatusIsEmpty('jsonld-file.jsonld');
107
+ // ImportServerFilesSteps.checkImportedStatusIsEmpty('rdfxml.rdf');
81
108
  });
82
109
  });
@@ -78,26 +78,24 @@ describe('Import user data', () => {
78
78
  ImportUserDataSteps.visit();
79
79
  // When the page is loaded and no uploaded files are present
80
80
  ImportUserDataSteps.getResources().should('have.length', 0);
81
- // Then I should see the user data import help
81
+ // Then I should not see the user data import help
82
82
  ImportUserDataSteps.getHelpMessage().should('be.visible');
83
- // When I upload a text snippet
83
+ // When I have uploaded a text snippet
84
84
  ImportUserDataSteps.openImportTextSnippetDialog();
85
85
  ImportUserDataSteps.fillRDFTextSnippet(RDF_TEXT_SNIPPET);
86
86
  ImportUserDataSteps.clickImportTextSnippetButton();
87
87
  ImportSettingsDialogSteps.import();
88
88
  ImportUserDataSteps.getResources().should('have.length', 1);
89
- // Then the help should disappear because it's not an empty state anymore
90
89
  ImportUserDataSteps.getHelpMessage().should('not.exist');
91
- // When I open the help message
92
- ImportUserDataSteps.openHelpMessage();
93
- // Then the help message should appear
94
- ImportUserDataSteps.getHelpMessage().should('be.visible');
95
- // When I visit another page and return
90
+ ImportUserDataSteps.toggleHelpMessage();
91
+ // And I close the help
92
+ ImportUserDataSteps.closeHelpMessage();
93
+ // And I visit another page and return
96
94
  cy.visit('/webapi');
97
95
  cy.url().should('include', '/webapi');
98
96
  ImportUserDataSteps.visit();
99
97
  ImportUserDataSteps.getResources().should('have.length', 1);
100
- // Then the help should not appear because it's not an empty state
98
+ // Then the help should not appear because I have closed it explicitly
101
99
  ImportUserDataSteps.getHelpMessage().should('not.exist');
102
100
  // When I delete the uploaded file
103
101
  ImportUserDataSteps.deleteUploadedFile(0);
@@ -1,6 +1,8 @@
1
1
  import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
2
2
  import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
3
3
  import {ImportServerFilesSteps} from "../../steps/import/import-server-files-steps";
4
+ import ImportSteps from "../../steps/import/import-steps";
5
+ import HomeSteps from "../../steps/home-steps";
4
6
 
5
7
  const bnodes = `_:node0 <http://purl.org/dc/elements/1.1/title> "A new book" ;
6
8
  \t<http://purl.org/dc/elements/1.1/creator> "A.N.Other" .`;
@@ -35,11 +37,72 @@ describe('Import view', () => {
35
37
  // When I switch to the server files tab
36
38
  ImportUserDataSteps.openServerFilesTab();
37
39
  // Then I should see the server files only
38
- ImportServerFilesSteps.getResources().should('have.length', 14);
40
+ ImportServerFilesSteps.getResources().should('have.length', 17);
39
41
  // When I switch back to the user data tab
40
42
  ImportServerFilesSteps.openUserDataTab();
41
43
  // Then I should see the uploaded file
42
44
  ImportUserDataSteps.getResources().should('have.length', 1);
43
45
  ImportUserDataSteps.getResourceByName('bnodes.ttl').should('be.visible');
44
46
  });
47
+
48
+ it('Should display/hide help message depends on resource result', () => {
49
+ // Given I am on import page
50
+
51
+ // Then help message has to be displayed, because the result of imported files are empty.
52
+ ImportUserDataSteps.getHelpMessage().should('exist');
53
+
54
+ // When I toggle the help
55
+ ImportUserDataSteps.toggleHelpMessage();
56
+
57
+ // Then help message mustn't be displayed because the user has hidden it, regardless resources are empty.
58
+ ImportUserDataSteps.getHelpMessage().should('not.exist');
59
+
60
+ // When I go to server tab
61
+ ImportSteps.openServerFilesTab();
62
+
63
+ // Then help message mustn't be displayed because the resources are not empty.
64
+ ImportServerFilesSteps.getHelpMessage().should('not.exist');
65
+
66
+ // When I toggle the server help
67
+ ImportServerFilesSteps.toggleHelpMessage();
68
+
69
+ // Then I expect the help message be displayed.
70
+ ImportServerFilesSteps.getHelpMessage().should('exist');
71
+
72
+ // When I return to the user tab
73
+ ImportSteps.openUserDataTab();
74
+
75
+ // Then help message mustn't be displayed because the user has hidden it, regardless resources are empty.
76
+ ImportUserDataSteps.getHelpMessage().should('not.exist');
77
+
78
+ // When I go to server tab
79
+ ImportSteps.openServerFilesTab();
80
+
81
+ // Then I expect the help message be displayed.
82
+ ImportServerFilesSteps.getHelpMessage().should('exist');
83
+
84
+
85
+ // When I go to other view
86
+ HomeSteps.visit();
87
+ // And return to import user data
88
+ ImportUserDataSteps.visit();
89
+
90
+ // Then I expect the help message to be displayed, because there are no results, regardless of whether the user had previously hidden the help message.
91
+ ImportUserDataSteps.getHelpMessage().should('exist');
92
+
93
+ // When I go to server tab
94
+ ImportSteps.openServerFilesTab()
95
+
96
+ // Then help message mustn't be displayed because the resources are not empty.
97
+ ImportServerFilesSteps.getHelpMessage().should('not.exist');
98
+
99
+ // When I go to user tab and upload a file
100
+ ImportSteps.openUserDataTab();
101
+ ImportUserDataSteps.selectFile(ImportUserDataSteps.createFile(testFiles[0], bnodes));
102
+ ImportSettingsDialogSteps.import();
103
+ ImportUserDataSteps.getResources().should('have.length', 1);
104
+
105
+ // Then I expect the help message not exist, because user because there are resource displayed
106
+ ImportUserDataSteps.getHelpMessage().should('not.exist');
107
+ });
45
108
  });
@@ -1,3 +1,5 @@
1
+ import {UserAndAccessSteps} from "../../steps/setup/user-and-access-steps";
2
+
1
3
  describe('User and Access', () => {
2
4
 
3
5
  const PASSWORD = "password";
@@ -7,21 +9,21 @@ describe('User and Access', () => {
7
9
  const DEFAULT_ADMIN_PASSWORD = "root";
8
10
 
9
11
  beforeEach(() => {
10
- cy.visit('/users');
12
+ UserAndAccessSteps.visit();
11
13
  cy.window();
12
14
  // Users table should be visible
13
- getUsersTable().should('be.visible');
15
+ UserAndAccessSteps.getUsersTable().should('be.visible');
14
16
  });
15
17
 
16
18
  after(() => {
17
- cy.visit('/users');
18
- getUsersTable().should('be.visible');
19
- cy.get('#wb-users-userInUsers tr').then((table) => {
20
- cy.get('table > tbody > tr').each(($el, index, $list) => {
21
- getUsersTable().should('be.visible');
19
+ UserAndAccessSteps.visit();
20
+ UserAndAccessSteps.getUsersTable().should('be.visible');
21
+ UserAndAccessSteps.getUsersTableRow().then((table) => {
22
+ UserAndAccessSteps.getTableRow().each(($el, index, $list) => {
23
+ UserAndAccessSteps.getUsersTable().should('be.visible');
22
24
  const username = $el.find('.username').text();
23
25
  if (username !=='admin') {
24
- deleteUser(username);
26
+ UserAndAccessSteps.deleteUser(username);
25
27
  }
26
28
  });
27
29
  });
@@ -29,26 +31,22 @@ describe('User and Access', () => {
29
31
 
30
32
  it('Initial state', () => {
31
33
  // Create new user button should be visible
32
- getCreateNewUserButton().should('be.visible');
34
+ UserAndAccessSteps.getCreateNewUserButton().should('be.visible');
33
35
  // Security should be disabled
34
- cy.get('#toggle-security').find('.security-switch-label').should('be.visible')
35
- .and('contain', 'Security is OFF');
36
- cy.get('#toggle-security').find('.switch:checkbox').should('not.be.checked');
36
+ UserAndAccessSteps.getSecuritySwitchLabel().should('be.visible').and('contain', 'Security is OFF');
37
+ UserAndAccessSteps.getSecurityCheckbox().should('not.be.checked');
37
38
  // Only admin user should be created by default
38
- getUsersTable().find('tbody tr').should('have.length', 1);
39
- findUserInTable('admin');
40
- cy.get('@user').find('.user-type').should('be.visible')
41
- .and('contain', 'Administrator');
39
+ UserAndAccessSteps.getTableRow().should('have.length', 1);
40
+ UserAndAccessSteps.findUserInTable('admin');
41
+ UserAndAccessSteps.getUserType().should('be.visible').and('contain', 'Administrator');
42
42
  // The admin should have unrestricted rights
43
- cy.get('@user').find('.repository-rights').should('be.visible')
44
- .and('contain', 'Unrestricted');
43
+ UserAndAccessSteps.getRepositoryRights().should('be.visible').and('contain', 'Unrestricted');
45
44
  // And can be edited
46
- cy.get('@user').find('.edit-user-btn').should('be.visible')
47
- .and('not.be.disabled');
45
+ UserAndAccessSteps.getEditUserButton().should('be.visible').and('not.be.disabled');
48
46
  // And cannot be deleted
49
- cy.get('@user').find('.delete-user-btn').should('not.exist');
47
+ UserAndAccessSteps.getDeleteUserButton().should('not.exist');
50
48
  // Date created should be visible
51
- cy.get('@user').find('.date-created').should('be.visible');
49
+ UserAndAccessSteps.getDateCreated().should('be.visible');
52
50
  });
53
51
 
54
52
  it('Create user', () => {
@@ -72,140 +70,102 @@ describe('User and Access', () => {
72
70
  testForUser(name, true);
73
71
  });
74
72
 
75
- function testForUser(name, isAdmin) {
76
- //enable security
77
- getToggleSecuritySwitch().click();
78
- //login new user
79
- loginWithUser(name, PASSWORD);
80
- //verify permissions
81
- cy.url().should('include', '/users');
82
- if (isAdmin) {
83
- getUsersTable().should('be.visible');
84
- } else {
85
- cy.get('.alert-danger').should('contain',
86
- 'You have no permission to access this functionality with your current credentials.');
87
- }
88
- logout();
89
- //login with the admin
90
- loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
91
- cy.get('.ot-splash').should('not.be.visible');
92
- getUsersTable().should('be.visible');
93
- //delete new-user
94
- deleteUser(name);
95
- //disable security
96
- getToggleSecuritySwitch().click({force: true});
97
- cy.get('#toggle-security').find('.security-switch-label').should('be.visible')
98
- .and('contain', 'Security is OFF');
99
- getUsersTable().should('be.visible');
100
- }
73
+ it('Create user with custom role', () => {
74
+ const name = "user";
75
+ // When I create a read/write user
76
+ UserAndAccessSteps.clickCreateNewUserButton();
77
+ UserAndAccessSteps.typeUsername(name);
78
+ UserAndAccessSteps.typePassword(PASSWORD);
79
+ UserAndAccessSteps.typeConfirmPasswordField(PASSWORD);
80
+ UserAndAccessSteps.selectRoleRadioButton(ROLE_USER);
81
+ // And add a custom role of 1 letter
82
+ UserAndAccessSteps.addTextToCustomRoleField('A');
83
+ UserAndAccessSteps.getRepositoryRightsList().contains('Any data repository').nextUntil('.write').eq(1).within(() => {
84
+ UserAndAccessSteps.clickWriteAccess();
85
+ });
86
+
87
+ // Then the 'create' button should be disabled
88
+ UserAndAccessSteps.getConfirmUserCreateButton().should('be.disabled');
89
+ // And the field should show an error
90
+ UserAndAccessSteps.getFieldError().should('contain.text', 'Must be at least 2 symbols long');
91
+ // When I add more text to the custom role tag
92
+ UserAndAccessSteps.addTextToCustomRoleField('A{enter}');
93
+ // Then the 'create' button should be enabled
94
+ UserAndAccessSteps.getConfirmUserCreateButton().should('be.enabled');
95
+ // And the field error should not exist
96
+ UserAndAccessSteps.getFieldError().should('not.be.visible');
97
+
98
+ // When I type an invalid tag
99
+ UserAndAccessSteps.addTextToCustomRoleField('B{enter}');
100
+ // And the field shows an error
101
+ UserAndAccessSteps.getFieldError().should('contain.text', 'Must be at least 2 symbols long');
102
+ // When I delete the invalid text
103
+ UserAndAccessSteps.addTextToCustomRoleField('{backspace}');
104
+ // Then the error should not be visible
105
+ UserAndAccessSteps.getFieldError().should('not.be.visible');
106
+ });
101
107
 
102
108
  it('Warn users when setting no password when creating new user admin', () => {
103
- getUsersTable().should('be.visible');
109
+ UserAndAccessSteps.getUsersTable().should('be.visible');
104
110
  createUser("adminWithNoPassword", PASSWORD, ROLE_CUSTOM_ADMIN);
105
- getUsersTable().should('be.visible');
106
- cy.get('.ot-splash').should('not.be.visible');
107
- deleteUser("adminWithNoPassword");
111
+ UserAndAccessSteps.getUsersTable().should('be.visible');
112
+ UserAndAccessSteps.getSplashLoader().should('not.be.visible');
113
+ UserAndAccessSteps.deleteUser("adminWithNoPassword");
108
114
  });
109
115
 
110
- function getCreateNewUserButton() {
111
- return cy.get('#wb-users-userCreateLink');
112
- }
113
-
114
- function getToggleSecuritySwitch() {
115
- return cy.get('#toggle-security span.switch');
116
- }
117
-
118
- function getUsersTable() {
119
- return cy.get('#wb-users-userInUsers');
120
- }
121
-
122
- function findUserInTable(username) {
123
- return getUsersTable().find(`tbody .username:contains(${username})`)
124
- .closest('tr').as('user');
125
- }
126
-
127
- function getUsernameField() {
128
- return cy.get('#wb-user-username');
129
- }
130
-
131
- function getPasswordField() {
132
- return cy.get('#wb-user-password');
133
- }
134
-
135
- function getConfirmPasswordField() {
136
- return cy.get('#wb-user-confirmpassword');
137
- }
138
-
139
- function getConfirmUserCreateButton() {
140
- return cy.get('#wb-user-submit');
141
- }
142
-
143
- function getRoleRadioButton(userRole) {
144
- return cy.get(userRole);
145
- }
146
-
147
- function getRepoitoryRightsList() {
148
- return cy.get('#user-repos');
149
- }
150
-
151
116
  function createUser(username, password, role) {
152
- getCreateNewUserButton().click();
153
- getUsernameField().type(username);
154
- getPasswordField().type(password);
155
- getConfirmPasswordField().type(password);
156
- getRoleRadioButton(role).click();
117
+ UserAndAccessSteps.clickCreateNewUserButton();
118
+ UserAndAccessSteps.typeUsername(username);
119
+ UserAndAccessSteps.typePassword(password);
120
+ UserAndAccessSteps.typeConfirmPasswordField(password);
121
+ UserAndAccessSteps.selectRoleRadioButton(role);
157
122
  if (role === "#roleUser") {
158
- getRepoitoryRightsList().contains('Any data repository').nextUntil('.write').eq(1).within(() => {
159
- cy.get('.write').click();
123
+ UserAndAccessSteps.getRepositoryRightsList().contains('Any data repository').nextUntil('.write').eq(1).within(() => {
124
+ UserAndAccessSteps.clickWriteAccess();
160
125
  });
161
- getConfirmUserCreateButton().click();
126
+ UserAndAccessSteps.confirmUserCreate();
162
127
  } else if (role === "#roleAdmin" && username === "adminWithNoPassword") {
163
- cy.get('#noPassword:checkbox').check()
128
+ UserAndAccessSteps.getNoPasswordCheckbox().check()
164
129
  .then(() => {
165
- cy.get('#noPassword:checkbox')
130
+ UserAndAccessSteps.getNoPasswordCheckbox()
166
131
  .should('be.checked');
167
132
  });
168
- getConfirmUserCreateButton().click()
133
+ UserAndAccessSteps.getConfirmUserCreateButton().click()
169
134
  .then(() => {
170
- cy.get('.modal-dialog').find('.lead').contains('If the password is unset and security is enabled, this administrator will not be ' +
135
+ UserAndAccessSteps.getDialogText().contains('If the password is unset and security is enabled, this administrator will not be ' +
171
136
  'able to log into GraphDB through the workbench. Are you sure that you want to continue?');
172
- cy.get('.modal-dialog').find('.confirm-btn').click();
137
+ UserAndAccessSteps.confirmInDialog();
173
138
  });
174
139
  } else {
175
- getConfirmUserCreateButton().click();
140
+ UserAndAccessSteps.confirmUserCreate();
176
141
  }
177
- cy.get('.ot-splash').should('not.be.visible');
178
- getUsersTable().should('contain', username);
179
- }
180
-
181
- function deleteUser(username) {
182
- findUserInTable(username);
183
- cy.get('@user')
184
- .should('have.length', 1)
185
- .within(() => {
186
- cy.get('.delete-user-btn')
187
- .as('deleteBtn');
188
- });
189
- return cy.waitUntil(() =>
190
- cy.get('@deleteBtn')
191
- .then((deleteBtn) => deleteBtn && Cypress.dom.isAttached(deleteBtn) && deleteBtn.trigger('click')))
192
- .then(() => {
193
- cy.get('.confirm-btn').click();
194
- });
142
+ UserAndAccessSteps.getSplashLoader().should('not.be.visible');
143
+ UserAndAccessSteps.getUsersTable().should('contain', username);
195
144
  }
196
145
 
197
- function loginWithUser(username, password) {
198
- cy.get('#wb-login-username').type(username);
199
- cy.get('#wb-login-password').type(password);
200
- cy.get('#wb-login-submitLogin').click();
201
- }
202
-
203
- function logout() {
204
- cy.get('#btnGroupDrop2').click();
205
- cy.get('.dropdown-item')
206
- .contains('Logout')
207
- .closest('a')
208
- // Force the click because Cypress sometimes determines that the item has 0x0 dimensions
209
- .click({force: true});
146
+ function testForUser(name, isAdmin) {
147
+ //enable security
148
+ UserAndAccessSteps.toggleSecurity();
149
+ //login new user
150
+ UserAndAccessSteps.loginWithUser(name, PASSWORD);
151
+ //verify permissions
152
+ UserAndAccessSteps.getUrl().should('include', '/users');
153
+ if (isAdmin) {
154
+ UserAndAccessSteps.getUsersTable().should('be.visible');
155
+ } else {
156
+ UserAndAccessSteps.getError().should('contain',
157
+ 'You have no permission to access this functionality with your current credentials.');
158
+ }
159
+ UserAndAccessSteps.logout();
160
+ //login with the admin
161
+ UserAndAccessSteps.loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
162
+ UserAndAccessSteps.getSplashLoader().should('not.be.visible');
163
+ UserAndAccessSteps.getUsersTable().should('be.visible');
164
+ //delete new-user
165
+ UserAndAccessSteps.deleteUser(name);
166
+ //disable security
167
+ UserAndAccessSteps.toggleSecurity();//.click({force: true});
168
+ UserAndAccessSteps.getSecuritySwitchLabel().should('be.visible').and('contain', 'Security is OFF');
169
+ UserAndAccessSteps.getUsersTable().should('be.visible');
210
170
  }
211
171
  });
@@ -11,7 +11,7 @@ describe('Import server files - Batch operations', () => {
11
11
  repositoryId = 'server-import-' + Date.now();
12
12
  cy.createRepository({id: repositoryId});
13
13
  ImportServerFilesSteps.visitServerImport(repositoryId);
14
- ImportServerFilesSteps.getResources().should('have.length', 14);
14
+ ImportServerFilesSteps.getResources().should('have.length', 17);
15
15
  });
16
16
 
17
17
  afterEach(() => {
@@ -22,13 +22,13 @@ describe('Import server files - Batch operations', () => {
22
22
  // When I select All files from the menu
23
23
  ImportServerFilesSteps.selectAllResources();
24
24
  // Then I should see all files selected
25
- ImportServerFilesSteps.getSelectedResources().should('have.length', 14);
25
+ ImportServerFilesSteps.getSelectedResources().should('have.length', 17);
26
26
  // When I select None from the menu
27
27
  ImportServerFilesSteps.deselectAllResources();
28
28
  // Then I should see no files selected
29
29
  ImportServerFilesSteps.getSelectedResources().should('have.length', 0);
30
30
  // precondition for the next step
31
- ImportServerFilesSteps.importFileByName(FILE_FOR_IMPORT);
31
+ ImportServerFilesSteps.importResourceByName(FILE_FOR_IMPORT);
32
32
  ImportSettingsDialogSteps.import();
33
33
  ImportServerFilesSteps.checkImportedResource(0, FILE_FOR_IMPORT);
34
34
  // When I select Imported from the menu
@@ -28,7 +28,7 @@ describe('Import server files - Operations', {retries: {runMode: 2}}, () => {
28
28
  it('Should import Server files successfully without changing settings', () => {
29
29
  // Given I have opened the server files tab
30
30
  // When I select to import a file
31
- ImportServerFilesSteps.importFileByName(FILE_FOR_IMPORT);
31
+ ImportServerFilesSteps.importResourceByName(FILE_FOR_IMPORT);
32
32
  ImportSettingsDialogSteps.import();
33
33
  // Then I should see the file imported successfully
34
34
  ImportServerFilesSteps.checkImportedResource(0, FILE_FOR_IMPORT);
@@ -39,7 +39,7 @@ describe('Import server files - Operations', {retries: {runMode: 2}}, () => {
39
39
  it('Should import files from directory successfully without changing settings', () => {
40
40
  // Given I have opened the server files tab
41
41
  // When I select to import a file
42
- ImportServerFilesSteps.importFileByName(FILE_FROM_DIRECTORY_FOR_IMPORT);
42
+ ImportServerFilesSteps.importResourceByName(FILE_FROM_DIRECTORY_FOR_IMPORT);
43
43
  ImportSettingsDialogSteps.import();
44
44
  // Then I should see the file imported successfully
45
45
  ImportServerFilesSteps.checkImportedResource(0, FILE_FROM_DIRECTORY_FOR_IMPORT);
@@ -48,7 +48,7 @@ describe('Import server files - Operations', {retries: {runMode: 2}}, () => {
48
48
  it('Should import Server files successfully with changing settings', () => {
49
49
  // Given I have opened the server files tab
50
50
  // When I select to import a file
51
- ImportServerFilesSteps.importFileByName(FILE_FOR_IMPORT);
51
+ ImportServerFilesSteps.importResourceByName(FILE_FOR_IMPORT);
52
52
  // And I change the settings
53
53
  ImportSettingsDialogSteps.expandAdvancedSettings();
54
54
  ImportSettingsDialogSteps.fillBaseURI(BASE_URI);
@@ -65,7 +65,7 @@ describe('Import server files - Operations', {retries: {runMode: 2}}, () => {
65
65
  it('Should import Server files successfully with JSONLD context link settings', () => {
66
66
  // Given I have opened the server files tab
67
67
  // When I select to import a file
68
- ImportServerFilesSteps.importFileByName(JSONLD_FILE_FOR_IMPORT);
68
+ ImportServerFilesSteps.importResourceByName(JSONLD_FILE_FOR_IMPORT);
69
69
  // And I change the settings
70
70
  ImportSettingsDialogSteps.expandAdvancedSettings();
71
71
  ImportSettingsDialogSteps.fillBaseURI(BASE_URI);
@@ -82,7 +82,7 @@ describe('Import server files - Operations', {retries: {runMode: 2}}, () => {
82
82
  it('Should import Server files successfully with JSONLD default settings', () => {
83
83
  // Given I have opened the server files tab
84
84
  // When I select to import a file
85
- ImportServerFilesSteps.importFileByName(JSONLD_FILE_FOR_IMPORT);
85
+ ImportServerFilesSteps.importResourceByName(JSONLD_FILE_FOR_IMPORT);
86
86
  // And I change the settings
87
87
  ImportSettingsDialogSteps.expandAdvancedSettings();
88
88
  ImportSettingsDialogSteps.fillBaseURI(BASE_URI);
@@ -99,11 +99,11 @@ describe('Import server files - Operations', {retries: {runMode: 2}}, () => {
99
99
  it('Should be able to reset status of imported file', () => {
100
100
  // Given I have opened the server files tab
101
101
  // And I have imported a file
102
- ImportServerFilesSteps.importFileByName(FILE_FOR_IMPORT);
102
+ ImportServerFilesSteps.importResourceByName(FILE_FOR_IMPORT);
103
103
  ImportSettingsDialogSteps.import();
104
104
  ImportServerFilesSteps.checkImportedResource(0, FILE_FOR_IMPORT);
105
105
  // When I reset the status of the imported file
106
- ImportServerFilesSteps.resetFileStatusByName(FILE_FOR_IMPORT);
106
+ ImportServerFilesSteps.resetResourceStatusByName(FILE_FOR_IMPORT);
107
107
  // Then Import status of the file should not be visible
108
108
  ImportServerFilesSteps.getResourceStatus(FILE_FOR_IMPORT).should('be.hidden');
109
109
  });
@@ -111,18 +111,18 @@ describe('Import server files - Operations', {retries: {runMode: 2}}, () => {
111
111
  it('Should be able to reset status of imported file from a directory', () => {
112
112
  // Given I have opened the server files tab
113
113
  // And I have imported a file
114
- ImportServerFilesSteps.importFileByName(FILE_FROM_DIRECTORY_FOR_IMPORT);
114
+ ImportServerFilesSteps.importResourceByName(FILE_FROM_DIRECTORY_FOR_IMPORT);
115
115
  ImportSettingsDialogSteps.import();
116
116
  ImportServerFilesSteps.checkImportedResource(0, FILE_FROM_DIRECTORY_FOR_IMPORT);
117
117
  // When I reset the status of the imported file
118
- ImportServerFilesSteps.resetFileStatusByName(FILE_FROM_DIRECTORY_FOR_IMPORT);
118
+ ImportServerFilesSteps.resetResourceStatusByName(FILE_FROM_DIRECTORY_FOR_IMPORT);
119
119
  // Then Import status of the file should not be visible
120
120
  ImportServerFilesSteps.getResourceStatus(FILE_FROM_DIRECTORY_FOR_IMPORT).should('be.hidden');
121
121
  });
122
122
 
123
123
  it('Should import turtlestar from Server files successfully without changing settings', () => {
124
124
  // Given I have opened the server files tab
125
- ImportServerFilesSteps.importFileByName(TTLS_FOR_IMPORT);
125
+ ImportServerFilesSteps.importResourceByName(TTLS_FOR_IMPORT);
126
126
  // When I select to import a ttl file without changing settings
127
127
  ImportSettingsDialogSteps.import();
128
128
  // Then I should see the file imported successfully
@@ -132,7 +132,7 @@ describe('Import server files - Operations', {retries: {runMode: 2}}, () => {
132
132
 
133
133
  it('Should import trigstar from Server files successfully without changing settings', () => {
134
134
  // Given I have opened the server files tab
135
- ImportServerFilesSteps.importFileByName(TRIGS_FOR_IMPORT);
135
+ ImportServerFilesSteps.importResourceByName(TRIGS_FOR_IMPORT);
136
136
  // When I select to import a trigstar file without changing settings
137
137
  ImportSettingsDialogSteps.import();
138
138
  // Then I should see the file imported successfully
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.7.0-TR15",
3
+ "version": "2.7.0-TR17",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "2.7.0-TR15",
9
+ "version": "2.7.0-TR17",
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.7.0-TR15",
3
+ "version": "2.7.0-TR17",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
@@ -143,7 +143,7 @@ class ImportSteps {
143
143
  return cy.window().its('navigator.clipboard').invoke('readText').then((text) => text);
144
144
  }
145
145
 
146
- static openHelpMessage() {
146
+ static toggleHelpMessage() {
147
147
  // For some reason the page info box opens unexpectedly and covers the help info icon.
148
148
  this.getView().find('.toggle-help-btn').click({force: true});
149
149
  }
@@ -194,11 +194,16 @@ class ImportSteps {
194
194
  }
195
195
 
196
196
  static checkImportedResource(index, resourceName, expectedStatus) {
197
+ if (expectedStatus === undefined) {}
197
198
  const status = expectedStatus || 'Imported successfully';
198
199
  this.getResourceByName(resourceName).should('contain', resourceName);
199
200
  this.getResourceStatus(resourceName).should('contain', status);
200
201
  }
201
202
 
203
+ static checkImportedStatusIsEmpty(resourceName) {
204
+ this.getResourceStatus(resourceName).find('.import-resource-message').children().should('have.length', 0);
205
+ }
206
+
202
207
  static checkUserDataUploadedResource(index, resourceName) {
203
208
  // this.getResource(index).should('contain', resourceName);
204
209
  this.getResourceByName(resourceName).should('contain', resourceName);
@@ -266,7 +271,7 @@ class ImportSteps {
266
271
  this.getResource(index).find('.import-resource-action-import-btn').click();
267
272
  }
268
273
 
269
- static importFileByName(name) {
274
+ static importResourceByName(name) {
270
275
  this.getResourceByName(name).find('.import-resource-action-import-btn').click();
271
276
  }
272
277
 
@@ -274,7 +279,7 @@ class ImportSteps {
274
279
  this.getResource(index).find('.import-resource-action-reset-btn').click();
275
280
  }
276
281
 
277
- static resetFileStatusByName(name) {
282
+ static resetResourceStatusByName(name) {
278
283
  this.getResourceByName(name).find('.import-resource-action-reset-btn').click();
279
284
  }
280
285
 
@@ -0,0 +1,189 @@
1
+ export class UserAndAccessSteps {
2
+ static visit() {
3
+ cy.visit('/users');
4
+ }
5
+
6
+ static getUrl() {
7
+ return cy.url();
8
+ }
9
+
10
+ static getSplashLoader() {
11
+ return cy.get('.ot-splash');
12
+ }
13
+
14
+ static getCreateNewUserButton() {
15
+ return cy.get('#wb-users-userCreateLink');
16
+ }
17
+
18
+ static clickCreateNewUserButton() {
19
+ this.getCreateNewUserButton().click();
20
+ }
21
+
22
+ static getToggleSecuritySwitch() {
23
+ return cy.get('#toggle-security span.switch');
24
+ }
25
+
26
+ static toggleSecurity() {
27
+ this.getToggleSecuritySwitch().click();
28
+ }
29
+
30
+ static getSecuritySwitchLabel() {
31
+ return cy.get('#toggle-security').find('.security-switch-label');
32
+ }
33
+
34
+ static getSecurityCheckbox() {
35
+ return cy.get('#toggle-security').find('.switch:checkbox');
36
+ }
37
+
38
+ static getUser() {
39
+ return cy.get('@user');
40
+ }
41
+
42
+ static getUserType() {
43
+ return this.getUser().find('.user-type');
44
+ }
45
+
46
+ static getRepositoryRights() {
47
+ return this.getUser().find('.repository-rights');
48
+ }
49
+
50
+ static getEditUserButton() {
51
+ return this.getUser().find('.edit-user-btn');
52
+ }
53
+
54
+ static getDeleteUserButton() {
55
+ return this.getUser().find('.delete-user-btn');
56
+ }
57
+
58
+ static getDateCreated() {
59
+ return this.getUser().find('.date-created');
60
+ }
61
+
62
+ static getUsersTable() {
63
+ return cy.get('#wb-users-userInUsers');
64
+ }
65
+
66
+ static getTableRow() {
67
+ return this.getUsersTable().find('tbody tr');
68
+ }
69
+
70
+ static getUsersTableRow() {
71
+ return cy.get('#wb-users-userInUsers tr');
72
+ }
73
+
74
+ static findUserInTable(username) {
75
+ return this.getUsersTable().find(`tbody .username:contains(${username})`)
76
+ .closest('tr').as('user');
77
+ }
78
+
79
+ static getUsernameField() {
80
+ return cy.get('#wb-user-username');
81
+ }
82
+
83
+ static typeUsername(text) {
84
+ this.getUsernameField().type(text);
85
+ }
86
+
87
+ static getPasswordField() {
88
+ return cy.get('#wb-user-password');
89
+ }
90
+
91
+ static typePassword(text) {
92
+ this.getPasswordField().type(text);
93
+ }
94
+
95
+ static getConfirmPasswordField() {
96
+ return cy.get('#wb-user-confirmpassword');
97
+ }
98
+
99
+ static typeConfirmPasswordField(text) {
100
+ this.getConfirmPasswordField().type(text);
101
+ }
102
+
103
+ static getNoPasswordCheckbox() {
104
+ return cy.get('#noPassword:checkbox');
105
+ }
106
+
107
+ static getCustomRoleField() {
108
+ return cy.get('tags-input');
109
+ }
110
+
111
+ static addTextToCustomRoleField(text) {
112
+ this.getCustomRoleField().type(text);
113
+ }
114
+
115
+ static getConfirmUserCreateButton() {
116
+ return cy.get('#wb-user-submit');
117
+ }
118
+
119
+ static confirmUserCreate() {
120
+ cy.get('#wb-user-submit').click();
121
+ }
122
+
123
+ static getRoleRadioButton(userRole) {
124
+ return cy.get(userRole);
125
+ }
126
+
127
+ static selectRoleRadioButton(role) {
128
+ this.getRoleRadioButton(role).click();
129
+ }
130
+
131
+ static getRepositoryRightsList() {
132
+ return cy.get('#user-repos');
133
+ }
134
+
135
+ static clickWriteAccess() {
136
+ cy.get('.write').click();
137
+ }
138
+
139
+ static getFieldError() {
140
+ return cy.get('div.small');
141
+ }
142
+
143
+ static getError() {
144
+ return cy.get('.alert-danger');
145
+ }
146
+
147
+ static getModal() {
148
+ return cy.get('.modal-dialog');
149
+ }
150
+
151
+ static getDialogText() {
152
+ return this.getModal().find('.lead');
153
+ }
154
+
155
+ static confirmInDialog() {
156
+ this.getModal().find('.confirm-btn').click();
157
+ }
158
+
159
+ static deleteUser(username) {
160
+ this.findUserInTable(username);
161
+ cy.get('@user')
162
+ .should('have.length', 1)
163
+ .within(() => {
164
+ cy.get('.delete-user-btn')
165
+ .as('deleteBtn');
166
+ });
167
+ return cy.waitUntil(() =>
168
+ cy.get('@deleteBtn')
169
+ .then((deleteBtn) => deleteBtn && Cypress.dom.isAttached(deleteBtn) && deleteBtn.trigger('click')))
170
+ .then(() => {
171
+ cy.get('.confirm-btn').click();
172
+ });
173
+ }
174
+
175
+ static loginWithUser(username, password) {
176
+ cy.get('#wb-login-username').type(username);
177
+ cy.get('#wb-login-password').type(password);
178
+ cy.get('#wb-login-submitLogin').click();
179
+ }
180
+
181
+ static logout() {
182
+ cy.get('#btnGroupDrop2').click();
183
+ cy.get('.dropdown-item')
184
+ .contains('Logout')
185
+ .closest('a')
186
+ // Force the click because Cypress sometimes determines that the item has 0x0 dimensions
187
+ .click({force: true});
188
+ }
189
+ }