graphdb-workbench-tests 2.8.4 → 3.0.0-NEW-JENKINS-1

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.
Files changed (76) hide show
  1. package/fixtures/graph/rdf.txt +130 -0
  2. package/fixtures/graphdb-import/ontology-and-shapes.ttl +562 -0
  3. package/fixtures/graphdb-import/swapi-dataset.ttl +4393 -0
  4. package/fixtures/graphql/endpoints/graphql-endpoints-info.json +49 -0
  5. package/fixtures/graphql/endpoints/no-graphql-endpoints-info.json +3 -0
  6. package/fixtures/graphql/soml/big-swapi-schema-broken.yaml +83167 -0
  7. package/fixtures/graphql/soml/swapi-schema-broken.yaml +880 -0
  8. package/fixtures/graphql/soml/swapi-schema-broken.zip +0 -0
  9. package/fixtures/graphql/soml/swapi-schema-film-restricted.yaml +335 -0
  10. package/fixtures/graphql/soml/swapi-schema-planets.yaml +51 -0
  11. package/fixtures/graphql/soml/swapi-schema-species.yaml +66 -0
  12. package/fixtures/graphql/soml/swapi-schema.yaml +857 -0
  13. package/fixtures/graphql/soml/swapi-schemas.zip +0 -0
  14. package/fixtures/locale-en.json +666 -37
  15. package/fixtures/ttyg/agent/get-agent-list-autocomplete-query.json +23 -0
  16. package/fixtures/ttyg/autocomplete-response.json +154 -0
  17. package/integration/explore/class.hierarchy.spec.js +131 -184
  18. package/integration/explore/graphs.overview.spec.js +18 -10
  19. package/integration/explore/visual-graph/graphs-config.spec.js +17 -1
  20. package/integration/explore/visual-graph/visual-graph-node-labels.spec.js +68 -0
  21. package/integration/graphql/activate-deactivate-graphql-endpoint.spec.js +40 -0
  22. package/integration/graphql/create-graphql-endpoint.spec.js +281 -0
  23. package/integration/graphql/delete-graphql-endpoint.spec.js +46 -0
  24. package/integration/graphql/edit-graphql-enpoint.spec.js +160 -0
  25. package/integration/graphql/export-graphql-endpoint-definition.spec.js +35 -0
  26. package/integration/graphql/filter-graphql-endpoints-on-management-view.spec.js +66 -0
  27. package/integration/graphql/graphql-endpoint-management-view.spec.js +142 -0
  28. package/integration/graphql/graphql-playground.spec.js +110 -0
  29. package/integration/graphql/import-graphql-endpoint-definitions.spec.js +269 -0
  30. package/integration/graphql/set-default-graphql-endpoint.spec.js +42 -0
  31. package/integration/import/import-server-files-batch-operations.spec.js +4 -3
  32. package/integration/import/import-server-files.spec.js +29 -7
  33. package/integration/import/import-user-data-url.spec.js +33 -0
  34. package/integration/import/import-view.spec.js +2 -1
  35. package/integration/repository/repositories.spec.js +9 -4
  36. package/integration/setup/user-and-access.spec.js +695 -117
  37. package/integration/sparql-editor/actions/show-saved-queries.spec.js +1 -1
  38. package/integration/sparql-editor/saved-query/readonly-query.spec.js +66 -0
  39. package/integration/ttyg/edit-agent.spec.js +45 -0
  40. package/integration-flaky/setup/users-and-access/security-and-free-access.spec.js +54 -0
  41. package/{integration → integration-flaky}/ttyg/ttyg-permission.spec.js +4 -3
  42. package/npm-shrinkwrap.json +931 -305
  43. package/package.json +3 -3
  44. package/steps/class-views-steps.js +139 -0
  45. package/steps/explore/graphs-overview-steps.js +12 -0
  46. package/steps/graphql/create-graphql-endpoint-steps.js +277 -0
  47. package/steps/graphql/edit-graphql-endpoint-steps.js +124 -0
  48. package/steps/graphql/generation-report-modal-steps.js +34 -0
  49. package/steps/graphql/graphiql-editor-tools-steps.js +10 -0
  50. package/steps/graphql/graphiql-playground-steps.js +6 -0
  51. package/steps/graphql/graphql-endpoint-management-steps.js +147 -0
  52. package/steps/graphql/graphql-playground-steps.js +90 -0
  53. package/steps/graphql/import-endpoint-definition-modal-steps.js +80 -0
  54. package/steps/home-steps.js +1 -1
  55. package/steps/import/import-settings-dialog-steps.js +12 -0
  56. package/steps/import/import-steps.js +9 -4
  57. package/steps/import/import-test-constants.js +1 -0
  58. package/steps/import/import-user-data-steps.js +8 -0
  59. package/steps/login-steps.js +20 -0
  60. package/steps/modal-dialog-steps.js +8 -0
  61. package/steps/repository-steps.js +4 -0
  62. package/steps/setup/user-and-access-steps.js +165 -11
  63. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +44 -0
  64. package/steps/visual-graph-steps.js +14 -0
  65. package/steps/yasgui/saved-queries-dialog.js +19 -3
  66. package/stubs/global-operations-statuses-stub.js +2 -2
  67. package/stubs/graphql/graphql-stubs.js +146 -0
  68. package/stubs/repositories/repositories-stubs.js +4 -0
  69. package/stubs/ttyg/ttyg-stubs.js +7 -0
  70. package/stubs/yasgui/query-stubs.js +2 -2
  71. package/support/import-commands.js +28 -0
  72. package/support/repository-commands.js +10 -3
  73. package/support/security-command.js +49 -8
  74. package/support/user-commands.js +10 -2
  75. package/utils/html-util.js +21 -0
  76. /package/fixtures/{graphql-editor → queries}/default-query-response.json +0 -0
