graphdb-workbench-tests 3.1.0-WBM-9 → 3.1.0-plugins1
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/.nycrc +10 -0
- package/cypress-legacy.config.js +9 -1
- package/cypress-security.config.js +40 -0
- package/cypress.config.js +3 -1
- package/e2e-flaky/import/import-user-data-url.spec.js +63 -0
- package/e2e-legacy/explore/graphs-overview/graphs.overview.spec.js +1 -1
- package/e2e-legacy/graphql/filter-graphql-endpoints-on-management-view.spec.js +1 -4
- package/e2e-legacy/graphql/graphql-endpoint-management-view.spec.js +4 -4
- package/e2e-legacy/graphql/import-graphql-endpoint-definitions.spec.js +1 -10
- package/e2e-legacy/home/cookie-policy.spec.js +78 -59
- package/e2e-legacy/home/documentation-link.spec.js +31 -33
- package/e2e-legacy/home/google-analytics.spec.js +4 -6
- package/e2e-legacy/home/rdf-resource-search.spec.js +106 -138
- package/e2e-legacy/home/view-resource-autocomplete.spec.js +28 -15
- package/e2e-legacy/import/import-user-data-url.spec.js +0 -23
- package/e2e-legacy/import/import-user-data.spec.js +1 -2
- package/e2e-legacy/monitor/global-operation-statuses-component.spec.js +13 -9
- package/e2e-legacy/repository/repositories.spec.js +6 -6
- package/e2e-legacy/setup/autocomplete/autocomplete.spec.js +3 -4
- package/e2e-legacy/setup/jdbc/jdbc-create.spec.js +2 -2
- package/e2e-legacy/setup/sparql-template/sparql-template-create.js +10 -3
- package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +38 -9
- package/e2e-legacy/sparql-editor/saved-query/edit-query.spec.js +3 -6
- package/e2e-legacy/sparql-editor/saved-query/share-query.spec.js +2 -2
- package/e2e-legacy/ttyg/agent-list.spec.js +37 -2
- package/e2e-legacy/ttyg/chat-list.spec.js +1 -2
- package/e2e-legacy/ttyg/clone-agent.spec.js +1 -0
- package/e2e-legacy/ttyg/create-agent.spec.js +7 -6
- package/e2e-legacy/ttyg/edit-agent.spec.js +69 -9
- package/e2e-legacy/ttyg/ttyg-initial-state-with-selected-repository.spec.js +4 -2
- package/e2e-legacy/ttyg/ttyg-permission.spec.js +28 -20
- package/e2e-security/setup/home/cookie-policy.spec.js +64 -0
- package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +184 -0
- package/e2e-security/setup/users-and-access/graphql-user.spec.js +123 -0
- package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +69 -0
- package/e2e-security/setup/users-and-access/turn-on-security-and-password-change.spec.js +87 -0
- package/e2e-security/setup/users-and-access/user-and-access.spec.js +87 -0
- package/e2e-security/setup/users-and-access/users-and-access-initial-state.spec.js +38 -0
- package/fixtures/repositories/free-access.json +13 -0
- package/fixtures/ttyg/agent/get-agent-defaults-assistant-api.json +44 -0
- package/fixtures/ttyg/agent/get-agent-defaults.json +2 -0
- package/npm-shrinkwrap.json +7574 -1775
- package/package.json +9 -3
- package/plugins/index.js +1 -0
- package/steps/base-steps.js +4 -0
- package/steps/error-steps.js +4 -7
- package/steps/graphql/graphql-endpoint-management-steps.js +1 -1
- package/steps/home-steps.js +57 -32
- package/steps/import/import-steps.js +2 -2
- package/steps/login-steps.js +11 -0
- package/steps/main-menu-steps.js +13 -6
- package/steps/operations-statuses-component-steps.js +5 -10
- package/steps/rdf-resource-search-steps.js +55 -0
- package/steps/repository-steps.js +1 -0
- package/steps/setup/autocomplete-steps.js +4 -0
- package/steps/setup/settings-steps.js +18 -0
- package/steps/setup/user-and-access-steps.js +24 -2
- package/steps/ttyg/ttyg-agent-settings-modal.steps.js +74 -11
- package/steps/ttyg/ttyg-view-steps.js +19 -4
- package/steps/widgets/active-repository-widget-steps.js +4 -0
- package/steps/yasgui/yasr-steps.js +4 -0
- package/stubs/browser-stubs.js +21 -0
- package/stubs/environment-stubs.js +9 -1
- package/stubs/repositories/repositories-stubs.js +4 -0
- package/stubs/security-stubs.js +4 -0
- package/stubs/ttyg/ttyg-stubs.js +18 -2
- package/support/e2e.js +2 -1
- package/support/repository-commands.js +14 -1
- package/e2e-flaky/setup/users-and-access/security-and-free-access.spec.js +0 -57
- package/e2e-flaky/ttyg/ttyg-permission.spec.js +0 -67
- package/fixtures/locale-en.json +0 -3361
|
@@ -11,6 +11,10 @@ export class YasrSteps {
|
|
|
11
11
|
return YasrSteps.getYasr().find('.yasr_response_chip');
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
static getResponseInfoMessage() {
|
|
15
|
+
return YasrSteps.getResponseInfo().find('.response-info-message');
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
static getErrorHeader() {
|
|
15
19
|
return YasrSteps.getResultHeader().get('.errorHeader');
|
|
16
20
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class BrowserStubs {
|
|
2
|
+
static WINDOW_OPEN_ALIAS = (isDefinition = false) => {
|
|
3
|
+
return isDefinition ? 'windowOpen' : '@windowOpen';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static NAVIGATE_TO_URL_ALIAS = (isDefinition) => {
|
|
7
|
+
return isDefinition ? 'navigateToUrl' : '@navigateToUrl';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static stubWindowOpen() {
|
|
11
|
+
cy.window().then((win) => {
|
|
12
|
+
cy.stub(win, 'open').as(BrowserStubs.WINDOW_OPEN_ALIAS(true))
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static spyNavigateToUrl() {
|
|
17
|
+
cy.window().then((win) => {
|
|
18
|
+
cy.spy(win.singleSpa, 'navigateToUrl').as(BrowserStubs.NAVIGATE_TO_URL_ALIAS(true))
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export class EnvironmentStubs {
|
|
2
|
+
static PRODUCT_INFO_ALIAS = (isDefinition) => {
|
|
3
|
+
return isDefinition ? 'productInfo' : '@productInfo';
|
|
4
|
+
}
|
|
5
|
+
|
|
2
6
|
static stubWbProdMode() {
|
|
3
7
|
cy.window().then((win) => {
|
|
4
8
|
win.wbDevMode = false;
|
|
@@ -11,6 +15,10 @@ export class EnvironmentStubs {
|
|
|
11
15
|
});
|
|
12
16
|
}
|
|
13
17
|
|
|
18
|
+
static spyProductInfo() {
|
|
19
|
+
cy.intercept('/rest/info/version?local=1').as('productInfo')
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
static stubProductInfo(productVersion) {
|
|
15
23
|
cy.intercept('GET', '/rest/info/version?local=1', {
|
|
16
24
|
statusCode: 200,
|
|
@@ -21,7 +29,7 @@ export class EnvironmentStubs {
|
|
|
21
29
|
"sesame": "4.3.13",
|
|
22
30
|
"Workbench": "2.8.0-TR5"
|
|
23
31
|
}
|
|
24
|
-
}).as(
|
|
32
|
+
}).as(EnvironmentStubs.PRODUCT_INFO_ALIAS(true));
|
|
25
33
|
|
|
26
34
|
}
|
|
27
35
|
}
|
|
@@ -7,6 +7,10 @@ export class RepositoriesStubs extends Stubs {
|
|
|
7
7
|
RepositoriesStubs.stubGetQueryResponse('/rest/repositories/all', fixture, 'get-all-repositories', withDelay);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
static stubFreeAccess(withDelay = 0, fixture = '/repositories/free-access.json') {
|
|
11
|
+
RepositoriesStubs.stubGetQueryResponse('/rest/security/free-access', fixture, 'free-access', withDelay);
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
static spyGetRepositories() {
|
|
11
15
|
cy.intercept('GET', '/rest/repositories/all').as('getRepositories');
|
|
12
16
|
}
|
package/stubs/security-stubs.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export class SecurityStubs {
|
|
2
2
|
|
|
3
|
+
static spyOnAuthenticatedUser() {
|
|
4
|
+
cy.intercept('/rest/security/authenticated-user').as('get-authenticated-user')
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
static stubUserSecurity(infer = true, sameAs = true, userName = 'admin') {
|
|
4
8
|
cy.intercept(`rest/security/users/${userName}`, (req) => {
|
|
5
9
|
req.reply(SecurityStubs.getAdminResponse(infer, sameAs));
|
package/stubs/ttyg/ttyg-stubs.js
CHANGED
|
@@ -135,9 +135,9 @@ export class TTYGStubs extends Stubs {
|
|
|
135
135
|
}).as('delete-agent');
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
static stubAgentDefaultsGet() {
|
|
138
|
+
static stubAgentDefaultsGet(fixture = '/ttyg/agent/get-agent-defaults.json') {
|
|
139
139
|
cy.intercept('GET', '/rest/chat/agents/default', {
|
|
140
|
-
fixture
|
|
140
|
+
fixture,
|
|
141
141
|
statusCode: 200
|
|
142
142
|
}).as('get-agent-defaults');
|
|
143
143
|
}
|
|
@@ -167,4 +167,20 @@ export class TTYGStubs extends Stubs {
|
|
|
167
167
|
statusCode: 200
|
|
168
168
|
}).as('explain-response');
|
|
169
169
|
}
|
|
170
|
+
|
|
171
|
+
static getExternalUrl() {
|
|
172
|
+
cy.intercept('GET', 'rest/info/external-url', {
|
|
173
|
+
statusCode: 200,
|
|
174
|
+
body: 'http://user-pc:7200'
|
|
175
|
+
}).as('external-url');
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
static stubForApiType(type = 'default') {
|
|
179
|
+
const fixtures = {
|
|
180
|
+
default: '/ttyg/agent/get-agent-defaults.json',
|
|
181
|
+
assistants: '/ttyg/agent/get-agent-defaults-assistant-api.json'
|
|
182
|
+
};
|
|
183
|
+
this.stubAgentListGet('/ttyg/agent/get-agent-list-autocomplete-query.json');
|
|
184
|
+
this.stubAgentDefaultsGet(fixtures[type]);
|
|
185
|
+
}
|
|
170
186
|
}
|
package/support/e2e.js
CHANGED
|
@@ -23,6 +23,8 @@ import 'cypress-real-events';
|
|
|
23
23
|
import 'cypress-file-upload';
|
|
24
24
|
import {LicenseStubs} from "../stubs/license-stubs";
|
|
25
25
|
import {SecurityStubs} from "../stubs/security-stubs";
|
|
26
|
+
// https://github.com/bahmutov/cypress-code-coverage
|
|
27
|
+
require('@bahmutov/cypress-code-coverage/support');
|
|
26
28
|
|
|
27
29
|
// Configures an environment variable with the key used for common actions (cmd on mac, ctrl on other OS).
|
|
28
30
|
// This variable must be used in all actions that type e.g. ctrl-a to select text.
|
|
@@ -44,6 +46,5 @@ beforeEach(() => {
|
|
|
44
46
|
// for some reason.
|
|
45
47
|
// It'll be good to investigate it a bit sometime.
|
|
46
48
|
SecurityStubs.stubGetAdminUser();
|
|
47
|
-
// SecurityStubs.stubUpdateUserData('admin');
|
|
48
49
|
}
|
|
49
50
|
});
|
|
@@ -15,6 +15,7 @@ Cypress.Commands.add('createRepository', (options = {}) => {
|
|
|
15
15
|
}
|
|
16
16
|
}).then((response) => {
|
|
17
17
|
cy.waitUntil(() => response && response.status === 201); // 201 Created
|
|
18
|
+
cy.log('Created repository with ID:', options.id);
|
|
18
19
|
});
|
|
19
20
|
});
|
|
20
21
|
|
|
@@ -39,7 +40,9 @@ Cypress.Commands.add('deleteRepository', (id, secured = false) => {
|
|
|
39
40
|
headers,
|
|
40
41
|
// Prevent Cypress from failing the test on non-2xx status codes
|
|
41
42
|
failOnStatusCode: false
|
|
42
|
-
})
|
|
43
|
+
}).then((response) => {
|
|
44
|
+
cy.waitUntil(() => response);
|
|
45
|
+
});
|
|
43
46
|
});
|
|
44
47
|
|
|
45
48
|
Cypress.Commands.add('presetRepository', (id) => {
|
|
@@ -50,6 +53,16 @@ Cypress.Commands.add('presetRepository', (id) => {
|
|
|
50
53
|
const presetRepo = JSON.parse(preset);
|
|
51
54
|
return presetRepo && presetRepo.id === id
|
|
52
55
|
}));
|
|
56
|
+
cy.log('Pre-set repository:', id);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
Cypress.Commands.add('unsetRepository', () => {
|
|
60
|
+
cy.removeLocalStorage(PRESET_REPO);
|
|
61
|
+
cy.waitUntil(() =>
|
|
62
|
+
cy.getLocalStorage(PRESET_REPO)
|
|
63
|
+
.then((preset) => {
|
|
64
|
+
return !preset;
|
|
65
|
+
}));
|
|
53
66
|
});
|
|
54
67
|
|
|
55
68
|
/**
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
import {LoginSteps} from "../../../steps/login-steps";
|
|
6
|
-
|
|
7
|
-
const DEFAULT_ADMIN_PASSWORD = "root";
|
|
8
|
-
// Moved out of the standard test suite, because Cypress can't verify Free Access is ON in CI
|
|
9
|
-
/**
|
|
10
|
-
* TODO: Fix me. Broken due to migration (loader is not implemented)
|
|
11
|
-
*/
|
|
12
|
-
describe.skip('Security and Free Access', () => {
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
UserAndAccessSteps.visit();
|
|
15
|
-
cy.window();
|
|
16
|
-
// Users table should be visible
|
|
17
|
-
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
afterEach(() => {
|
|
21
|
-
UserAndAccessSteps.visit();
|
|
22
|
-
UserAndAccessSteps.getToggleSecurityCheckbox()
|
|
23
|
-
.then(($toggle) => {
|
|
24
|
-
if ($toggle.prop('checked')) {
|
|
25
|
-
// Uncheck the security toggle button at the end of each test, if it is checked
|
|
26
|
-
UserAndAccessSteps.toggleSecurity();
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should toggle free access after Admin has logged in', () => {
|
|
32
|
-
// Given I have available repositories to allow Free Access for
|
|
33
|
-
RepositoriesStubs.stubRepositories();
|
|
34
|
-
// When I enable security
|
|
35
|
-
UserAndAccessSteps.toggleSecurity();
|
|
36
|
-
// When I log in as an Admin
|
|
37
|
-
LoginSteps.loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
|
|
38
|
-
// Then the page should load
|
|
39
|
-
UserAndAccessSteps.getSplashLoader().should('not.be.visible');
|
|
40
|
-
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
41
|
-
// The Free Access toggle should be OFF
|
|
42
|
-
UserAndAccessSteps.getFreeAccessSwitchInput().should('not.be.checked');
|
|
43
|
-
// When I toggle Free Access ON
|
|
44
|
-
UserAndAccessSteps.toggleFreeAccess();
|
|
45
|
-
// Then I click OK in the modal
|
|
46
|
-
ModalDialogSteps.clickOKButton();
|
|
47
|
-
// Then the toggle button should be ON
|
|
48
|
-
UserAndAccessSteps.getFreeAccessSwitchInput().should('be.checked');
|
|
49
|
-
// And I should see a success message
|
|
50
|
-
ToasterSteps.verifySuccess('Free access has been enabled.');
|
|
51
|
-
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
52
|
-
// When I toggle Free Access OFF
|
|
53
|
-
UserAndAccessSteps.toggleFreeAccess();
|
|
54
|
-
// Then I should see a success message
|
|
55
|
-
ToasterSteps.verifySuccess('Free access has been disabled.');
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
|
|
2
|
-
import {RepositoriesStub} from "../../stubs/repositories-stub";
|
|
3
|
-
import {UserAndAccessSteps} from "../../steps/setup/user-and-access-steps";
|
|
4
|
-
import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
|
|
5
|
-
import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
|
|
6
|
-
import {LoginSteps} from "../../steps/login-steps";
|
|
7
|
-
|
|
8
|
-
const USER_WITH_ROLE_USER = 'ttyg_user';
|
|
9
|
-
const USER_WITH_ROLE_REPO_MANAGER = 'ttyg_repo_manager';
|
|
10
|
-
const USER_ADMINISTRATOR = 'admin';
|
|
11
|
-
const PASSWORD = 'root';
|
|
12
|
-
const ENABLED = true;
|
|
13
|
-
const DISABLED = false;
|
|
14
|
-
|
|
15
|
-
describe('TTYG permissions', () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
before(() => {
|
|
19
|
-
RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
|
|
20
|
-
RepositoriesStub.stubBaseEndpoints('starwars');
|
|
21
|
-
cy.presetRepository('starwars');
|
|
22
|
-
cy.createUser({username: USER_WITH_ROLE_USER, password: PASSWORD});
|
|
23
|
-
cy.createUser({
|
|
24
|
-
username: USER_WITH_ROLE_REPO_MANAGER,
|
|
25
|
-
password: PASSWORD,
|
|
26
|
-
grantedAuthorities: ["ROLE_REPO_MANAGER", "WRITE_REPO_*", "READ_REPO_*"]
|
|
27
|
-
});
|
|
28
|
-
UserAndAccessSteps.visit();
|
|
29
|
-
UserAndAccessSteps.toggleSecurity();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
after(() => {
|
|
33
|
-
UserAndAccessSteps.visit();
|
|
34
|
-
LoginSteps.loginWithUser(USER_ADMINISTRATOR, PASSWORD);
|
|
35
|
-
UserAndAccessSteps.toggleSecurity();
|
|
36
|
-
cy.deleteUser(USER_WITH_ROLE_USER);
|
|
37
|
-
cy.deleteUser(USER_WITH_ROLE_REPO_MANAGER);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should disable all buttons that can modify the agent', () => {
|
|
41
|
-
|
|
42
|
-
// When I log in with a user who has the ROLE_USER role, I expect all buttons modifying the agent to be disabled.
|
|
43
|
-
verifyCanCreateAgentForFirstTime(USER_WITH_ROLE_USER, PASSWORD, DISABLED);
|
|
44
|
-
|
|
45
|
-
// When I log in with a user who has the ROLE_REPO_MANAGER role, I expect all buttons modifying the agent to be enabled.
|
|
46
|
-
verifyCanCreateAgentForFirstTime(USER_WITH_ROLE_REPO_MANAGER, PASSWORD, ENABLED);
|
|
47
|
-
|
|
48
|
-
// When I log in with a user who is administrator, I expect all buttons modifying the agent to be enabled.
|
|
49
|
-
verifyCanCreateAgentForFirstTime(USER_ADMINISTRATOR, PASSWORD, ENABLED);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
function verifyCanCreateAgentForFirstTime(user, password, enable) {
|
|
53
|
-
const shouldBe = enable ? 'be.enabled' : 'be.disabled';
|
|
54
|
-
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
55
|
-
TTYGViewSteps.visit();
|
|
56
|
-
LoginSteps.loginWithUser(user, password);
|
|
57
|
-
TTYGViewSteps.getCreateFirstAgentButton().should(shouldBe);
|
|
58
|
-
TTYGStubs.stubChatsListGet();
|
|
59
|
-
TTYGStubs.stubAgentListGet();
|
|
60
|
-
TTYGStubs.stubChatGet();
|
|
61
|
-
TTYGViewSteps.visit();
|
|
62
|
-
TTYGViewSteps.getCreateAgentButton().should(shouldBe);
|
|
63
|
-
TTYGViewSteps.getEditCurrentAgentButton().should(shouldBe);
|
|
64
|
-
TTYGViewSteps.getToggleAgentsSidebarButton().should(shouldBe);
|
|
65
|
-
LoginSteps.logout();
|
|
66
|
-
}
|
|
67
|
-
});
|