graphdb-workbench-tests 3.5.0 → 4.0.0-reactodia-blank-nodes-TR1
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/cypress-guides.config.js +45 -0
- package/e2e-legacy/guides/ttyg/configure-agent/configure-agent-guide.spec.js +1 -2
- package/e2e-legacy/reactodia/reactodia.spec.js +122 -0
- package/e2e-legacy/resource/resource.spec.js +17 -4
- package/eslint.config.js +5 -0
- package/npm-shrinkwrap.json +5 -5
- package/package.json +3 -2
- package/steps/main-menu-steps.js +9 -0
- package/steps/reactodia-steps.js +42 -0
- package/steps/resource/resource-steps.js +8 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineConfig } from 'cypress';
|
|
2
|
+
import setupPlugins from './plugins/index.js';
|
|
3
|
+
|
|
4
|
+
const isCoverage = process.env.COVERAGE === 'true';
|
|
5
|
+
|
|
6
|
+
const loadCodeCoverage = async (on, config) => {
|
|
7
|
+
const mod = await import('@bahmutov/cypress-code-coverage/plugin');
|
|
8
|
+
const plugin = ('default' in mod) ? mod.default : mod;
|
|
9
|
+
plugin(on, config);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
projectId: 'v35btb',
|
|
14
|
+
fixturesFolder: 'fixtures',
|
|
15
|
+
screenshotsFolder: 'report/screenshots',
|
|
16
|
+
videosFolder: 'report/videos',
|
|
17
|
+
video: true,
|
|
18
|
+
defaultCommandTimeout: 25000,
|
|
19
|
+
numTestsKeptInMemory: 10,
|
|
20
|
+
viewportWidth: 1600,
|
|
21
|
+
viewportHeight: 1200,
|
|
22
|
+
e2e: {
|
|
23
|
+
retries: {
|
|
24
|
+
runMode: 2,
|
|
25
|
+
openMode: 0
|
|
26
|
+
},
|
|
27
|
+
async setupNodeEvents(on, config) {
|
|
28
|
+
setupPlugins(on, config);
|
|
29
|
+
if (isCoverage) {
|
|
30
|
+
await loadCodeCoverage(on, config);
|
|
31
|
+
}
|
|
32
|
+
return config;
|
|
33
|
+
},
|
|
34
|
+
baseUrl: 'http://localhost:9000',
|
|
35
|
+
specPattern: 'e2e-legacy/guides/**/*.{js,jsx,ts,tsx}',
|
|
36
|
+
supportFile: 'support/e2e.js',
|
|
37
|
+
reporter: "cypress-multi-reporters",
|
|
38
|
+
reporterOptions: {
|
|
39
|
+
configFile: 'cypress-reporter-config.json'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
env: {
|
|
43
|
+
set_default_user_data: true
|
|
44
|
+
}
|
|
45
|
+
});
|
|
@@ -9,8 +9,7 @@ import {GuidesStubs} from "../../../../stubs/guides/guides-stubs.js";
|
|
|
9
9
|
import {TTYGStubs} from "../../../../stubs/ttyg/ttyg-stubs.js";
|
|
10
10
|
import {RepositoriesStubs} from "../../../../stubs/repositories/repositories-stubs.js";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
describe.skip('ttyg configure agent guide', () => {
|
|
12
|
+
describe('ttyg configure agent guide', () => {
|
|
14
13
|
let repositoryId;
|
|
15
14
|
|
|
16
15
|
beforeEach(() => {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {ReactodiaSteps} from '../../steps/reactodia-steps.js';
|
|
2
|
+
import {LanguageSelectorSteps} from '../../steps/language-selector-steps.js';
|
|
3
|
+
import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
|
|
4
|
+
import {MainMenuSteps} from '../../steps/main-menu-steps.js';
|
|
5
|
+
|
|
6
|
+
const FILE_TO_IMPORT = 'resource-test-data.ttl';
|
|
7
|
+
const SEED_RESOURCE_ENCODED = 'http:%2F%2Fexample.com%2Fontology%23CustomerLoyalty';
|
|
8
|
+
const SEED_RESOURCE_LABEL = 'CustomerLoyalty';
|
|
9
|
+
|
|
10
|
+
const CONSTRUCT_QUERY = 'CONSTRUCT { <http://example.com/ontology#CustomerLoyalty> ?p ?o } WHERE { <http://example.com/ontology#CustomerLoyalty> ?p ?o }';
|
|
11
|
+
const CONSTRUCT_TARGET_LABEL = 'Metric';
|
|
12
|
+
|
|
13
|
+
describe('Reactodia graph explorer', () => {
|
|
14
|
+
let repositoryId;
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
repositoryId = 'repository-' + Date.now();
|
|
18
|
+
cy.createRepository({id: repositoryId});
|
|
19
|
+
cy.presetRepository(repositoryId);
|
|
20
|
+
cy.importServerFile(repositoryId, FILE_TO_IMPORT);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
cy.deleteRepository(repositoryId);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should mount the reactodia workspace when a repository is active', () => {
|
|
28
|
+
// Given I open the reactodia view without a start resource.
|
|
29
|
+
ReactodiaSteps.visit();
|
|
30
|
+
|
|
31
|
+
// Then I expect the reactodia workspace and its canvas to be rendered.
|
|
32
|
+
ReactodiaSteps.getWorkspace().should('exist');
|
|
33
|
+
ReactodiaSteps.getCanvas().should('exist');
|
|
34
|
+
|
|
35
|
+
// And I expect the canvas to start empty because no start resource was provided.
|
|
36
|
+
ReactodiaSteps.getElements().should('not.exist');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should place the start resource on the canvas as a seed', () => {
|
|
40
|
+
// Given I open the reactodia view with a start resource.
|
|
41
|
+
ReactodiaSteps.visit(SEED_RESOURCE_ENCODED);
|
|
42
|
+
|
|
43
|
+
// Then I expect the start resource to be placed on the canvas as a seed element.
|
|
44
|
+
ReactodiaSteps.getElements().should('have.length', 1);
|
|
45
|
+
ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should seed the canvas with the graph computed from a CONSTRUCT query', () => {
|
|
49
|
+
// Given I open the reactodia view with a CONSTRUCT query, as sent from the SPARQL editor.
|
|
50
|
+
ReactodiaSteps.visitWithQuery(CONSTRUCT_QUERY);
|
|
51
|
+
|
|
52
|
+
// Then I expect the computed graph to be seeded on the canvas: the subject and its related resource.
|
|
53
|
+
ReactodiaSteps.getElements().should('have.length', 2);
|
|
54
|
+
ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
|
|
55
|
+
ReactodiaSteps.getElement(CONSTRUCT_TARGET_LABEL).should('exist');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should keep the displayed resources when the language is switched', () => {
|
|
59
|
+
// Given the reactodia view is opened with a start resource that gets seeded on the canvas.
|
|
60
|
+
ReactodiaSteps.visit(SEED_RESOURCE_ENCODED);
|
|
61
|
+
ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
|
|
62
|
+
ReactodiaSteps.getElements().should('have.length', 1);
|
|
63
|
+
|
|
64
|
+
// When I switch the language.
|
|
65
|
+
LanguageSelectorSteps.switchToFr();
|
|
66
|
+
|
|
67
|
+
// Then I expect the same resources to remain visible because the layout is carried across the remount.
|
|
68
|
+
ReactodiaSteps.getElements().should('have.length', 1);
|
|
69
|
+
ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should keep the diagram on refresh but clear it when navigating away and back', () => {
|
|
73
|
+
// Given the reactodia view is opened with a start resource that gets seeded on the canvas.
|
|
74
|
+
ReactodiaSteps.visit(SEED_RESOURCE_ENCODED);
|
|
75
|
+
ReactodiaSteps.getElements().should('have.length', 1);
|
|
76
|
+
ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
|
|
77
|
+
|
|
78
|
+
// When I refresh the page.
|
|
79
|
+
cy.reload();
|
|
80
|
+
|
|
81
|
+
// Then I expect the diagram state to be preserved across the refresh.
|
|
82
|
+
ReactodiaSteps.getElements().should('have.length', 1);
|
|
83
|
+
ReactodiaSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
|
|
84
|
+
|
|
85
|
+
// When I navigate to another view via the navigation bar.
|
|
86
|
+
MainMenuSteps.clickOnSparqlMenu();
|
|
87
|
+
ReactodiaSteps.getComponent().should('not.exist');
|
|
88
|
+
|
|
89
|
+
// And I return to the reactodia view via the navigation bar.
|
|
90
|
+
MainMenuSteps.clickOnReactodia();
|
|
91
|
+
|
|
92
|
+
// Then I expect the canvas to be cleared, because leaving the view drops the persisted diagram state.
|
|
93
|
+
ReactodiaSteps.getWorkspace().should('exist');
|
|
94
|
+
ReactodiaSteps.getElements().should('not.exist');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe('Repository switch', () => {
|
|
98
|
+
let secondRepositoryId;
|
|
99
|
+
|
|
100
|
+
beforeEach(() => {
|
|
101
|
+
secondRepositoryId = 'repository-second-' + Date.now();
|
|
102
|
+
cy.createRepository({id: secondRepositoryId});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
afterEach(() => {
|
|
106
|
+
cy.deleteRepository(secondRepositoryId);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should clear the canvas when the repository is switched', () => {
|
|
110
|
+
// Given the reactodia view is opened with a start resource that gets seeded on the canvas.
|
|
111
|
+
ReactodiaSteps.visit(SEED_RESOURCE_ENCODED);
|
|
112
|
+
ReactodiaSteps.getElements().should('have.length', 1);
|
|
113
|
+
|
|
114
|
+
// When I switch to another repository.
|
|
115
|
+
RepositorySelectorSteps.selectRepository(secondRepositoryId);
|
|
116
|
+
|
|
117
|
+
// Then I expect the workspace to still be mounted, but the canvas to be cleared.
|
|
118
|
+
ReactodiaSteps.getWorkspace().should('exist');
|
|
119
|
+
ReactodiaSteps.getElements().should('not.exist');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -9,6 +9,7 @@ import {YasguiSteps} from "../../steps/yasgui/yasgui-steps";
|
|
|
9
9
|
import {JsonLdModalSteps} from "../../steps/json-ld-modal-steps";
|
|
10
10
|
import {GraphConfigStubs} from '../../stubs/graph-config-stubs.js';
|
|
11
11
|
import {VisualGraphSplitButtonSteps} from '../../steps/visual-graph-split-button-steps.js';
|
|
12
|
+
import {ReactodiaSteps} from '../../steps/reactodia-steps.js';
|
|
12
13
|
|
|
13
14
|
const FILE_TO_IMPORT = 'resource-test-data.ttl';
|
|
14
15
|
const SUBJECT_RESOURCE_ENCODED = 'http:%2F%2Fexample.com%2Fontology%23CustomerLoyalty';
|
|
@@ -75,6 +76,18 @@ describe('Resource view', () => {
|
|
|
75
76
|
VisualGraphSteps.verifyUrl();
|
|
76
77
|
});
|
|
77
78
|
|
|
79
|
+
it('should open reactodia view when click on the "Visualize Reactodia" button', () => {
|
|
80
|
+
// When I am on resource view and page loaded a resource.
|
|
81
|
+
ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}`);
|
|
82
|
+
|
|
83
|
+
// When I click on "Visualize Reactodia" button.
|
|
84
|
+
ResourceSteps.clickOnVisualizeReactodiaButton();
|
|
85
|
+
|
|
86
|
+
// Then I expect to be redirected to the reactodia view with the resource as the start uri.
|
|
87
|
+
ReactodiaSteps.verifyUrl();
|
|
88
|
+
ReactodiaSteps.verifyStartResourceUri(SUBJECT_RESOURCE);
|
|
89
|
+
});
|
|
90
|
+
|
|
78
91
|
it('should open graphs-visualizations view when select a graph configuration', () => {
|
|
79
92
|
// When I am on resource view and page loaded a resource.
|
|
80
93
|
ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}&role=subject`);
|
|
@@ -120,7 +133,7 @@ describe('Resource view', () => {
|
|
|
120
133
|
YasrSteps.getResults().should('have.length', 24);
|
|
121
134
|
});
|
|
122
135
|
|
|
123
|
-
|
|
136
|
+
describe('Same as', () => {
|
|
124
137
|
|
|
125
138
|
it('should display sameAs button when is enabled by user settings', () => {
|
|
126
139
|
// When I am on resource view and page loaded a resource that has triplets in explicit and implicit context,
|
|
@@ -190,7 +203,7 @@ describe('Resource view', () => {
|
|
|
190
203
|
});
|
|
191
204
|
});
|
|
192
205
|
|
|
193
|
-
|
|
206
|
+
describe('Role tabs', () => {
|
|
194
207
|
|
|
195
208
|
it('should list the triples of a resource used as subject', () => {
|
|
196
209
|
// When I am on resource view,
|
|
@@ -342,7 +355,7 @@ describe('Resource view', () => {
|
|
|
342
355
|
});
|
|
343
356
|
});
|
|
344
357
|
|
|
345
|
-
|
|
358
|
+
describe('Triple resource', () => {
|
|
346
359
|
it('should show triple resource', () => {
|
|
347
360
|
// When I visit resource view with triple resource.
|
|
348
361
|
ResourceSteps.visit(`triple=${TRIPLE_RESOURCE}&role=subject`);
|
|
@@ -381,7 +394,7 @@ describe('Resource view', () => {
|
|
|
381
394
|
});
|
|
382
395
|
});
|
|
383
396
|
|
|
384
|
-
|
|
397
|
+
describe('Download as', () => {
|
|
385
398
|
it('should download as JSON-LD and then restore defaults', () => {
|
|
386
399
|
// Given I am in the Resource view
|
|
387
400
|
ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}&role=subject`);
|
package/eslint.config.js
CHANGED
|
@@ -35,6 +35,11 @@ export default [
|
|
|
35
35
|
rules: {
|
|
36
36
|
...pluginJs.configs.recommended.rules,
|
|
37
37
|
...pluginCypress.configs.recommended.rules,
|
|
38
|
+
// Exclusive tests (.only) silently skip the rest of the suite, so they must never be committed.
|
|
39
|
+
'no-restricted-syntax': ['error', {
|
|
40
|
+
selector: "MemberExpression[computed=false][property.name='only'][object.name=/^(describe|context|it|specify|test|suite)$/]",
|
|
41
|
+
message: 'Exclusive tests are not allowed: remove ".only" before committing.'
|
|
42
|
+
}],
|
|
38
43
|
},
|
|
39
44
|
},
|
|
40
45
|
];
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphdb-workbench-tests",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-reactodia-blank-nodes-TR1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "graphdb-workbench-tests",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "4.0.0-reactodia-blank-nodes-TR1",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@bahmutov/cypress-code-coverage": "^2.7.2",
|
|
@@ -5407,9 +5407,9 @@
|
|
|
5407
5407
|
"license": "MIT"
|
|
5408
5408
|
},
|
|
5409
5409
|
"node_modules/fast-uri": {
|
|
5410
|
-
"version": "3.1.
|
|
5411
|
-
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.
|
|
5412
|
-
"integrity": "sha512-
|
|
5410
|
+
"version": "3.1.5",
|
|
5411
|
+
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz",
|
|
5412
|
+
"integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==",
|
|
5413
5413
|
"dev": true,
|
|
5414
5414
|
"funding": [
|
|
5415
5415
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphdb-workbench-tests",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-reactodia-blank-nodes-TR1",
|
|
4
4
|
"description": "Cypress tests for GraphDB workbench",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"cy:open-legacy": "cypress open --config-file cypress-legacy.config.js",
|
|
11
11
|
"cy:open-security": "cypress open --config-file cypress-security.config.js",
|
|
12
12
|
"cy:open-flaky": "cypress open --config-file cypress-flaky.config.js",
|
|
13
|
-
"cy:guides": "cypress
|
|
13
|
+
"cy:open-guides": "cypress open --config-file cypress-guides.config.js",
|
|
14
|
+
"cy:run-guides": "cypress run --config-file cypress-guides.config.js",
|
|
14
15
|
"cy:run": "npm run cy:run-legacy && cypress run",
|
|
15
16
|
"cy:run:partial": "cypress run --config-file cypress-legacy.config.js --spec \"e2e-legacy/ttyg/**/*.spec.js\" --browser chrome",
|
|
16
17
|
"cy:run-legacy": "cypress run --config-file cypress-legacy.config.js --browser chrome",
|
package/steps/main-menu-steps.js
CHANGED
|
@@ -107,6 +107,15 @@ export class MainMenuSteps {
|
|
|
107
107
|
this.getSubMenuButton('sub-menu-visual-graph').click();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
static clickOnReactodia() {
|
|
111
|
+
this.clickOnExplore();
|
|
112
|
+
this.clickOnSubmenuReactodia();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
static clickOnSubmenuReactodia() {
|
|
116
|
+
this.getSubMenuButton('menu-reactodia').click();
|
|
117
|
+
}
|
|
118
|
+
|
|
110
119
|
static clickOnClassRelationships() {
|
|
111
120
|
this.clickOnExplore();
|
|
112
121
|
this.clickOnSubmenuClassRelationships();
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {BaseSteps} from "./base-steps.js";
|
|
2
|
+
|
|
3
|
+
const VIEW_URL = '/reactodia';
|
|
4
|
+
|
|
5
|
+
export class ReactodiaSteps extends BaseSteps {
|
|
6
|
+
|
|
7
|
+
static visit(uri) {
|
|
8
|
+
cy.visit(`${VIEW_URL}${uri ? ('?uri=' + uri) : ''}`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static visitWithQuery(query, {inference = false, sameAs = false} = {}) {
|
|
12
|
+
cy.visit(`${VIEW_URL}?query=${encodeURIComponent(query)}&inference=${inference}&sameAs=${sameAs}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static verifyUrl() {
|
|
16
|
+
this.validateUrl(`${Cypress.config('baseUrl')}${VIEW_URL}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static verifyStartResourceUri(uri) {
|
|
20
|
+
cy.getQueryParam('uri').should('eq', uri);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getComponent() {
|
|
24
|
+
return cy.get('graphwise-reactodia');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static getWorkspace() {
|
|
28
|
+
return ReactodiaSteps.getComponent().find('.reactodia-workspace');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static getCanvas() {
|
|
32
|
+
return ReactodiaSteps.getComponent().find('.reactodia-canvas');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static getElements() {
|
|
36
|
+
return ReactodiaSteps.getCanvas().find('[data-element-id]');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static getElement(text) {
|
|
40
|
+
return ReactodiaSteps.getCanvas().find(`[data-element-id]`).contains(text).first();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -147,4 +147,12 @@ export class ResourceSteps {
|
|
|
147
147
|
static getDataTable() {
|
|
148
148
|
return cy.get('.dataTable');
|
|
149
149
|
}
|
|
150
|
+
|
|
151
|
+
static getVisualizeReactodiaButton() {
|
|
152
|
+
return cy.getByTestId('visualize-reactodia-button');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static clickOnVisualizeReactodiaButton() {
|
|
156
|
+
ResourceSteps.getVisualizeReactodiaButton().click();
|
|
157
|
+
}
|
|
150
158
|
}
|