graphdb-workbench-tests 3.1.0-TR3 → 3.1.0-TR5
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/e2e-legacy/graphql/import-graphql-endpoint-definitions.spec.js +1 -4
- package/e2e-legacy/home/cookie-policy.spec.js +54 -58
- package/e2e-legacy/home/documentation-link.spec.js +3 -6
- package/e2e-legacy/home/google-analytics.spec.js +3 -6
- package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +4 -5
- package/e2e-legacy/ttyg/ttyg-permission.spec.js +19 -8
- package/npm-shrinkwrap.json +7574 -1775
- package/package.json +6 -2
- package/plugins/index.js +1 -0
- package/steps/home-steps.js +17 -0
- package/steps/setup/settings-steps.js +18 -0
- package/stubs/security-stubs.js +4 -0
- package/support/e2e.js +2 -1
- package/e2e-flaky/ttyg/ttyg-permission.spec.js +0 -67
package/.nycrc
ADDED
package/cypress-legacy.config.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const {defineConfig} = require('cypress');
|
|
2
2
|
|
|
3
|
+
const isCoverage = process.env.COVERAGE === 'true';
|
|
4
|
+
|
|
3
5
|
module.exports = defineConfig({
|
|
4
6
|
projectId: 'v35btb',
|
|
5
7
|
fixturesFolder: 'fixtures',
|
|
@@ -8,6 +10,8 @@ module.exports = defineConfig({
|
|
|
8
10
|
video: true,
|
|
9
11
|
defaultCommandTimeout: 25000,
|
|
10
12
|
numTestsKeptInMemory: 10,
|
|
13
|
+
viewportWidth: 1280,
|
|
14
|
+
viewportHeight: 720,
|
|
11
15
|
e2e: {
|
|
12
16
|
retries: {
|
|
13
17
|
runMode: 2,
|
|
@@ -16,7 +20,11 @@ module.exports = defineConfig({
|
|
|
16
20
|
// We've imported your old cypress plugins here.
|
|
17
21
|
// You may want to clean this up later by importing these.
|
|
18
22
|
setupNodeEvents(on, config) {
|
|
19
|
-
|
|
23
|
+
require('./plugins')(on, config);
|
|
24
|
+
if (isCoverage) {
|
|
25
|
+
require('@bahmutov/cypress-code-coverage/plugin')(on, config)
|
|
26
|
+
}
|
|
27
|
+
return config;
|
|
20
28
|
},
|
|
21
29
|
baseUrl: 'http://localhost:9000',
|
|
22
30
|
specPattern: 'e2e-legacy/**/*.{js,jsx,ts,tsx}',
|
|
@@ -85,10 +85,7 @@ describe('Graphql: import endpoint definitions', () => {
|
|
|
85
85
|
]);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
* TODO Fixme broken due migration (Error unknown)
|
|
90
|
-
*/
|
|
91
|
-
it.skip('should be able to import broken endpoint definition', () => {
|
|
88
|
+
it('should be able to import broken endpoint definition', () => {
|
|
92
89
|
visitAndOpenImportModal();
|
|
93
90
|
// When I select the file to upload
|
|
94
91
|
ImportEndpointDefinitionModalSteps.selectFile(brokenSwapiDefinitionPath);
|
|
@@ -7,10 +7,7 @@ import {LicenseStubs} from "../../stubs/license-stubs";
|
|
|
7
7
|
Cypress.env('set_default_user_data', false);
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* TODO: Fix me. Broken due to migration (Cookie policy is not implemented in the new footer)
|
|
12
|
-
*/
|
|
13
|
-
describe.skip('Cookie policy', () => {
|
|
10
|
+
describe('Cookie policy', () => {
|
|
14
11
|
beforeEach(() => {
|
|
15
12
|
cy.setDefaultUserData(false);
|
|
16
13
|
cy.viewport(1280, 1000);
|
|
@@ -19,71 +16,70 @@ describe.skip('Cookie policy', () => {
|
|
|
19
16
|
|
|
20
17
|
afterEach(() => cy.setDefaultUserData());
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
context('should show', () => {
|
|
20
|
+
it('Should show consent popup to user', () => {
|
|
21
|
+
HomeSteps.visitInProdMode();
|
|
22
|
+
HomeSteps.getCookieConsentPopup().should('exist').and('be.visible');
|
|
23
|
+
// When I click on the link
|
|
24
|
+
HomeSteps.clickCookiePolicyLink();
|
|
25
|
+
// Then I see the cookie policy
|
|
26
|
+
HomeSteps.getCookiePolicyModal().should('exist').and('be.visible');
|
|
27
|
+
});
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
SettingsSteps.getCookiePolicyButton().should('exist').and('be.visible');
|
|
29
|
+
it('Should show cookie policy to user in user settings', () => {
|
|
30
|
+
SettingsSteps.visitInProdMode();
|
|
31
|
+
SettingsSteps.getCookiePolicyButton().should('exist').and('be.visible');
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
// When I click on the link
|
|
34
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
35
|
+
// Then I see the cookie policy
|
|
36
|
+
SettingsSteps.getCookiePolicyModal().should('exist').and('be.visible');
|
|
37
|
+
});
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
39
|
+
it('Should save consent in user settings', () => {
|
|
40
|
+
HomeSteps.visitInProdMode();
|
|
41
|
+
SecurityStubs.stubUpdateUserData('admin');
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
SettingsSteps.getCookiePolicyButton().should('not.exist');
|
|
51
|
-
});
|
|
43
|
+
// When I click Agree button
|
|
44
|
+
HomeSteps.clickAgreeButton();
|
|
52
45
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
// I expect to save cookie consent in user settings
|
|
47
|
+
cy.wait('@updateUser').then((xhr) => {
|
|
48
|
+
expect(xhr.request.body.appSettings).to.include({
|
|
49
|
+
DEFAULT_INFERENCE: true,
|
|
50
|
+
DEFAULT_VIS_GRAPH_SCHEMA: true,
|
|
51
|
+
DEFAULT_SAMEAS: true,
|
|
52
|
+
IGNORE_SHARED_QUERIES: false,
|
|
53
|
+
EXECUTE_COUNT: true
|
|
54
|
+
});
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
// Assert COOKIE_CONSENT properties, excluding updatedAt
|
|
57
|
+
expect(xhr.request.body.appSettings.COOKIE_CONSENT).to.include({
|
|
58
|
+
policyAccepted: true
|
|
59
|
+
});
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
DEFAULT_VIS_GRAPH_SCHEMA: true,
|
|
66
|
-
DEFAULT_SAMEAS: true,
|
|
67
|
-
IGNORE_SHARED_QUERIES: false,
|
|
68
|
-
EXECUTE_COUNT: true
|
|
69
|
-
});
|
|
61
|
+
// Assert that updatedAt is present, is a number, and is a reasonable timestamp
|
|
62
|
+
const updatedAt = xhr.request.body.appSettings.COOKIE_CONSENT.updatedAt;
|
|
63
|
+
expect(updatedAt).to.exist;
|
|
64
|
+
expect(updatedAt).to.be.a('number');
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
thirdParty: true
|
|
66
|
+
// Check that updatedAt is within 1 hour of the current time
|
|
67
|
+
const oneHourInMilliseconds = 60 * 60 * 1000;
|
|
68
|
+
const now = Date.now();
|
|
69
|
+
expect(updatedAt).to.be.within(now - oneHourInMilliseconds, now + oneHourInMilliseconds);
|
|
76
70
|
});
|
|
71
|
+
});
|
|
72
|
+
})
|
|
77
73
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
context('should not show', () => {
|
|
75
|
+
it('Should NOT show consent popup to user when tracking is not applicable', () => {
|
|
76
|
+
HomeSteps.visitInDevMode();
|
|
77
|
+
HomeSteps.getCookieConsentPopup().should('not.exist');
|
|
78
|
+
});
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
expect(updatedAt).to.be.within(now - oneHourInMilliseconds, now + oneHourInMilliseconds);
|
|
80
|
+
it('Should NOT show cookie policy to user when tracking is not applicable', () => {
|
|
81
|
+
SettingsSteps.visitInDevMode();
|
|
82
|
+
SettingsSteps.getCookiePolicyButton().should('not.exist');
|
|
87
83
|
});
|
|
88
84
|
});
|
|
89
85
|
});
|
|
@@ -11,10 +11,9 @@ describe('Documentation links resolver', () => {
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it('Should link to master version when in dev mode', () => {
|
|
14
|
-
HomeSteps.
|
|
14
|
+
HomeSteps.visitInDevMode();
|
|
15
15
|
waitForProductInfo();
|
|
16
16
|
BrowserStubs.stubWindowOpen();
|
|
17
|
-
EnvironmentStubs.stubWbDevMode();
|
|
18
17
|
MainMenuSteps.clickOnMenuHelp();
|
|
19
18
|
// Assert that links point to the master version
|
|
20
19
|
assertDocumentationLinks('master');
|
|
@@ -23,10 +22,9 @@ describe('Documentation links resolver', () => {
|
|
|
23
22
|
|
|
24
23
|
it('Should link to master version when in prod mode and unofficial version', () => {
|
|
25
24
|
EnvironmentStubs.stubProductInfo('10.8-TR1-test');
|
|
26
|
-
HomeSteps.
|
|
25
|
+
HomeSteps.visitInProdMode();
|
|
27
26
|
waitForProductInfo();
|
|
28
27
|
BrowserStubs.stubWindowOpen();
|
|
29
|
-
EnvironmentStubs.stubWbProdMode();
|
|
30
28
|
MainMenuSteps.clickOnMenuHelp();
|
|
31
29
|
// Assert that links point to the master version
|
|
32
30
|
assertDocumentationLinks('master');
|
|
@@ -34,10 +32,9 @@ describe('Documentation links resolver', () => {
|
|
|
34
32
|
|
|
35
33
|
it('Should link to GDB version when in prod mode and official version', () => {
|
|
36
34
|
EnvironmentStubs.stubProductInfo('10.8');
|
|
37
|
-
HomeSteps.
|
|
35
|
+
HomeSteps.visitInProdMode();
|
|
38
36
|
waitForProductInfo();
|
|
39
37
|
BrowserStubs.stubWindowOpen();
|
|
40
|
-
EnvironmentStubs.stubWbProdMode();
|
|
41
38
|
MainMenuSteps.clickOnMenuHelp();
|
|
42
39
|
// Assert that links point to the specific GDB version
|
|
43
40
|
assertDocumentationLinks('10.8');
|
|
@@ -11,8 +11,7 @@ describe('Google analytics', () => {
|
|
|
11
11
|
// Note: Google API calls are stubbed for all specs in support/index.js
|
|
12
12
|
it('Should set GA tracking code in header and a cookie when free license and prodMode', () => {
|
|
13
13
|
LicenseStubs.stubFreeLicense();
|
|
14
|
-
HomeSteps.
|
|
15
|
-
EnvironmentStubs.stubWbProdMode();
|
|
14
|
+
HomeSteps.visitInProdMode();
|
|
16
15
|
|
|
17
16
|
cy.document()
|
|
18
17
|
.get('head script')
|
|
@@ -28,8 +27,7 @@ describe('Google analytics', () => {
|
|
|
28
27
|
|
|
29
28
|
it('Should set GA tracking code in header and cookie when evaluation enterprise license and prodMode', () => {
|
|
30
29
|
LicenseStubs.stubEvaluationLicense();
|
|
31
|
-
HomeSteps.
|
|
32
|
-
EnvironmentStubs.stubWbProdMode();
|
|
30
|
+
HomeSteps.visitInProdMode();
|
|
33
31
|
|
|
34
32
|
cy.document()
|
|
35
33
|
.get('head script')
|
|
@@ -45,8 +43,7 @@ describe('Google analytics', () => {
|
|
|
45
43
|
|
|
46
44
|
it('Should NOT set GA tracking code in header and cookie when enterprise license in prodMode', () => {
|
|
47
45
|
LicenseStubs.stubEnterpriseLicense();
|
|
48
|
-
HomeSteps.
|
|
49
|
-
EnvironmentStubs.stubWbProdMode();
|
|
46
|
+
HomeSteps.visitInProdMode();
|
|
50
47
|
|
|
51
48
|
cy.document()
|
|
52
49
|
.get('head script')
|
|
@@ -5,11 +5,9 @@ import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
|
|
|
5
5
|
import {ToasterSteps} from "../../../steps/toaster-steps";
|
|
6
6
|
import HomeSteps from "../../../steps/home-steps";
|
|
7
7
|
import {LoginSteps} from "../../../steps/login-steps";
|
|
8
|
+
import {MainMenuSteps} from "../../../steps/main-menu-steps";
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* TODO: Fix me. Broken due to migration (Error: unknown)
|
|
12
|
-
*/
|
|
13
11
|
describe('User and Access', () => {
|
|
14
12
|
|
|
15
13
|
const PASSWORD = "password";
|
|
@@ -179,6 +177,7 @@ describe('User and Access', () => {
|
|
|
179
177
|
cy.deleteRepository(repositoryId2, true);
|
|
180
178
|
cy.deleteRepository(repositoryId3, true);
|
|
181
179
|
cy.deleteUser(graphqlUser, true);
|
|
180
|
+
cy.switchOffFreeAccess(true);
|
|
182
181
|
cy.switchOffSecurity(true);
|
|
183
182
|
});
|
|
184
183
|
|
|
@@ -454,9 +453,9 @@ describe('User and Access', () => {
|
|
|
454
453
|
function navigateMenuPath(pathArray, expectedUrl, expectedTitle) {
|
|
455
454
|
pathArray.forEach((label, index) => {
|
|
456
455
|
if (index === 0) {
|
|
457
|
-
|
|
456
|
+
MainMenuSteps.clickOnMenu(label);
|
|
458
457
|
} else {
|
|
459
|
-
|
|
458
|
+
MainMenuSteps.clickOnSubMenu(label);
|
|
460
459
|
const title = expectedTitle ? expectedTitle : label;
|
|
461
460
|
cy.get('h1').should('contain', title);
|
|
462
461
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
|
|
2
2
|
import {RepositoriesStub} from "../../stubs/repositories-stub";
|
|
3
|
-
import {UserAndAccessSteps} from "../../steps/setup/user-and-access-steps";
|
|
4
3
|
import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
|
|
5
4
|
import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
|
|
6
5
|
import {LoginSteps} from "../../steps/login-steps";
|
|
6
|
+
import {SecurityStubs} from "../../stubs/security-stubs";
|
|
7
|
+
import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
|
|
7
8
|
|
|
9
|
+
const REPOSITORY_ID = 'starwars';
|
|
8
10
|
const USER_WITH_ROLE_USER = 'ttyg_user';
|
|
9
11
|
const USER_WITH_ROLE_REPO_MANAGER = 'ttyg_repo_manager';
|
|
10
12
|
const USER_ADMINISTRATOR = 'admin';
|
|
@@ -14,12 +16,8 @@ const DISABLED = false;
|
|
|
14
16
|
|
|
15
17
|
describe('TTYG permissions', () => {
|
|
16
18
|
|
|
17
|
-
|
|
18
19
|
before(() => {
|
|
19
|
-
RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
|
|
20
|
-
RepositoriesStub.stubBaseEndpoints('starwars');
|
|
21
20
|
cy.loginAsAdmin();
|
|
22
|
-
cy.presetRepository('starwars');
|
|
23
21
|
cy.createUser({username: USER_WITH_ROLE_USER, password: PASSWORD});
|
|
24
22
|
cy.createUser({
|
|
25
23
|
username: USER_WITH_ROLE_REPO_MANAGER,
|
|
@@ -29,6 +27,12 @@ describe('TTYG permissions', () => {
|
|
|
29
27
|
cy.switchOnSecurity();
|
|
30
28
|
});
|
|
31
29
|
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
SecurityStubs.spyOnAuthenticatedUser();
|
|
32
|
+
RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
|
|
33
|
+
RepositoriesStub.stubBaseEndpoints(REPOSITORY_ID);
|
|
34
|
+
})
|
|
35
|
+
|
|
32
36
|
after(() => {
|
|
33
37
|
cy.loginAsAdmin();
|
|
34
38
|
cy.deleteUser(USER_WITH_ROLE_USER, true);
|
|
@@ -36,14 +40,17 @@ describe('TTYG permissions', () => {
|
|
|
36
40
|
cy.switchOffSecurity(true);
|
|
37
41
|
});
|
|
38
42
|
|
|
39
|
-
it('should disable all buttons that can modify the agent', () => {
|
|
40
|
-
|
|
43
|
+
it('should disable all buttons that can modify the agent when user is with ROLE_USER', () => {
|
|
41
44
|
// When I log in with a user who has the ROLE_USER role, I expect all buttons modifying the agent to be disabled.
|
|
42
45
|
verifyCanCreateAgentForFirstTime(USER_WITH_ROLE_USER, PASSWORD, DISABLED);
|
|
46
|
+
});
|
|
43
47
|
|
|
48
|
+
it('should enable all buttons that can modify the agent when user is with role ROLE_REPO_MANAGER', () => {
|
|
44
49
|
// When I log in with a user who has the ROLE_REPO_MANAGER role, I expect all buttons modifying the agent to be enabled.
|
|
45
50
|
verifyCanCreateAgentForFirstTime(USER_WITH_ROLE_REPO_MANAGER, PASSWORD, ENABLED);
|
|
51
|
+
});
|
|
46
52
|
|
|
53
|
+
it('should enable all buttons that can modify the agent when user is admin', () => {
|
|
47
54
|
// When I log in with a user who is administrator, I expect all buttons modifying the agent to be enabled.
|
|
48
55
|
verifyCanCreateAgentForFirstTime(USER_ADMINISTRATOR, PASSWORD, ENABLED);
|
|
49
56
|
});
|
|
@@ -52,7 +59,12 @@ describe('TTYG permissions', () => {
|
|
|
52
59
|
const shouldBe = enable ? 'be.enabled' : 'be.disabled';
|
|
53
60
|
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
54
61
|
TTYGViewSteps.visit();
|
|
62
|
+
cy.url().should('include', '/login');
|
|
63
|
+
cy.wait('@get-authenticated-user');
|
|
64
|
+
cy.wait('@get-authenticated-user');
|
|
65
|
+
cy.wait('@get-authenticated-user');
|
|
55
66
|
LoginSteps.loginWithUser(user, password);
|
|
67
|
+
RepositorySelectorSteps.selectRepository(REPOSITORY_ID);
|
|
56
68
|
TTYGViewSteps.getCreateFirstAgentButton().should(shouldBe);
|
|
57
69
|
TTYGStubs.stubChatsListGet();
|
|
58
70
|
TTYGStubs.stubAgentListGet();
|
|
@@ -61,6 +73,5 @@ describe('TTYG permissions', () => {
|
|
|
61
73
|
TTYGViewSteps.getCreateAgentButton().should(shouldBe);
|
|
62
74
|
TTYGViewSteps.getEditCurrentAgentButton().should(shouldBe);
|
|
63
75
|
TTYGViewSteps.getToggleAgentsSidebarButton().should(shouldBe);
|
|
64
|
-
LoginSteps.logout();
|
|
65
76
|
}
|
|
66
77
|
});
|