graphdb-workbench-tests 2.0.0-TR10 → 2.0.0-TR13

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,69 @@
1
+ describe('Plugins', () => {
2
+
3
+ let repositoryId;
4
+
5
+ function createRepository() {
6
+ repositoryId = 'plugin-' + Date.now();
7
+ cy.createRepository({id: repositoryId});
8
+ cy.presetRepository(repositoryId);
9
+ cy.initializeRepository(repositoryId);
10
+ }
11
+
12
+ function waitUntilPluginsPageIsLoaded() {
13
+ // Workbench loading screen should not be visible
14
+ cy.get('.ot-splash').should('not.be.visible');
15
+
16
+ // No active loader
17
+ cy.get('.ot-loader').should('not.exist');
18
+ }
19
+
20
+ beforeEach(() => {
21
+ createRepository();
22
+ cy.visit('/plugins');
23
+ cy.window();
24
+ waitUntilPluginsPageIsLoaded();
25
+ });
26
+
27
+ afterEach(() => {
28
+ cy.visit('/plugins');
29
+ cy.window();
30
+ // re-enable historyplugin
31
+ getPluginsHeader()
32
+ .should('be.visible').parent().within(() => {
33
+ cy.get('.switch').then((elem) => {
34
+ var value = elem.val();
35
+ if (!value.checked) {
36
+ getPluginsSwitch().click();
37
+ }
38
+ });
39
+ });
40
+ cy.deleteRepository(repositoryId);
41
+ });
42
+
43
+ it('should allow to enable and disable the plugins', () => {
44
+ // Verify initial status is ON
45
+ getPluginsHeader()
46
+ .should('be.visible').parent().within(() => {
47
+ cy.get('.tag-primary')
48
+ .contains('ON');
49
+
50
+ cy.get('.switch').should('be.checked');
51
+ getPluginsSwitch().click();
52
+ });
53
+ cy.visit('/plugins');
54
+ cy.window();
55
+
56
+ getPluginsHeader()
57
+ .should('be.visible').parent().within(() => {
58
+ cy.get('.switch').should('not.be.checked');
59
+ });
60
+ });
61
+
62
+ function getPluginsHeader() {
63
+ return cy.get('.plugins-header').contains("history");
64
+ }
65
+
66
+ function getPluginsSwitch() {
67
+ return cy.get('.plugins-switch');
68
+ }
69
+ });
@@ -55,7 +55,7 @@ describe('User and Access', () => {
55
55
  cy.get('@user').find('.edit-user-btn').should('be.visible')
56
56
  .and('not.be.disabled');
57
57
  // And cannot be deleted
58
- cy.get('@user').find('.delete-user-btn').should('not.be.visible');
58
+ cy.get('@user').find('.delete-user-btn').should('not.exist');
59
59
  // Date created should be visible
60
60
  cy.get('@user').find('.date-created').should('be.visible');
61
61
  });
@@ -91,22 +91,26 @@ describe('User and Access', () => {
91
91
  cy.get('.ot-splash').should('not.be.visible');
92
92
  getUsersTable().should('be.visible');
93
93
  //delete repository manager
94
- deleteUser("repo-manager");
95
- //create a custom admin
96
- createUser("second-admin", PASSWORD, ROLE_CUSTOM_ADMIN);
97
- logout();
98
- //login with custom admin
99
- loginWithUser("second-admin", PASSWORD);
100
- cy.url().should('include', '/users');
101
- logout();
102
- //login with admin
103
- loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
104
- cy.get('.ot-splash').should('not.be.visible');
105
- getUsersTable().should('be.visible');
106
- //delete custom admin
107
- deleteUser("second-admin");
108
- //disable security
109
- getToggleSecuritySwitch().click();
94
+ deleteUser("repo-manager")
95
+ .then(() => {
96
+ //create a custom admin
97
+ createUser("second-admin", PASSWORD, ROLE_CUSTOM_ADMIN);
98
+ logout();
99
+ //login with custom admin
100
+ loginWithUser("second-admin", PASSWORD);
101
+ cy.url().should('include', '/users');
102
+ logout();
103
+ //login with admin
104
+ loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
105
+ cy.get('.ot-splash').should('not.be.visible');
106
+ getUsersTable().should('be.visible');
107
+ //delete custom admin
108
+ deleteUser("second-admin")
109
+ .then(() => {
110
+ //disable security
111
+ getToggleSecuritySwitch().click();
112
+ });
113
+ });
110
114
  });
