graphdb-workbench-tests 3.5.0-TR8 → 3.5.0-TR9
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.
- package/e2e-legacy/home/solr-banner/solr-banner.spec.js +137 -0
- package/e2e-legacy/ttyg/chat-list.spec.js +1 -1
- package/e2e-legacy/ttyg/create-chat.spec.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/steps/deprecation-steps.js +13 -0
- package/steps/ttyg/ttyg-view-steps.js +13 -2
- package/support/security-command.js +43 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import HomeSteps from '../../../steps/home-steps.js';
|
|
2
|
+
import {DeprecationSteps} from '../../../steps/deprecation-steps.js';
|
|
3
|
+
import {LoginSteps} from '../../../steps/login-steps.js';
|
|
4
|
+
import {GuidesStubs} from '../../../stubs/guides/guides-stubs.js';
|
|
5
|
+
import {GuideSteps} from '../../../steps/guides/guide-steps.js';
|
|
6
|
+
import {GuideDialogSteps} from '../../../steps/guides/guide-dialog-steps.js';
|
|
7
|
+
|
|
8
|
+
describe('Solr deprecation banner', () => {
|
|
9
|
+
context('Security disabled', () => {
|
|
10
|
+
it('should keep the Solr deprecation banner hidden after the anonymous user dismisses it', () => {
|
|
11
|
+
// GIVEN: I have opened the application with security disabled.
|
|
12
|
+
HomeSteps.visit();
|
|
13
|
+
|
|
14
|
+
// THEN: I expect the Solr deprecation banner to be visible.
|
|
15
|
+
DeprecationSteps.getDeprecationBanner()
|
|
16
|
+
.should('be.visible')
|
|
17
|
+
.should('contain.text', 'The Solr connector is deprecated and will be removed in GraphDB 12');
|
|
18
|
+
|
|
19
|
+
// WHEN: I dismiss the Solr deprecation banner.
|
|
20
|
+
DeprecationSteps.closeBanner();
|
|
21
|
+
// THEN: I expect the Solr deprecation banner to be hidden.
|
|
22
|
+
DeprecationSteps.getDeprecationBanner().should('not.exist');
|
|
23
|
+
|
|
24
|
+
// WHEN: I reload the application.
|
|
25
|
+
HomeSteps.visit();
|
|
26
|
+
// THEN: I expect the Solr deprecation banner to remain hidden.
|
|
27
|
+
DeprecationSteps.getDeprecationBanner().should('not.exist');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
context('Security enabled', () => {
|
|
32
|
+
const PASSWORD = 'root';
|
|
33
|
+
const USER_USERNAME = 'username';
|
|
34
|
+
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
cy.createUser({
|
|
37
|
+
username: USER_USERNAME,
|
|
38
|
+
password: PASSWORD
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
cy.switchOnSecurity()
|
|
42
|
+
.then(() => cy.loginAsAdmin())
|
|
43
|
+
.then(() => cy.switchOnFreeAccess(true));
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
afterEach(() => {
|
|
47
|
+
cy.loginAsAdmin()
|
|
48
|
+
.then(() => {
|
|
49
|
+
cy.deleteUser(USER_USERNAME, true);
|
|
50
|
+
cy.switchOffFreeAccess(true);
|
|
51
|
+
cy.switchOffSecurity(true);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should persist separate Solr banner states for anonymous and logged-in users', () => {
|
|
56
|
+
// GIVEN: Security and free access are enabled, and no user is logged in.
|
|
57
|
+
HomeSteps.visit();
|
|
58
|
+
|
|
59
|
+
// THEN: I expect the Solr deprecation banner to be visible for the anonymous user.
|
|
60
|
+
DeprecationSteps.getDeprecationBanner()
|
|
61
|
+
.should('be.visible')
|
|
62
|
+
.should('contain.text', 'The Solr connector is deprecated and will be removed in GraphDB 12');
|
|
63
|
+
|
|
64
|
+
// WHEN: The anonymous user dismisses the banner.
|
|
65
|
+
DeprecationSteps.closeBanner();
|
|
66
|
+
// THEN: I expect the banner to be hidden for the anonymous user.
|
|
67
|
+
DeprecationSteps.getDeprecationBanner().should('not.exist');
|
|
68
|
+
|
|
69
|
+
// WHEN: I log in as a user who has not dismissed the banner.
|
|
70
|
+
cy.loginAs(USER_USERNAME, PASSWORD);
|
|
71
|
+
HomeSteps.visit();
|
|
72
|
+
|
|
73
|
+
// THEN: I expect the banner to be visible for the logged-in user.
|
|
74
|
+
DeprecationSteps.getDeprecationBanner()
|
|
75
|
+
.should('be.visible')
|
|
76
|
+
.should('contain.text', 'The Solr connector is deprecated and will be removed in GraphDB 12');
|
|
77
|
+
|
|
78
|
+
// WHEN: The logged-in user dismisses the banner.
|
|
79
|
+
DeprecationSteps.closeBanner();
|
|
80
|
+
// THEN: I expect the banner to be hidden for the logged-in user.
|
|
81
|
+
DeprecationSteps.getDeprecationBanner().should('not.exist');
|
|
82
|
+
|
|
83
|
+
// WHEN: The user logs out.
|
|
84
|
+
LoginSteps.logout();
|
|
85
|
+
// THEN: I expect the banner to remain hidden because the anonymous user has already dismissed it.
|
|
86
|
+
DeprecationSteps.getDeprecationBanner().should('not.exist');
|
|
87
|
+
|
|
88
|
+
// WHEN: I log in as the administrator, who has not dismissed the banner.
|
|
89
|
+
cy.loginAs('admin', 'root');
|
|
90
|
+
HomeSteps.visit();
|
|
91
|
+
// THEN: I expect the banner to be visible for the administrator.
|
|
92
|
+
DeprecationSteps.getDeprecationBanner()
|
|
93
|
+
.should('be.visible')
|
|
94
|
+
.should('contain.text', 'The Solr connector is deprecated and will be removed in GraphDB 12');
|
|
95
|
+
|
|
96
|
+
// WHEN: The administrator logs out.
|
|
97
|
+
LoginSteps.logout();
|
|
98
|
+
// THEN: I expect the banner to remain hidden because the anonymous user has already dismissed it.
|
|
99
|
+
DeprecationSteps.getDeprecationBanner().should('not.exist');
|
|
100
|
+
|
|
101
|
+
// WHEN: I log in again as the user who previously dismissed the banner.
|
|
102
|
+
cy.loginAs(USER_USERNAME, PASSWORD);
|
|
103
|
+
HomeSteps.visit();
|
|
104
|
+
// THEN: I expect the banner to remain hidden for the logged-in user.
|
|
105
|
+
DeprecationSteps.getDeprecationBanner().should('not.exist');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
context('User guides', () => {
|
|
110
|
+
it('should hide the Solr deprecation banner while a guide is running', () => {
|
|
111
|
+
// GIVEN: The guides are loaded and ready to be started.
|
|
112
|
+
GuidesStubs.stubMainMenuGuide();
|
|
113
|
+
GuideSteps.visit();
|
|
114
|
+
GuideSteps.verifyGuidesListExists();
|
|
115
|
+
cy.wait('@getGuides');
|
|
116
|
+
|
|
117
|
+
// WHEN: I am on an application page, and the Solr deprecation banner has not been dismissed by the current user.
|
|
118
|
+
// THEN: I expect the Solr deprecation banner to be visible because it has not been dismissed by the current user.
|
|
119
|
+
DeprecationSteps.getDeprecationBanner()
|
|
120
|
+
.should('be.visible')
|
|
121
|
+
.should('contain.text', 'The Solr connector is deprecated and will be removed in GraphDB 12');
|
|
122
|
+
|
|
123
|
+
// WHEN: I start a guide.
|
|
124
|
+
GuideSteps.runFirstGuide();
|
|
125
|
+
// THEN: I expect the Solr deprecation banner to be hidden while the guide is running.
|
|
126
|
+
DeprecationSteps.getDeprecationBanner().should('not.exist');
|
|
127
|
+
|
|
128
|
+
// WHEN: I cancel the guide.
|
|
129
|
+
GuideDialogSteps.clickOnCancelButton();
|
|
130
|
+
GuideDialogSteps.clickConfirmCancelDialogExitButton();
|
|
131
|
+
// THEN: I expect the Solr deprecation banner to be visible again.
|
|
132
|
+
DeprecationSteps.getDeprecationBanner()
|
|
133
|
+
.should('be.visible')
|
|
134
|
+
.should('contain.text', 'The Solr connector is deprecated and will be removed in GraphDB 12');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
});
|
|
@@ -230,7 +230,7 @@ describe('TTYG chat list', () => {
|
|
|
230
230
|
HomeSteps.visit();
|
|
231
231
|
cy.wait('@get-chat');
|
|
232
232
|
// and came back to the ttyg page
|
|
233
|
-
TTYGViewSteps.visit();
|
|
233
|
+
TTYGViewSteps.visit(false);
|
|
234
234
|
|
|
235
235
|
// Then I expect to last used chat be selected.
|
|
236
236
|
TTYGViewSteps.getChatFromGroup(0, 2).should('have.class', 'selected');
|
|
@@ -61,7 +61,7 @@ describe('TTYG create chat', () => {
|
|
|
61
61
|
// and returns to the TTYG page
|
|
62
62
|
TTYGStubs.stubChatsListGet("/ttyg/chats/create/get-chats-after-create.json");
|
|
63
63
|
TTYGStubs.stubAgentGet();
|
|
64
|
-
TTYGViewSteps.visit();
|
|
64
|
+
TTYGViewSteps.visit(false);
|
|
65
65
|
cy.wait('@get-chat-list');
|
|
66
66
|
// Then I expect newly created chat be selected.
|
|
67
67
|
TTYGViewSteps.getChatFromGroup(0, 0).should('contain', 'New chat of Han Solo is a character');
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphdb-workbench-tests",
|
|
3
|
-
"version": "3.5.0-
|
|
3
|
+
"version": "3.5.0-TR9",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "graphdb-workbench-tests",
|
|
9
|
-
"version": "3.5.0-
|
|
9
|
+
"version": "3.5.0-TR9",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@bahmutov/cypress-code-coverage": "^2.7.2",
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class DeprecationSteps {
|
|
2
|
+
static getDeprecationBanner() {
|
|
3
|
+
return cy.get('onto-deprecation-banner');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static getCloseButton() {
|
|
7
|
+
return DeprecationSteps.getDeprecationBanner().find('.close-button');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static closeBanner() {
|
|
11
|
+
DeprecationSteps.getCloseButton().click();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -2,9 +2,20 @@ import {BaseSteps} from "../base-steps";
|
|
|
2
2
|
import {DeprecationSteps} from '../deprecation-banner/deprecation-banner-steps.js';
|
|
3
3
|
|
|
4
4
|
export class TTYGViewSteps extends BaseSteps {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Visits the TTYG page and closes the Solr deprecation banner by default.
|
|
7
|
+
*
|
|
8
|
+
* @param {boolean} closeSolrBanner Whether to close the banner. Set to `false`
|
|
9
|
+
* when revisiting the page after the banner has already been closed.
|
|
10
|
+
*/
|
|
11
|
+
static visit(closeSolrBanner = true) {
|
|
6
12
|
cy.visit('/ttyg');
|
|
7
|
-
|
|
13
|
+
// Temporary workaround until the Solr deprecation banner is removed.
|
|
14
|
+
// The banner changes the page layout, causing tests to fail randomly.
|
|
15
|
+
// This quick fix prevents GraphDB build failures and should be deleted together with the banner.
|
|
16
|
+
if (closeSolrBanner) {
|
|
17
|
+
DeprecationSteps.closeBanner();
|
|
18
|
+
}
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
static getTtygView() {
|
|
@@ -29,6 +29,30 @@ Cypress.Commands.add('loginAsAdmin', () => {
|
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
Cypress.Commands.add('loginAs', (username, password) => {
|
|
33
|
+
return cy.request({
|
|
34
|
+
method: 'POST',
|
|
35
|
+
url: '/rest/login',
|
|
36
|
+
body: {
|
|
37
|
+
username,
|
|
38
|
+
password,
|
|
39
|
+
},
|
|
40
|
+
headers: {
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
},
|
|
43
|
+
failOnStatusCode: true,
|
|
44
|
+
}).then((response) => {
|
|
45
|
+
const authHeader = response.headers['authorization'];
|
|
46
|
+
const token = Array.isArray(authHeader)
|
|
47
|
+
? authHeader[0]
|
|
48
|
+
: authHeader;
|
|
49
|
+
cy.window().then((win) => {
|
|
50
|
+
win.localStorage.setItem('ontotext.gdb.auth.jwt', token);
|
|
51
|
+
win.localStorage.setItem('ontotext.gdb.auth.authenticated', 'true');
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
32
56
|
Cypress.Commands.add('switchOffSecurity', (secured = false) => {
|
|
33
57
|
let headers = {'Content-Type': 'application/json'};
|
|
34
58
|
if (secured) {
|
|
@@ -64,3 +88,22 @@ Cypress.Commands.add('switchOffFreeAccess', (secured = false) => {
|
|
|
64
88
|
failOnStatusCode: true,
|
|
65
89
|
});
|
|
66
90
|
});
|
|
91
|
+
|
|
92
|
+
Cypress.Commands.add('switchOnFreeAccess', (secured = false) => {
|
|
93
|
+
let headers = {'Content-Type': 'application/json'};
|
|
94
|
+
if (secured) {
|
|
95
|
+
const authHeader = Cypress.env('adminToken');
|
|
96
|
+
headers = {...headers,
|
|
97
|
+
'Authorization': authHeader
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return cy.request({
|
|
101
|
+
method: 'POST',
|
|
102
|
+
url: '/rest/security/free-access',
|
|
103
|
+
body: {
|
|
104
|
+
'enabled': true
|
|
105
|
+
},
|
|
106
|
+
headers,
|
|
107
|
+
failOnStatusCode: false,
|
|
108
|
+
});
|
|
109
|
+
});
|