@@ -0,0 +1,23 @@
1
+ [
2
+ {
3
+ "id": "asst_G8EtHyT8kAGeDmCa3Nh6y74v",
4
+ "name": "Test autocomplete extraction agent",
5
+ "model": "gpt-4o",
6
+ "temperature": 0.7,
7
+ "topP": 1.0,
8
+ "repositoryId": "starwars",
9
+ "instructions": {
10
+ "systemInstruction": null,
11
+ "userInstruction": null
12
+ },
13
+ "assistantExtractionMethods": [
14
+ {
15
+ "method": "sparql_search",
16
+ "ontologyGraph": null,
17
+ "sparqlQuery": "CONSTRUCT {\n ?s ?p ?o\n} WHERE {\n GRAPH <http://example.com/sw-ont> {\n ?s ?p ?o\n }\n}",
18
+ "addMissingNamespaces": false
19
+ }
20
+ ],
21
+ "additionalExtractionMethods": []
22
+ }
23
+ ]
@@ -0,0 +1,154 @@
1
+ {
2
+ "suggestions": [
3
+ {
4
+ "type": "prefix",
5
+ "value": "rep",
6
+ "description": "PREFIX <b>re</b>p: &lt;http://www.openrdf.org/config/repository#&gt;"
7
+ },
8
+ {
9
+ "type": "uri",
10
+ "value": "http://www.w3.org/2006/vcard/ns#rev",
11
+ "description": "http://www.w3.org/2006/vcard/ns#<b>re</b>v"
12
+ },
13
+ {
14
+ "type": "uri",
15
+ "value": "https://swapi.co/resource/human/85",
16
+ "description": "<b>Re</b>y &lt;https://swapi.co/resource/human/85&gt;"
17
+ },
18
+ {
19
+ "type": "uri",
20
+ "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",
21
+ "description": "http://www.w3.org/1999/02/22-rdf-syntax-ns#<b>re</b>st"
22
+ },
23
+ {
24
+ "type": "uri",
25
+ "value": "http://www.w3.org/ns/odrl/2/read",
26
+ "description": "http://www.w3.org/ns/odrl/2/<b>re</b>ad"
27
+ },
28
+ {
29
+ "type": "uri",
30
+ "value": "http://spinrdf.org/sp#regex",
31
+ "description": "http://spinrdf.org/sp#<b>re</b>gex"
32
+ },
33
+ {
34
+ "type": "uri",
35
+ "value": "http://www.w3.org/ns/shacl#result",
36
+ "description": "http://www.w3.org/ns/shacl#<b>re</b>sult"
37
+ },
38
+ {
39
+ "type": "uri",
40
+ "value": "http://www.w3.org/ns/earl#result",
41
+ "description": "http://www.w3.org/ns/earl#<b>re</b>sult"
42
+ },
43
+ {
44
+ "type": "uri",
45
+ "value": "http://www.w3.org/ns/odrl/2/remedy",
46
+ "description": "http://www.w3.org/ns/odrl/2/<b>re</b>medy"
47
+ },
48
+ {
49
+ "type": "uri",
50
+ "value": "http://www.opengis.net/def/function/geosparql/relate",
51
+ "description": "http://www.opengis.net/def/function/geosparql/<b>re</b>late"
52
+ },
53
+ {
54
+ "type": "uri",
55
+ "value": "http://www.w3.org/2006/vcard/ns#region",
56
+ "description": "http://www.w3.org/2006/vcard/ns#<b>re</b>gion"
57
+ },
58
+ {
59
+ "type": "uri",
60
+ "value": "http://www.w3.org/ns/dcat#record",
61
+ "description": "http://www.w3.org/ns/dcat#<b>re</b>cord"
62
+ },
63
+ {
64
+ "type": "uri",
65
+ "value": "http://www.w3.org/ns/hydra/core#returns",
66
+ "description": "http://www.w3.org/ns/hydra/core#<b>re</b>turns"
67
+ },
68
+ {
69
+ "type": "uri",
70
+ "value": "http://www.w3.org/2005/xpath-functions#replace",
71
+ "description": "http://www.w3.org/2005/xpath-functions#<b>re</b>place"
72
+ },
73
+ {
74
+ "type": "uri",
75
+ "value": "http://usefulinc.com/ns/doap#release",
76
+ "description": "http://usefulinc.com/ns/doap#<b>re</b>lease"
77
+ },
78
+ {
79
+ "type": "uri",
80
+ "value": "http://www.w3.org/2004/02/skos/core#related",
81
+ "description": "http://www.w3.org/2004/02/skos/core#<b>re</b>lated"
82
+ },
83
+ {
84
+ "type": "uri",
85
+ "value": "http://spinrdf.org/sp#reduced",
86
+ "description": "http://spinrdf.org/sp#<b>re</b>duced"
87
+ },
88
+ {
89
+ "type": "uri",
90
+ "value": "http://www.w3.org/ns/odrl/2/Request",
91
+ "description": "http://www.w3.org/ns/odrl/2/<b>Re</b>quest"
92
+ },
93
+ {
94
+ "type": "uri",
95
+ "value": "https://swapi.co/vocabulary/Reptile",
96
+ "description": "https://swapi.co/vocabulary/<b>Re</b>ptile"
97
+ },
98
+ {
99
+ "type": "uri",
100
+ "value": "http://www.w3.org/ns/prov#Replace",
101
+ "description": "http://www.w3.org/ns/prov#<b>Re</b>place"
102
+ },
103
+ {
104
+ "type": "uri",
105
+ "value": "http://www.w3.org/ns/prov#Removal",
106
+ "description": "http://www.w3.org/ns/prov#<b>Re</b>moval"
107
+ },
108
+ {
109
+ "type": "uri",
110
+ "value": "http://usefulinc.com/ns/doap#revision",
111
+ "description": "http://usefulinc.com/ns/doap#<b>re</b>vision"
112
+ },
113
+ {
114
+ "type": "uri",
115
+ "value": "https://swapi.co/vocabulary/resident",
116
+ "description": "https://swapi.co/vocabulary/<b>re</b>sident"
117
+ },
118
+ {
119
+ "type": "uri",
120
+ "value": "http://purl.org/dc/terms/requires",
121
+ "description": "http://purl.org/dc/terms/<b>re</b>quires"
122
+ },
123
+ {
124
+ "type": "uri",
125
+ "value": "http://www.w3.org/ns/hydra/core#required",
126
+ "description": "http://www.w3.org/ns/hydra/core#<b>re</b>quired"
127
+ },
128
+ {
129
+ "type": "uri",
130
+ "value": "http://purl.org/dc/terms/replaces",
131
+ "description": "http://purl.org/dc/terms/<b>re</b>places"
132
+ },
133
+ {
134
+ "type": "uri",
135
+ "value": "http://www.w3.org/ns/odrl/2/relation",
136
+ "description": "http://www.w3.org/ns/odrl/2/<b>re</b>lation"
137
+ },
138
+ {
139
+ "type": "uri",
140
+ "value": "http://purl.org/dc/terms/relation",
141
+ "description": "http://purl.org/dc/terms/<b>re</b>lation"
142
+ },
143
+ {
144
+ "type": "uri",
145
+ "value": "http://purl.org/dc/elements/1.1/relation",
146
+ "description": "http://purl.org/dc/elements/1.1/<b>re</b>lation"
147
+ },
148
+ {
149
+ "type": "uri",
150
+ "value": "http://www.w3.org/ns/hydra/core#readable",
151
+ "description": "http://www.w3.org/ns/hydra/core#<b>re</b>adable"
152
+ }
153
+ ]
154
+ }
@@ -2,8 +2,6 @@ import ClassViewsSteps, {ALL_GRAPHS, GRAPH_FILE, NEWS_GRAPH} from "../../steps/c
2
2
 
