graphdb-workbench-tests 4.0.0-TR10 → 4.0.0-TR12
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/graph-navigator/graph-navigator.spec.js +48 -0
- package/e2e-legacy/monitor/global-operation-statuses-component.spec.js +13 -17
- package/e2e-legacy/repository/repository-picker-tooltip.spec.js +72 -0
- package/e2e-legacy/repository/repository-selector-tooltip.spec.js +55 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/steps/cookie-policy/cookie-consent-banner-steps.js +2 -2
- package/steps/graph-navigator-steps.js +4 -0
- package/steps/repository-picker-list-steps.js +16 -0
- package/steps/repository-selector-steps.js +16 -0
- package/steps/yasgui/yasr-steps.js +8 -0
- package/stubs/browser-stubs.js +40 -0
- package/stubs/repositories/repositories-stubs.js +40 -0
|
@@ -3,6 +3,7 @@ import {LanguageSelectorSteps} from '../../steps/language-selector-steps.js';
|
|
|
3
3
|
import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
|
|
4
4
|
import {MainMenuSteps} from '../../steps/main-menu-steps.js';
|
|
5
5
|
import {YasqeSteps} from '../../steps/yasgui/yasqe-steps.js';
|
|
6
|
+
import {YasrSteps} from '../../steps/yasgui/yasr-steps.js';
|
|
6
7
|
import {ToasterSteps} from '../../steps/toaster-steps.js';
|
|
7
8
|
|
|
8
9
|
const FILE_TO_IMPORT = 'resource-test-data.ttl';
|
|
@@ -57,6 +58,27 @@ describe('Graph Navigator', () => {
|
|
|
57
58
|
GraphNavigatorSteps.getElement(CONSTRUCT_TARGET_LABEL).should('exist');
|
|
58
59
|
});
|
|
59
60
|
|
|
61
|
+
it('should unmount and mount the diagram component without errors', () => {
|
|
62
|
+
// Given I have opened the Graph Navigator view, so its diagram component is already loaded.
|
|
63
|
+
GraphNavigatorSteps.visit();
|
|
64
|
+
GraphNavigatorSteps.getWorkspace().should('exist');
|
|
65
|
+
// And I have navigated to the SPARQL editor and executed a CONSTRUCT query.
|
|
66
|
+
MainMenuSteps.clickOnSparqlMenu();
|
|
67
|
+
YasqeSteps.getEditor().should('be.visible');
|
|
68
|
+
YasqeSteps.pasteQuery(CONSTRUCT_QUERY);
|
|
69
|
+
YasqeSteps.executeQuery();
|
|
70
|
+
|
|
71
|
+
// When I click on the "Graph Navigator" button.
|
|
72
|
+
YasrSteps.visualizeInGraphNavigator();
|
|
73
|
+
|
|
74
|
+
// Then I expect to be navigated to the Graph Navigator view, so it renders a second time
|
|
75
|
+
GraphNavigatorSteps.getComponent().should('exist');
|
|
76
|
+
// And I expect the computed graph to be seeded on the canvas: the subject and its related resource.
|
|
77
|
+
GraphNavigatorSteps.getElements().should('have.length', 2);
|
|
78
|
+
GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
|
|
79
|
+
GraphNavigatorSteps.getElement(CONSTRUCT_TARGET_LABEL).should('exist');
|
|
80
|
+
});
|
|
81
|
+
|
|
60
82
|
it('should keep the displayed resources when the language is switched', () => {
|
|
61
83
|
// Given the Graph Navigator view is opened with a start resource that gets seeded on the canvas.
|
|
62
84
|
GraphNavigatorSteps.visit(SEED_RESOURCE_ENCODED);
|
|
@@ -235,9 +257,35 @@ describe('Graph Navigator', () => {
|
|
|
235
257
|
// When I switch to another repository.
|
|
236
258
|
RepositorySelectorSteps.selectRepository(secondRepositoryId);
|
|
237
259
|
|
|
260
|
+
// Then I expect a confirmation that warns the diagram will be cleared.
|
|
261
|
+
GraphNavigatorSteps.getConfirmDialog().should('be.visible')
|
|
262
|
+
.and('contain', 'The diagram will be cleared.');
|
|
263
|
+
|
|
264
|
+
// When I cancel.
|
|
265
|
+
GraphNavigatorSteps.cancelDialog();
|
|
266
|
+
|
|
267
|
+
// Then I expect the repository, the canvas and the start resource in the URL to be kept.
|
|
268
|
+
GraphNavigatorSteps.getElements().should('have.length', 1);
|
|
269
|
+
GraphNavigatorSteps.verifyStartResourceUri(decodeURIComponent(SEED_RESOURCE_ENCODED));
|
|
270
|
+
|
|
271
|
+
// When I switch to another repository and confirm.
|
|
272
|
+
RepositorySelectorSteps.selectRepository(secondRepositoryId);
|
|
273
|
+
GraphNavigatorSteps.confirmDialog();
|
|
274
|
+
|
|
238
275
|
// Then I expect the workspace to still be mounted, but the canvas to be cleared.
|
|
239
276
|
GraphNavigatorSteps.getWorkspace().should('exist');
|
|
240
277
|
GraphNavigatorSteps.getElements().should('not.exist');
|
|
278
|
+
|
|
279
|
+
// And I expect the URL to hold only the new repository.
|
|
280
|
+
GraphNavigatorSteps.verifyOnlyRepositoryParam(secondRepositoryId);
|
|
281
|
+
|
|
282
|
+
// When I refresh the page.
|
|
283
|
+
cy.reload();
|
|
284
|
+
|
|
285
|
+
// Then I expect the canvas to stay empty, because the start resource is no longer in the URL.
|
|
286
|
+
GraphNavigatorSteps.getWorkspace().should('exist');
|
|
287
|
+
GraphNavigatorSteps.getElements().should('not.exist');
|
|
288
|
+
GraphNavigatorSteps.verifyOnlyRepositoryParam(secondRepositoryId);
|
|
241
289
|
});
|
|
242
290
|
});
|
|
243
291
|
});
|
|
@@ -63,7 +63,7 @@ describe('Operations Status Component', () => {
|
|
|
63
63
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
it('should
|
|
66
|
+
it('should link the queries operation element to its view in a new window', () => {
|
|
67
67
|
// When I visit some page and there are running operations.
|
|
68
68
|
GlobalOperationsStatusesStub.stubGlobalOperationsStatusesResponse(repositoryId);
|
|
69
69
|
HomeSteps.visitAndWaitLoader();
|
|
@@ -71,14 +71,13 @@ describe('Operations Status Component', () => {
|
|
|
71
71
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
72
72
|
|
|
73
73
|
OperationsStatusesComponentSteps.openOperationStatusesDialog();
|
|
74
|
-
//
|
|
75
|
-
// Then I expect to be redirected to "Query and Update monitoring" view.
|
|
74
|
+
// Then I expect "Running query" operation element to link to "Query and Update monitoring" view in a new window.
|
|
76
75
|
checkOperationElementUrl('monitor/queries', 3);
|
|
77
76
|
// Then I expect "Global Operations Component" to still be displayed.
|
|
78
77
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
79
78
|
});
|
|
80
79
|
|
|
81
|
-
it('should
|
|
80
|
+
it('should link the updates operation element to its view in a new window', () => {
|
|
82
81
|
// When I visit some page and there are running operations.
|
|
83
82
|
GlobalOperationsStatusesStub.stubGlobalOperationsStatusesResponse(repositoryId);
|
|
84
83
|
HomeSteps.visitAndWaitLoader();
|
|
@@ -86,14 +85,13 @@ describe('Operations Status Component', () => {
|
|
|
86
85
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
87
86
|
|
|
88
87
|
OperationsStatusesComponentSteps.openOperationStatusesDialog();
|
|
89
|
-
//
|
|
90
|
-
// Then I expect to be redirected to "Query and Update monitoring" view.
|
|
88
|
+
// Then I expect "Running updates" operation element to link to "Query and Update monitoring" view in a new window.
|
|
91
89
|
checkOperationElementUrl('monitor/queries', 4);
|
|
92
90
|
// Then I expect "Global Operations Component" to still be displayed.
|
|
93
91
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
94
92
|
});
|
|
95
93
|
|
|
96
|
-
it('should
|
|
94
|
+
it('should link the imports operation element to its view in a new window', () => {
|
|
97
95
|
// When I visit some page and there are running operations.
|
|
98
96
|
GlobalOperationsStatusesStub.stubGlobalOperationsStatusesResponse(repositoryId);
|
|
99
97
|
HomeSteps.visitAndWaitLoader();
|
|
@@ -101,14 +99,13 @@ describe('Operations Status Component', () => {
|
|
|
101
99
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
102
100
|
|
|
103
101
|
OperationsStatusesComponentSteps.openOperationStatusesDialog();
|
|
104
|
-
//
|
|
105
|
-
// Then I expect to be redirected to "Query and Update monitoring" view.
|
|
102
|
+
// Then I expect "Running imports" operation element to link to "Import" view in a new window.
|
|
106
103
|
checkOperationElementUrl('import', 2);
|
|
107
104
|
// Then I expect "Global Operations Component" to still be displayed.
|
|
108
105
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
109
106
|
});
|
|
110
107
|
|
|
111
|
-
it('should
|
|
108
|
+
it('should link the backup and restore operation element to its view in a new window', () => {
|
|
112
109
|
// When I visit some page and there are running operations.
|
|
113
110
|
GlobalOperationsStatusesStub.stubGlobalOperationsStatusesResponse(repositoryId);
|
|
114
111
|
HomeSteps.visitAndWaitLoader();
|
|
@@ -116,15 +113,14 @@ describe('Operations Status Component', () => {
|
|
|
116
113
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
117
114
|
|
|
118
115
|
OperationsStatusesComponentSteps.openOperationStatusesDialog();
|
|
119
|
-
//
|
|
120
|
-
// Then I expect to be redirected to "Backup and Restore" view.
|
|
116
|
+
// Then I expect "Creating backup" operation element to link to "Backup and Restore" view in a new window.
|
|
121
117
|
checkOperationElementUrl('monitor/backup-and-restore', 1);
|
|
122
118
|
// Then I expect "Global Operations Component" to still be displayed.
|
|
123
119
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
124
120
|
|
|
125
121
|
});
|
|
126
122
|
|
|
127
|
-
it('should
|
|
123
|
+
it('should link the cluster operation element to its view in a new window', () => {
|
|
128
124
|
// When I visit some page and there are running operations.
|
|
129
125
|
GlobalOperationsStatusesStub.stubGlobalOperationsStatusesResponse(repositoryId);
|
|
130
126
|
HomeSteps.visitAndWaitLoader();
|
|
@@ -132,8 +128,7 @@ describe('Operations Status Component', () => {
|
|
|
132
128
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
133
129
|
|
|
134
130
|
OperationsStatusesComponentSteps.openOperationStatusesDialog();
|
|
135
|
-
//
|
|
136
|
-
// Then I expect to be redirected to "Cluster Monitoring" view.
|
|
131
|
+
// Then I expect "Unavailable nodes" operation element to link to "Cluster Monitoring" view in a new window.
|
|
137
132
|
checkOperationElementUrl('cluster', 0);
|
|
138
133
|
// Then I expect "Global Operations Component" to still be displayed.
|
|
139
134
|
OperationsStatusesComponentSteps.getOperationsStatusesComponent().should('exist');
|
|
@@ -141,8 +136,9 @@ describe('Operations Status Component', () => {
|
|
|
141
136
|
});
|
|
142
137
|
|
|
143
138
|
function checkOperationElementUrl(expectedUrl, operationIndex = 0) {
|
|
144
|
-
BrowserStubs.
|
|
139
|
+
BrowserStubs.captureLinkClicks();
|
|
145
140
|
OperationsStatusesComponentSteps.getOperationStatuses().eq(operationIndex).click();
|
|
146
|
-
|
|
141
|
+
// The page must leave the click to the browser, which opens the link in a new window.
|
|
142
|
+
cy.get(BrowserStubs.LINK_CLICKS_ALIAS()).should('deep.equal', [{href: expectedUrl, target: '_blank', defaultPrevented: false}]);
|
|
147
143
|
}
|
|
148
144
|
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {GraphNavigatorSteps} from '../../steps/graph-navigator-steps.js';
|
|
2
|
+
import {RepositoryPickerListSteps} from '../../steps/repository-picker-list-steps.js';
|
|
3
|
+
import {RepositoriesStubs} from '../../stubs/repositories/repositories-stubs.js';
|
|
4
|
+
|
|
5
|
+
describe('Repository picker repository information', () => {
|
|
6
|
+
let runningRepositoryId;
|
|
7
|
+
let notRunningRepositoryId;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
runningRepositoryId = 'picker-tooltip-running-' + Date.now();
|
|
11
|
+
notRunningRepositoryId = 'picker-tooltip-not-running-' + Date.now();
|
|
12
|
+
cy.createRepository({id: runningRepositoryId});
|
|
13
|
+
cy.createRepository({id: notRunningRepositoryId});
|
|
14
|
+
// A new repository is not running. Requesting its size starts it.
|
|
15
|
+
cy.initializeRepository(runningRepositoryId);
|
|
16
|
+
RepositoriesStubs.spyGetRepositorySize(runningRepositoryId, 'runningRepositorySize');
|
|
17
|
+
RepositoriesStubs.spyGetRepositorySizeCalls(notRunningRepositoryId, 'notRunningRepositorySize');
|
|
18
|
+
// No repository is selected, so the view shows the repository picker with both repositories.
|
|
19
|
+
GraphNavigatorSteps.visit();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
cy.deleteRepository(runningRepositoryId);
|
|
24
|
+
cy.deleteRepository(notRunningRepositoryId);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should show the repository id and the statement counts of a running repository', () => {
|
|
28
|
+
// When I move the keyboard focus to a running repository in the picker
|
|
29
|
+
RepositoryPickerListSteps.focusRepository(runningRepositoryId);
|
|
30
|
+
|
|
31
|
+
// Then I expect the repository information to show the repository id
|
|
32
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('title').should('have.text', runningRepositoryId);
|
|
33
|
+
// And the statement counts, loaded from the server
|
|
34
|
+
cy.wait('@runningRepositorySize');
|
|
35
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('total').should('contain.text', 'Total statements');
|
|
36
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('explicit').should('be.visible');
|
|
37
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('inferred').should('be.visible');
|
|
38
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('expansion-ratio').should('be.visible');
|
|
39
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('inactive').should('not.exist');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should show that the statement counts are not available when the size request fails', () => {
|
|
43
|
+
// Given the server fails to return the size of the running repository
|
|
44
|
+
RepositoriesStubs.stubGetRepositorySizeError(runningRepositoryId, 'runningRepositorySizeError');
|
|
45
|
+
|
|
46
|
+
// When I move the keyboard focus to the running repository in the picker
|
|
47
|
+
RepositoryPickerListSteps.focusRepository(runningRepositoryId);
|
|
48
|
+
|
|
49
|
+
// Then I expect the repository information to show the repository id
|
|
50
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('title').should('have.text', runningRepositoryId);
|
|
51
|
+
// And, after the request has failed, that the statement counts are not available
|
|
52
|
+
cy.wait('@runningRepositorySizeError');
|
|
53
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('not-available')
|
|
54
|
+
.should('contain.text', 'Size info not available.');
|
|
55
|
+
// And neither the spinner nor the statement counts
|
|
56
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('loading').should('not.exist');
|
|
57
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('total').should('not.exist');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should show the activation message and not request the size of a repository that is not running', () => {
|
|
61
|
+
// When I move the keyboard focus to a repository that is not running in the picker
|
|
62
|
+
RepositoryPickerListSteps.focusRepository(notRunningRepositoryId);
|
|
63
|
+
|
|
64
|
+
// Then I expect the repository information to show the repository id and the activation message
|
|
65
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('title').should('have.text', notRunningRepositoryId);
|
|
66
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('inactive')
|
|
67
|
+
.should('contain.text', 'Activate the repository to view statement information');
|
|
68
|
+
RepositoryPickerListSteps.getRepositoryInfoPart('total').should('not.exist');
|
|
69
|
+
// And the size of the repository is not requested, because that would start the repository
|
|
70
|
+
cy.get('@notRunningRepositorySize').should('not.have.been.called');
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import HomeSteps from '../../steps/home-steps.js';
|
|
2
|
+
import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
|
|
3
|
+
import {RepositoriesStubs} from '../../stubs/repositories/repositories-stubs.js';
|
|
4
|
+
|
|
5
|
+
describe('Repository selector tooltip', () => {
|
|
6
|
+
let runningRepositoryId;
|
|
7
|
+
let notRunningRepositoryId;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
runningRepositoryId = 'selector-tooltip-running-' + Date.now();
|
|
11
|
+
notRunningRepositoryId = 'selector-tooltip-not-running-' + Date.now();
|
|
12
|
+
cy.createRepository({id: runningRepositoryId});
|
|
13
|
+
cy.createRepository({id: notRunningRepositoryId});
|
|
14
|
+
// A new repository is not running. Requesting its size starts it.
|
|
15
|
+
cy.initializeRepository(runningRepositoryId);
|
|
16
|
+
RepositoriesStubs.spyGetRepositorySize(runningRepositoryId, 'runningRepositorySize');
|
|
17
|
+
RepositoriesStubs.spyGetRepositorySizeCalls(notRunningRepositoryId, 'notRunningRepositorySize');
|
|
18
|
+
// No repository is selected, so both repositories are in the menu of the selector.
|
|
19
|
+
HomeSteps.visit();
|
|
20
|
+
RepositorySelectorSteps.openRepositorySelectors();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
cy.deleteRepository(runningRepositoryId);
|
|
25
|
+
cy.deleteRepository(notRunningRepositoryId);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should show the repository id and the statement counts of a running repository', () => {
|
|
29
|
+
// When I hover a running repository in the selector
|
|
30
|
+
RepositorySelectorSteps.hoverRepositoryItem(runningRepositoryId);
|
|
31
|
+
|
|
32
|
+
// Then I expect the tooltip to show the repository id
|
|
33
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('title').should('have.text', runningRepositoryId);
|
|
34
|
+
// And the statement counts, loaded from the server
|
|
35
|
+
cy.wait('@runningRepositorySize');
|
|
36
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('total').should('contain.text', 'Total statements');
|
|
37
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('explicit').should('be.visible');
|
|
38
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('inferred').should('be.visible');
|
|
39
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('expansion-ratio').should('be.visible');
|
|
40
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('inactive').should('not.exist');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should show the activation message and not request the size of a repository that is not running', () => {
|
|
44
|
+
// When I hover a repository that is not running in the selector
|
|
45
|
+
RepositorySelectorSteps.hoverRepositoryItem(notRunningRepositoryId);
|
|
46
|
+
|
|
47
|
+
// Then I expect the tooltip to show the repository id and the activation message
|
|
48
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('title').should('have.text', notRunningRepositoryId);
|
|
49
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('inactive')
|
|
50
|
+
.should('contain.text', 'Activate the repository to view statement information');
|
|
51
|
+
RepositorySelectorSteps.getRepositoryTooltipPart('total').should('not.exist');
|
|
52
|
+
// And the size of the repository is not requested, because that would start the repository
|
|
53
|
+
cy.get('@notRunningRepositorySize').should('not.have.been.called');
|
|
54
|
+
});
|
|
55
|
+
});
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphdb-workbench-tests",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-TR12",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "graphdb-workbench-tests",
|
|
9
|
-
"version": "4.0.0-
|
|
9
|
+
"version": "4.0.0-TR12",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@bahmutov/cypress-code-coverage": "^2.7.2",
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ export class CookieConsentBannerSteps {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
static getCookieConsentButton() {
|
|
7
|
-
return this.getCookieConsentBanner().find('
|
|
7
|
+
return this.getCookieConsentBanner().find('#accept-cookie-policy');
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
static giveCookieConsent() {
|
|
@@ -12,7 +12,7 @@ export class CookieConsentBannerSteps {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
static getCookiePolicyLink() {
|
|
15
|
-
return cy.get('
|
|
15
|
+
return cy.get('#cookie-policy-link');
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
static clickCookiePolicyLink() {
|
|
@@ -20,6 +20,10 @@ export class GraphNavigatorSteps extends BaseSteps {
|
|
|
20
20
|
cy.getQueryParam('uri').should('eq', uri);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
static verifyOnlyRepositoryParam(repositoryId) {
|
|
24
|
+
cy.location('search').should('eq', `?repositoryId=${repositoryId}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
static getComponent() {
|
|
24
28
|
return cy.get('graphwise-reactodia');
|
|
25
29
|
}
|
|
@@ -24,6 +24,22 @@ export class RepositoryPickerListSteps extends BaseSteps {
|
|
|
24
24
|
return this.getRepositoryRow(repositoryId).find(this.buildTestIdAttr('repository-picker-repository-location'));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
static getSelectRepositoryButton(repositoryId) {
|
|
28
|
+
return this.getRepositoryRow(repositoryId).find(this.buildTestIdAttr('repository-picker-select-btn'));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static focusRepository(repositoryId) {
|
|
32
|
+
this.getSelectRepositoryButton(repositoryId).focus();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static getRepositoryInfo() {
|
|
36
|
+
return cy.get('.repository-info-popover-content onto-repository-info');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static getRepositoryInfoPart(name) {
|
|
40
|
+
return this.getRepositoryInfo().find(this.buildTestIdAttr(`repository-info-${name}`));
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
static selectRepository(repositoryId) {
|
|
28
44
|
this.getRepositoryRow(repositoryId).click();
|
|
29
45
|
}
|
|
@@ -23,4 +23,20 @@ export class RepositorySelectorSteps {
|
|
|
23
23
|
static getSelectedRepository() {
|
|
24
24
|
return RepositorySelectorSteps.getRepositorySelectorDropdown().find('.active-repository');
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
static getRepositoryItem(repositoryId) {
|
|
28
|
+
return RepositorySelectorSteps.getRepositorySelectorButton(repositoryId).closest('.onto-dropdown-menu-item');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static hoverRepositoryItem(repositoryId) {
|
|
32
|
+
RepositorySelectorSteps.getRepositoryItem(repositoryId).realHover();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static getRepositoryTooltip() {
|
|
36
|
+
return cy.get('.onto-tooltip-box onto-repository-info');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static getRepositoryTooltipPart(name) {
|
|
40
|
+
return RepositorySelectorSteps.getRepositoryTooltip().find(`[data-test="repository-info-${name}"]`);
|
|
41
|
+
}
|
|
26
42
|
}
|
|
@@ -142,4 +142,12 @@ export class YasrSteps extends BaseSteps {
|
|
|
142
142
|
static toggleFullscreen() {
|
|
143
143
|
YasrSteps.getFullscreenButton().click();
|
|
144
144
|
}
|
|
145
|
+
|
|
146
|
+
static getGraphNavigatorButton() {
|
|
147
|
+
return YasrSteps.getYasr().find('.explore-graph-navigator');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static visualizeInGraphNavigator() {
|
|
151
|
+
YasrSteps.getGraphNavigatorButton().click();
|
|
152
|
+
}
|
|
145
153
|
}
|
package/stubs/browser-stubs.js
CHANGED
|
@@ -7,6 +7,10 @@ export class BrowserStubs {
|
|
|
7
7
|
return isDefinition ? 'navigateToUrl' : '@navigateToUrl';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
static LINK_CLICKS_ALIAS = (isDefinition = false) => {
|
|
11
|
+
return isDefinition ? 'linkClicks' : '@linkClicks';
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
static stubWindowOpen() {
|
|
11
15
|
cy.window().then((win) => {
|
|
12
16
|
cy.stub(win, 'open').as(BrowserStubs.WINDOW_OPEN_ALIAS(true))
|
|
@@ -18,4 +22,40 @@ export class BrowserStubs {
|
|
|
18
22
|
cy.spy(win.singleSpa, 'navigateToUrl').as(BrowserStubs.NAVIGATE_TO_URL_ALIAS(true))
|
|
19
23
|
})
|
|
20
24
|
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Checks what the browser would do with a clicked link, without following it.
|
|
28
|
+
*
|
|
29
|
+
* Use it for plain links (`<a href target="_blank">`) that the browser opens by itself. Such links do not call
|
|
30
|
+
* `window.open`, so {@link stubWindowOpen} cannot see them, and Cypress cannot follow a new window.
|
|
31
|
+
*
|
|
32
|
+
* For every clicked link it records:
|
|
33
|
+
* - `href`: the link address;
|
|
34
|
+
* - `target`: the link target, `_blank` for a new window;
|
|
35
|
+
* - `defaultPrevented`: `true` when the page handled the click itself, for example to navigate in the same window.
|
|
36
|
+
* The browser opens the link only when this is `false`.
|
|
37
|
+
*
|
|
38
|
+
* Then it stops the click, so the test stays on the same page.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* BrowserStubs.captureLinkClicks();
|
|
42
|
+
* cy.get('a.my-link').click();
|
|
43
|
+
* // The browser would open "cluster" in a new window.
|
|
44
|
+
* cy.get(BrowserStubs.LINK_CLICKS_ALIAS())
|
|
45
|
+
* .should('deep.equal', [{href: 'cluster', target: '_blank', defaultPrevented: false}]);
|
|
46
|
+
*/
|
|
47
|
+
static captureLinkClicks() {
|
|
48
|
+
cy.window().then((win) => {
|
|
49
|
+
const clicks = [];
|
|
50
|
+
win.document.addEventListener('click', (event) => {
|
|
51
|
+
const link = event.target.closest('a');
|
|
52
|
+
if (!link) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
clicks.push({href: link.getAttribute('href'), target: link.target, defaultPrevented: event.defaultPrevented});
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
});
|
|
58
|
+
cy.wrap(clicks).as(BrowserStubs.LINK_CLICKS_ALIAS(true));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
21
61
|
}
|
|
@@ -3,6 +3,14 @@ import {REPOSITORIES_URL} from '../../support/repository-commands';
|
|
|
3
3
|
import {GlobalOperationsStatusesStub} from '../global-operations-statuses-stub.js';
|
|
4
4
|
import repoTemplate from "../../fixtures/repo-template.json";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Returns the pattern that matches the request for the size of a repository, on any host and with any query.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} repositoryId The id of the repository.
|
|
10
|
+
* @return {string} The pattern.
|
|
11
|
+
*/
|
|
12
|
+
const getRepositorySizeUrl = (repositoryId) => `**${REPOSITORIES_URL}/${repositoryId}/size*`;
|
|
13
|
+
|
|
6
14
|
export class RepositoriesStubs extends Stubs {
|
|
7
15
|
static stubRepositories(withDelay = 0, fixture = '/repositories/get-repositories.json') {
|
|
8
16
|
RepositoriesStubs.stubGetQueryResponse('/rest/repositories/all', fixture, 'get-all-repositories', withDelay);
|
|
@@ -24,6 +32,38 @@ export class RepositoriesStubs extends Stubs {
|
|
|
24
32
|
cy.intercept(`GET`, `${REPOSITORIES_URL}/${id}?location=`).as('getRepository');
|
|
25
33
|
}
|
|
26
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Spies on the request for the size of a repository, without changing its response.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} repositoryId The id of the repository.
|
|
39
|
+
* @param {string} alias The alias of the request, to wait for it with <code>cy.wait('@alias')</code>.
|
|
40
|
+
*/
|
|
41
|
+
static spyGetRepositorySize(repositoryId, alias = 'getRepositorySize') {
|
|
42
|
+
cy.intercept('GET', getRepositorySizeUrl(repositoryId)).as(alias);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Records the requests for the size of a repository in a spy, without changing their response. Use it to check
|
|
47
|
+
* that the size was not requested: <code>cy.get('@alias').should('not.have.been.called')</code>.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} repositoryId The id of the repository.
|
|
50
|
+
* @param {string} alias The alias of the spy.
|
|
51
|
+
*/
|
|
52
|
+
static spyGetRepositorySizeCalls(repositoryId, alias = 'getRepositorySizeCalls') {
|
|
53
|
+
cy.intercept('GET', getRepositorySizeUrl(repositoryId), cy.spy().as(alias));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Makes the request for the size of a repository fail with a server error.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} repositoryId The id of the repository.
|
|
60
|
+
* @param {string} alias The alias of the request, to wait for it with <code>cy.wait('@alias')</code>.
|
|
61
|
+
*/
|
|
62
|
+
static stubGetRepositorySizeError(repositoryId, alias = 'getRepositorySizeError') {
|
|
63
|
+
cy.intercept('GET', getRepositorySizeUrl(repositoryId),
|
|
64
|
+
{statusCode: 500, body: 'Internal Server Error'}).as(alias);
|
|
65
|
+
}
|
|
66
|
+
|
|
27
67
|
static stubLocations(withDelay = 0) {
|
|
28
68
|
RepositoriesStubs.stubQueryResponse('/rest/locations', '/repositories/get-locations.json', 'get-locations', withDelay);
|
|
29
69
|
}
|