111
115
  it('Warn users when setting no password when creating new user admin', () => {
112
116
  getUsersTable().should('be.visible');
@@ -188,10 +192,19 @@ describe('User and Access', () => {
188
192
  }
189
193
 
190
194
  function deleteUser(username) {
191
- cy.get('#wb-users-userInUsers tr').contains(username).parent().parent().within(() => {
192
- cy.get('.icon-trash').click();
193
- });
194
- cy.get('.confirm-btn').click();
195
+ findUserInTable(username);
196
+ cy.get('@user')
197
+ .should('have.length', 1)
198
+ .within(() => {
199
+ cy.get('.delete-user-btn')
200
+ .as('deleteBtn');
201
+ });
202
+ return cy.waitUntil(() =>
203
+ cy.get('@deleteBtn')
204
+ .then(deleteBtn => deleteBtn && Cypress.dom.isAttached(deleteBtn) && deleteBtn.trigger('click')))
205
+ .then(() => {
206
+ cy.get('.confirm-btn').click();
207
+ });
195
208
  }
196
209
 
197
210
  function loginWithUser(username, password) {
@@ -16,18 +16,7 @@ describe('Main menu tests', function () {
16
16
  {
17
17
  name: 'Import',
18
18
  visible: true,
19
- submenu: [
20
- {
21
- name: 'RDF',
22
- visible: false,
23
- redirect: '/import'
24
- },
25
- {
26
- name: 'Tabular (OntoRefine)',
27
- visible: false,
28
- redirect: '/ontorefine'
29
- }
30
- ]
19
+ redirect: '/import'
31
20
  },
32
21
  {
33
22
  name: 'Explore',
@@ -110,6 +99,11 @@ describe('Main menu tests', function () {
110
99
  visible: false,
111
100
  redirect: '/cluster'
112
101
  },
102
+ {
103
+ name: 'Plugins',
104
+ visible: false,
105
+ redirect: '/plugins'
106
+ },
113
107
  {
114
108
  name: 'Namespaces',
115
109
  visible: false,
@@ -164,7 +158,8 @@ describe('Main menu tests', function () {
164
158
  let menuVisibilityCheck = menu.visible ? 'be.visible' : 'not.be.visible';
165
159
  // Verify that main menu items are present and their visibility
166
160
  cy.get('.main-menu .menu-element-root').eq(menuIndex + 1).as('menu')
167
- .should(menuVisibilityCheck).and('contain', menu.name);
161
+ .should(menuVisibilityCheck).within(() =>
162
+ cy.get('.menu-item').contains(menu.name));
168
163
 
169
164
  // Verify submenu items and their visibility when the main menu is not opened
170
165
  (menu.submenu || []).forEach((submenu, submenuIndex) => {
@@ -435,11 +435,20 @@ describe('SPARQL screen validation', () => {
435
435
  verifyResultsPageLength(74);
436
436
 
437
437
  // Uncheck ‘Include inferred’
438
- cy.waitUntil(() =>
439
- getInferenceButton()
440
- .then(infBtn => infBtn && cy.wrap(infBtn).click()))
441
- .then(() =>
442
- cy.get('.icon-inferred-off').should('be.visible'));
438
+ cy.waitUntil(() =>
439
+ getInferenceButton()
440
+ .within(infBtn =>
441
+ { cy.get('.icon-inferred-on');
442
+ console.log(infBtn);
443
+ infBtn && cy.wrap(infBtn).click();
444
+ }
445
+ ).then(() => {
446
+ getInferenceButton()
447
+ .within(button => {
448
+ cy.get('.icon-inferred-off')
449
+ cy.wrap(button).should('be.visible')
450
+ });
451
+ }))
443
452
 
444
453
  // Confirm that only inferred statements (only 2) are available
445
454
  executeQuery();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.0.0-TR10",
3
+ "version": "2.0.0-TR13",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "start": "cypress open",
@@ -1,7 +1,7 @@
1
1
  Cypress.Commands.add('pasteQuery', (query) => {
2
2
  clearQuery();
3
3
  // Using force because the textarea is not visible
4
- getQueryTextArea().invoke('val', query).trigger('change', {force: true});
4
+ getQueryTextArea().invoke('val', query).trigger('change', {force: true}).should('have.value', query);
5
5
  waitUntilQueryIsVisible();
6
6
  });
7
7
 
@@ -53,7 +53,7 @@ function getQueryTextArea() {
53
53
  }
54
54
 
55
55
  function waitUntilQueryIsVisible() {
56
- cy.waitUntil(() =>
56
+ return cy.waitUntil(() =>
57
57
  getQueryArea()
58
58
  .then(codeMirrorEl =>
59
59
  codeMirrorEl && codeMirrorEl[0].CodeMirror.getValue().trim().length > 0));
@@ -1,135 +0,0 @@
1
- describe('Import/ OntoRefine', () => {
2
-
3
- let repositoryId;
4
-
5
- beforeEach(() => {
6
- repositoryId = 'onto-refine-' + Date.now();
7
- cy.createRepository({id: repositoryId});
8
-
9
- cy.visit('/ontorefine');
10
- cy.window();
11
-
12
- cy.get('.ot-splash').should('not.exist');
13
- getOntoRefineFrame().should('be.visible');
14
- });
15
-
16
- afterEach(() => {
17
- cy.deleteRepository(repositoryId);
18
- });
19
-
20
- const REFINE_TABS = ['Create Project', 'Open Project', 'Import Project', 'Language Settings'];
21
- const CREATE_PROJECT_TABS = ['This Computer', 'Web Addresses (URLs)', 'Clipboard'];
22
-
23
- xit('should properly render OntoRefine transformation tool frame', () => {
24
-
25
- // Refine should provide navigation tabs
26
- getOntoRefineTabs()
27
- .should('be.visible')
28
- .and('have.length', 4)
29
- .each(($tab, $index) => expect($tab.text()).to.equal(REFINE_TABS[$index]))
30
- .eq(0)
31
- // The first tab should be automatically selected
32
- .should('have.class', 'selected')
33
- .and('be.visible');
34
-
35
- // -------- Create project --------
36
-
37
- // The create project panel should be rendered by default and provide its own tabs
38
- getCreateProjectPanel().should('be.visible');
39
- getCreateProjectPanelTabs()
40
- .should('be.visible')
41
- .and('have.length', 3)
42
- .each(($tab, $index) => expect($tab.text()).to.equal(CREATE_PROJECT_TABS[$index]))
43
- .eq(0)
44
- .should('have.class', 'selected')
45
- .and('be.visible');
46
-
47
- // The upload panel should be opened by default
48
- getCreateProjectPanelBody()
49
- .find('.upload-parent #upload')
50
- .should('be.visible');
51
-
52
- // Go to URL panel
53
- getCreateProjectPanelTabs().eq(1).click();
54
- getCreateProjectPanelBody()
55
- .find('.default-importing-web-url')
56
- .should('be.visible');
57
-
58
- // Go to Clipboard panel
59
- getCreateProjectPanelTabs().eq(2).click();
60
- getCreateProjectPanelBody()
61
- .find('#default-importing-clipboard-textarea')
62
- .should('be.visible');
63
-
64
- // -------- Open project --------
65
-
66
- // Go to Open project and check if the panels are properly switched
67
- getOntoRefineTabs().eq(1).click();
68
- getCreateProjectPanel().should('not.exist');
69
- getOpenProjectPanel()
70
- .should('be.visible')
71
- // Should have no existing projects for new repositories
72
- .find('#no-project-message')
73
- .should('be.visible');
74
-
75
- // -------- Import project --------
76
-
77
- getOntoRefineTabs().eq(2).click();
78
- getOpenProjectPanel().should('not.exist');
79
- getImportProjectPanel()
80
- .should('be.visible')
81
- .find('#import-project-button')
82
- .should('be.visible');
83
-
84
- // -------- Language Settings --------
85
-
86
- getOntoRefineTabs().eq(3).click();
87
- getImportProjectPanel().should('not.exist');
88
- getLanguageSettingsPanel()
89
- .should('be.visible')
90
- .find('#set-lang-button')
91
- .should('be.visible');
92
- });
93
-
94
- function getOntoRefineFrame() {
95
- return cy.get('#ontorefine-iframe').iframe();
96
- }
97
-
98
- function getOntoRefineLeftPanel() {
99
- return getOntoRefineFrame().find('#left-panel');
100
- }
101
-
102
- function getOntoRefineTabs() {
103
- return getOntoRefineLeftPanel().find('#action-area-tabs .action-area-tab');
104
- }
105
-
106
- function getOntoRefineRightPanel() {
107
- return getOntoRefineFrame().find('#right-panel');
108
- }
109
-
110
- function getCreateProjectPanel() {
111
- return getOntoRefineRightPanel().find('#create-project-ui-source-selection-layout');
112
- }
113
-
114
- function getCreateProjectPanelTabs() {
115
- return getCreateProjectPanel().find('#create-project-ui-source-selection-tabs .create-project-ui-source-selection-tab')
116
- }
117
-
118
- function getCreateProjectPanelBody() {
119
- return getCreateProjectPanel().find('#create-project-ui-source-selection-tab-bodies')
120
- }
121
-
122
- function getOpenProjectPanel() {
123
- return getOntoRefineRightPanel().find('#projects-container');
124
- }
125
-
126
- function getImportProjectPanel() {
127
- // TODO Note: The third and fourth tab bodies have the same identifier....
128
- return getOntoRefineRightPanel().find('.action-area-tab-body').eq(2);
129
- }
130
-
131
- function getLanguageSettingsPanel() {
132
- return getOntoRefineRightPanel().find('.action-area-tab-body').eq(3);
133
- }
134
-
135
- });