3
3
  const INITIAL_CLASS_COUNT = 50;
4
4
  const CLASS_COUNT_OF_NEWS_GRAPH = 35;
5
- const SEARCH_INPUT_DROPDOWN_ID = '#search_input_dropdown';
6
- const CLASS_LABEL_SELECTOR = '#main-group > text.label';
7
5
  const FILE_TO_IMPORT = 'wine.rdf';
8
6
  const CLASS_HIERARCHY = 'class hierarchy';
9
7
 
@@ -14,253 +12,202 @@ describe('Class hierarchy screen validation', () => {
14
12
  repositoryId = 'repo' + Date.now();
15
13
  cy.createRepository({id: repositoryId});
16
14
  cy.presetRepository(repositoryId);
17
-
18
15
  cy.importServerFile(repositoryId, FILE_TO_IMPORT);
19
-
20
- cy.visit('/hierarchy');
21
- cy.window();
22
- // Wait for the chart and diagram to be visible, also check if a class is displayed.
23
- cy.get('#classChart').scrollIntoView().should('be.visible').within(() => {
24
- cy.get('#main-group').scrollIntoView().should('be.visible');
25
- findClassByName('food:Grape');
26
- cy.get('@classInHierarchy').scrollIntoView().should('be.visible');
27
- });
16
+ ClassViewsSteps.visit();
17
+ ClassViewsSteps.waitForPageLoad();
28
18
  });
29
19
 
30
20
  afterEach(() => {
31
21
  cy.deleteRepository(repositoryId);
32
22
  });
33
23
 
34
- it('Test initial state of the diagram has a class count 50', () => {
24
+ it('should have an initial state of the diagram with a class count of 50', () => {
35
25
  verifyCounterValue(INITIAL_CLASS_COUNT);
36
26
  });
37
27
 
38
- it('Test show/hide prefixes', () => {
39
- // Verify that switching on/off Show/hide prefixes is reflected on the diagram -
40
- // prefixes are displayed/hidden
28
+ it('should show/hide prefixes', () => {
29
+ // Given I verify that switching on/off Show/hide prefixes is reflected on the diagram - prefixes are displayed/hidden
41
30
  verifyPrefixes(($element) => cy.wrap($element.text()).should('contain', ':'));
42
31
 
43
32
  // Because some of the labels are truncated and is not guaranteed,
44
33
  // that after calling cy.get labels will be in the same order,
45
34
  // get the initial value of 'Chardonnay' label's text
46
- cy.get(CLASS_LABEL_SELECTOR).contains('Chardonnay').then($initialVal => {
47
- // Switch show prefixes to off
48
- cy.get('.toolbar-holder')
49
- .find('.prefix-toggle-btn')
50
- .scrollIntoView()
51
- .should('be.visible')
52
- .click()
53
- .then(() => {
54
- // Because of the timeout of 50 milliseconds after which the redraw of the prefixes happens
55
- // and we would like to validate successful removal, wait until the value of the 'Chardonnay'
56
- // label has changed. If not the test will fail
57
- cy.waitUntil(() =>
58
- cy.get(CLASS_LABEL_SELECTOR).contains('Chardonnay')
59
- .then($newVal =>
60
- $newVal.text() !== $initialVal.text()));
61
- // Verify that prefixes are removed from diagram
62
- verifyPrefixes(($element) => cy.wrap($element.text()).should('not.contain', ':'));
35
+ // When I get the initial value of 'Chardonnay' label's text
36
+ ClassViewsSteps.getMainGroupTextLabel()
37
+ .contains('Chardonnay')
38
+ .invoke('text')
39
+ .then((initialVal) => {
40
+ // When I switch "show prefixes" to off
41
+ ClassViewsSteps.getToolbarPrefixToggleButton()
42
+ .scrollIntoView()
43
+ .should('be.visible');
44
+ // Then I toggle the prefixes
45
+ ClassViewsSteps.clickPrefixToggleButton();
46
+ // Then I wait until the value of the 'Chardonnay' label has changed
47
+ ClassViewsSteps.getMainGroupTextLabel()
48
+ .contains('Chardonnay')
49
+ .invoke('text')
50
+ .should((newVal) => {
51
+ expect(newVal).not.to.equal(initialVal);
52
+ });
53
+ // Then I verify that prefixes are removed from diagram
54
+ verifyPrefixes(($element) => {
55
+ cy.wrap($element.text()).should('not.contain', ':');
63
56
  });
64
- });
57
+ });
65
58
  });
66
59
 
67
- it('Test focus on diagram', () => {
68
- // This must not be a top-level class and it must have no children,
69
- // otherwise asserting the zooming becomes tricky
70
- let className = ':SweetRiesling';
71
- findClassByName(className);
72
- cy.get('@classInHierarchy').then(verifyClassIsNotExpanded);
73
-
74
- // Verify that the diagram zooms that class
60
+ it('should focus on diagram', () => {
61
+ // This must not be a top-level class, and it must have no children, otherwise asserting the zooming becomes tricky
62
+ const className = ':SweetRiesling';
63
+ // Given the class is not expanded
64
+ verifyClassFocus(className, false);
65
+ // When I search for a class
75
66
  searchForClass(className);
76
-
77
- // Verify font-size is changed
78
- findClassByName(className);
79
- cy.get('@classInHierarchy').then(verifyClassIsExpanded);
80
-
81
- // When a class is focused in diagram a side panel is opened on the right and covers the
82
- // buttons toolbar.
83
- cy.get('[ps-class=rdf-info-side-panel] .close').click()
84
- .should('not.be.visible');
85
- cy.get('.toolbar-holder .focus-diagram-btn').click();
86
-
87
- // Verify that the diagram zooms out without resetting the class count.
88
- findClassByName(className);
89
- cy.get('@classInHierarchy').then(verifyClassIsNotExpanded);
67
+ // Then I expect the class to become expanded
68
+ verifyClassFocus(className, true);
69
+ // When a class is focused in diagram a side panel is opened on the right and covers the buttons toolbar
70
+ ClassViewsSteps.closeInfoSidePanel();
71
+ // Then I close the side panel
72
+ ClassViewsSteps.getInfoSidePanelCloseButton().should('not.be.visible');
73
+ // Then I focus the diagram
74
+ ClassViewsSteps.focusDiagram();
75
+ // Then I verify that the diagram zooms out, without resetting the class count
76
+ ClassViewsSteps.findClassByName(className);
77
+ ClassViewsSteps.getClassInHierarchy().then(verifyClassIsNotExpanded);
90
78
  });
91
79
 
92
- it('Test reload diagram', () => {
93
- // Initial class count is 50
94
- // Change the class count to a custom value
95
- cy.get('.class-cnt-slider > .ng-isolate-scope').trigger('click', 'center');
96
-
97
- // Reload diagram
98
- ClassViewsSteps.reloadDiagram();
99
-
100
- // Verify that warning message appears
101
- ClassViewsSteps.confirmReloadWarningAppear(CLASS_HIERARCHY);
102
-
103
- // Confirm diagram reloading
104
- ClassViewsSteps.confirmReload();
105
-
106
- // Verify that the diagram zooms out and the class count is reset
107
- verifyCounterValue(INITIAL_CLASS_COUNT);
80
+ it('should reload diagram', () => {
81
+ // Given I change the initial class count (50) to a custom value
82
+ ClassViewsSteps.positionSlider('center');
83
+ // Then I confirm the diagram has reloaded
84
+ reloadDiagramAndVerify(INITIAL_CLASS_COUNT);
108
85
  });
109
86
 
110
- it('Test export diagram', () => {
111
- // TODO: Verify that there aren't issues with this approach as there is no guarantee that the click will happen after mouseover event!
112
- // Eventually file an issue for refactoring.
113
- cy.get('#download-svg')
114
- .then(($element) => {
115
- let href = $element.prop('href');
116
- // Verify that a svg with the current diagram state is saved on your hdd.
117
- expect(href).to.contain(Cypress.config("baseUrl"));
118
- });
119
-
120
- // This is how I see it should be tested properly but for some reason when the whole spec is
121
- // executed the test fails.
122
- // Verify that the diagram converted to svg is present as base64 encoded string in
123
- // the href attribute. This is done in the mouseover over the link
124
- // (https://github.com/Ontotext-AD/graphdb-workbench/blob/master/src/js/angular/graphexplore/directives/rdf-class-hierarchy.directive.js#L127)
125
- // cy.get('#download-svg')
126
- // .trigger('mouseover')
127
- // .should('have.attr', 'download', `class-hierarchy-${repositoryId}.svg`)
128
- // .should('have.attr', 'href')
129
- // .and('not.be.empty')
130
- // .and('include', 'data:image/svg+xml;charset=utf-8;base64,');
87
+ it('should export diagram', () => {
88
+ // Given I verify that the diagram converted to svg. It should be present as a base64 encoded string in the href attribute.
89
+ // Note: This is done in the 'mouseover' callback for the link
90
+ // (https://github.com/Ontotext-AD/graphdb-workbench/blob/master/src/js/angular/graphexplore/directives/rdf-class-hierarchy.directive.js#L123)
91
+ ClassViewsSteps.mouseOverSVGButton()
92
+ .should('have.attr', 'download', `class-hierarchy-${repositoryId}.svg`)
93
+ .should('have.attr', 'href')
94
+ .and('not.be.empty')
95
+ .and('include', 'data:image/svg+xml;charset=utf-8;base64,');
131
96
  });
132
97
 
133
- it('Test search for a class', () => {
134
- let className = 'wine';
135
- cy.get(SEARCH_INPUT_DROPDOWN_ID)
98
+ it('should search for a class', () => {
99
+ const className = 'wine';
100
+ ClassViewsSteps.getSearchInputDropdown()
136
101
  .should('not.be.visible');
137
-
102
+ // When I search for a class
138
103
  searchForClass(className);
139
-
140
- // Verify that a list of suggestions is displayed.
141
- cy.get(SEARCH_INPUT_DROPDOWN_ID)
104
+ // Then a list of suggestions is displayed
105
+ ClassViewsSteps.getSearchInputDropdown()
142
106
  .should('be.visible')
143
107
  .and('length.be.gt', 0);
144
-
145
- // Click on a specific element that isn't a top-level one and has children,
108
+ // When I click on a specific element that isn't a top-level one and has children,
146
109
  // otherwise it gets tricky to assert whether it was zoomed
147
- cy.get('#search_input_dropdown').contains('WineColor')
110
+ ClassViewsSteps.getSearchInputDropdown()
111
+ .contains('WineColor')
148
112
  .then(($el) => {
149
- let selectedClassName = $el.text().trim();
150
-
151
- // Find selected class from drop-down menu and verify that isn't expanded
152
- findClassByName(selectedClassName);
153
- cy.get('@classInHierarchy').then(verifyClassIsNotExpanded);
113
+ const selectedClassName = $el.text().trim();
154
114
 
155
- cy.wrap($el).click();
115
+ // Then I find the selected class from the drop-down menu and verify that it isn't expanded
116
+ ClassViewsSteps.findClassByName(selectedClassName);
117
+ ClassViewsSteps.getClassInHierarchy().then(verifyClassIsNotExpanded);
118
+ // And I click the class name element
119
+ ClassViewsSteps.clickJQueryElement(cy.wrap($el));
156
120
 
157
- // Find selected class from drop-down menu after clicking on it and verify that it is expanded
158
- findClassByName(selectedClassName);
159
- cy.get('@classInHierarchy').then(verifyClassIsExpanded);
121
+ // Then I find the selected class from the drop-down menu and verify that it is expanded
122
+ ClassViewsSteps.findClassByName(selectedClassName);
123
+ ClassViewsSteps.getClassInHierarchy().then(verifyClassIsExpanded);
160
124
  });
161
125
  });
162
126
 
163
- it('Test domain range graph', () => {
164
- let className = ':Region';
127
+ it('should load domain range graph', () => {
128
+ const className = ':Region';
129
+ // When I search for a class
165
130
  searchForClass(className);
166
- getDomainRangeGraphButton().click();
167
- getDomainRangeGraphHeader().should('contain', 'Domain-Range graph');
168
- getLegendContainer().should('be.visible');
169
- getLegendContainer().should('contain', 'main class node').and('contain', 'class node').and('contain', 'collapsed property');
170
- getMainDomainRangeDiagram().should('be.visible');
171
- getMainDomainRangeDiagram().should('contain', className).and('contain', 'locatedIn').and('contain', ':adjacentRegion').and('contain', 'owl:Thing');
172
- getReturnButton().should('be.visible').click();
131
+ // And I open a domain range graph
132
+ ClassViewsSteps.openDomainRangeGraph();
133
+ // Then the graph should contain all necessary data
134
+ ClassViewsSteps.getDomainRangeGraphHeader()
135
+ .should('contain', 'Domain-Range graph');
136
+ ClassViewsSteps.getLegendContainer()
137
+ .should('be.visible');
138
+ ClassViewsSteps.getLegendContainer()
139
+ .should('contain', 'main class node')
140
+ .and('contain', 'class node')
141
+ .and('contain', 'collapsed property');
142
+ ClassViewsSteps.getMainDomainRangeDiagram()
143
+ .should('be.visible');
144
+ ClassViewsSteps.getMainDomainRangeDiagram()
145
+ .should('contain', className)
146
+ .and('contain', 'locatedIn')
147
+ .and('contain', ':adjacentRegion')
148
+ .and('contain', 'owl:Thing');
149
+ ClassViewsSteps.getReturnButton()
150
+ .should('be.visible');
151
+ ClassViewsSteps.goBack();
173
152
  });
174
153
 
175
- it('Test class-hierarchy for given graph', () => {
154
+ it('should load class-hierarchy for given graph', () => {
176
155
  cy.importServerFile(repositoryId, GRAPH_FILE, {"context": NEWS_GRAPH});
177
- // Should re-enter page to display Graph dropdown
178
- cy.visit('/hierarchy');
156
+ // Given I re-enter the page to display Graph dropdown
157
+ ClassViewsSteps.visit();
179
158
  ClassViewsSteps.verifyDataChangedWarning();
180
159
  verifyCounterValue(INITIAL_CLASS_COUNT);
181
160
  ClassViewsSteps.verifyGraphIsDisplayed(ALL_GRAPHS);
182
-
183
- // Reload diagram
184
- ClassViewsSteps.reloadDiagram();
185
- cy.intercept('/rest/class-hierarchy*').as('hierarchyReload');
186
- ClassViewsSteps.confirmReloadWarningAppear(CLASS_HIERARCHY);
187
- ClassViewsSteps.confirmReload();
188
- cy.wait('@hierarchyReload');
189
- verifyCounterValue(INITIAL_CLASS_COUNT + CLASS_COUNT_OF_NEWS_GRAPH);
161
+ // When I reload the diagram
162
+ reloadDiagramAndVerify(INITIAL_CLASS_COUNT + CLASS_COUNT_OF_NEWS_GRAPH);
190
163
  ClassViewsSteps.clickGraphBtn();
164
+ // Then I can see the correct graph is displayed
191
165
  ClassViewsSteps.selectGraphFromDropDown(NEWS_GRAPH);
192
166
  ClassViewsSteps.verifyGraphIsDisplayed(NEWS_GRAPH);
193
167
  verifyCounterValue(CLASS_COUNT_OF_NEWS_GRAPH);
194
168
  });
195
169
 
196
- function getDomainRangeGraphButton() {
197
- return cy.get('.domain-range-graph-btn');
198
- }
199
-
200
- function getDomainRangeGraphHeader() {
201
- return cy.get('h1');
202
- }
203
-
204
- function getLegendContainer() {
205
- return cy.get('.legend-container');
206
- }
207
-
208
- function getMainDomainRangeDiagram() {
209
- return cy.get('g');
210
- }
211
-
212
- function getReturnButton() {
213
- return cy.get('.icon-arrow-left');
214
- }
215
-
216
- function getCurrentSliderValue() {
217
- // The count is taken from the rz-pointer's attribute and not from a visible in the UI value
218
- // as the rz-slider library doesn't provide a reliable way to get this. It just has multiple
219
- // '.rz-bubble' elements and no appropriate selector for the one which holds the visible
220
- // value.
221
- return cy.get('.rz-pointer[role="slider"]');
222
- }
223
-
224
170
  function searchForClass(name) {
225
- cy.get('.toolbar-holder .icon-search')
226
- .click()
227
- .then(() => {
228
- cy.get('#search_input_value').type(name).type('{enter}');
229
- });
171
+ ClassViewsSteps.searchForClass();
172
+ ClassViewsSteps.searchForClassName(name);
230
173
  }
231
174
 
232
175
  function verifyPrefixes(expectation) {
233
- cy.get(CLASS_LABEL_SELECTOR)
234
- .each(($element) => {
235
- if ($element.prop('style').display !== 'none') {
236
- expectation($element);
237
- }
238
- });
239
- }
240
-
241
- function findClassByName(className) {
242
- cy.get(CLASS_LABEL_SELECTOR)
243
- .each(($element) => {
244
- let data = $element.prop('__data__');
245
- if (data.data.name === className) {
246
- cy.wrap($element).as('classInHierarchy');
247
- }
248
- });
176
+ ClassViewsSteps.getMainGroupTextLabel()
177
+ .filter(':visible')
178
+ .each(expectation);
249
179
  }
250
180
 
251
181
  function verifyClassIsNotExpanded($element) {
252
182
  // This works well only for classes that aren't top level and have no children
253
183
  return cy.wrap($element)
254
- .should('have.css', 'display').and('eq', 'none');
184
+ .should('have.css', 'display')
185
+ .and('eq', 'none');
255
186
  }
256
187
 
257
188
  function verifyClassIsExpanded($element) {
258
189
  // This works well only for classes that aren't top level and have no children
259
190
  return cy.wrap($element)
260
- .should('have.css', 'display').and('not.eq', 'none');
191
+ .should('have.css', 'display')
192
+ .and('not.eq', 'none');
261
193
  }
262
194
 
263
195
  function verifyCounterValue(classCount) {
264
- getCurrentSliderValue().should('be.visible').and('have.attr', 'aria-valuenow', classCount);
196
+ ClassViewsSteps.getCurrentSliderValue()
197
+ .should('be.visible')
198
+ .and('have.attr', 'aria-valuenow', classCount);
199
+ }
200
+
201
+ function reloadDiagramAndVerify(expectedClassCount) {
202
+ ClassViewsSteps.reloadDiagram();
203
+ ClassViewsSteps.waitForPageLoad();
204
+ ClassViewsSteps.confirmReloadWarningAppear(CLASS_HIERARCHY);
205
+ ClassViewsSteps.confirmReload();
206
+ verifyCounterValue(expectedClassCount);
207
+ }
208
+
209
+ function verifyClassFocus(className, expanded) {
210
+ ClassViewsSteps.findClassByName(className);
211
+ ClassViewsSteps.getClassInHierarchy().then(expanded ? verifyClassIsExpanded : verifyClassIsNotExpanded);
265
212
  }
266
213
  });
@@ -4,7 +4,7 @@ import {JsonLdModalSteps} from "../../steps/json-ld-modal-steps";
4
4
 
5
5
  const EXPORT_GRAPHS_TABLE_ID = '#export-graphs';
6
6
  const ROWS_PER_PAGE_20 = '1';
7
- const ROWS_PER_PAGE_ALL = '2';
7
+ const ROWS_PER_PAGE_50 = '2';
8
8
 
9
9
  describe('Graphs overview screen validation', () => {
10
10
 
@@ -27,7 +27,7 @@ describe('Graphs overview screen validation', () => {
27
27
  cy.visit('/graphs');
28
28
  cy.window();
29
29
  // Assume that page is loaded once the table has rendered all expected elements.
30
- verifyVisibleGraphsCount(10);
30
+ verifyVisibleGraphsCount(50);
31
31
  });
32
32
 
33
33
  afterEach(() => {
@@ -69,7 +69,7 @@ describe('Graphs overview screen validation', () => {
69
69
  GraphsOverviewSteps.getPaginations()
70
70
  .should('be.visible')
71
71
  .and('contain', '3');
72
- GraphsOverviewSteps.getTopPaginationLinks().should('have.length', 5);
72
+ GraphsOverviewSteps.getTopPaginationLinks().should('have.length', 6);
73
73
  verifyGraphExistence('The default graph');
74
74
  });
75
75
 
@@ -81,11 +81,11 @@ describe('Graphs overview screen validation', () => {
81
81
  // Switch through pages and verify that the respective pager button is active.
82
82
  selectPage(2).should('contain', '2')
83
83
  .closest('li').should('have.class', 'active');
84
- verifyGraphExistence('urn:11');
84
+ verifyGraphExistence('urn:50');
85
85
 
86
86
  selectPage(3).should('contain', '3')
87
87
  .closest('li').should('have.class', 'active');
88
- verifyGraphExistence('urn:21');
88
+ verifyGraphExistence('urn:100');
89
89
  });
90
90
  });
91
91
 
@@ -95,18 +95,18 @@ describe('Graphs overview screen validation', () => {
95
95
  selectItemFromMenu(ROWS_PER_PAGE_20);
96
96
  verifyGraphExistence('urn:19');
97
97
 
98
- selectItemFromMenu(ROWS_PER_PAGE_ALL);
98
+ selectItemFromMenu(ROWS_PER_PAGE_50);
99
99
  verifyGraphExistence('urn:1');
100
- verifyGraphExistence('urn:21');
100
+ verifyGraphExistence('urn:49');
101
101
  });
102
102
 
103
103
  it('Test graphs overview search', () => {
104
- // Default items/rows per page is 10.
105
- verifyVisibleGraphsCount(10);
104
+ // Default items/rows per page is 50.
105
+ verifyVisibleGraphsCount(50);
106
106
  // Type graph name in the filter field and verify that proper graphs remain visible in the
107
107
  // table.
108
108
  cy.get('.search-graphs').type('urn:2');
109
- verifyVisibleGraphsCount(3);
109
+ verifyVisibleGraphsCount(11);
110
110
  verifyGraphExistence('urn:2');
111
111
  verifyGraphExistence('urn:11', false);
112
112
  });
@@ -190,4 +190,12 @@ describe('Graphs overview screen validation', () => {
190
190
  // And the file should have downloaded
191
191
  JsonLdModalSteps.verifyFileExists('statements.jsonld');
192
192
  });
193
+
194
+ it('Should be able to download all graphs using the "Download all graphs" button', () => {
195
+ // When I load the graphs overview page and click on "Download all graphs".
196
+ GraphsOverviewSteps.clickOnDownloadAllButton();
197
+
198
+ // Then I expect all graphs to be downloaded.
199
+ GraphsOverviewSteps.verifyFileExists('contexts.srj');
200
+ });
193
201
  });