graphdb-workbench-tests 4.0.0-TR8 → 4.0.0-TR9

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.
@@ -18,7 +18,7 @@ describe('Graphs overview screen validation', () => {
18
18
  cy.window();
19
19
 
20
20
  cy.fixture('graph/rdf.txt').then((rdf) => {
21
- return new Cypress.Promise((resolve, reject) => {
21
+ return new Cypress.Promise((resolve) => {
22
22
  cy.importRDFTextSnippet(repositoryId, rdf, {format: "application/x-trig"});
23
23
  resolve();
24
24
  });
@@ -76,6 +76,7 @@ describe('Graphs overview screen validation', () => {
76
76
  it('Should switch pages', () => {
77
77
  // Makes this less flaky - is it possible the page elements don't have an event attached
78
78
  // yet when this fails? It looks like the click has never happened
79
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
79
80
  cy.wait(100);
80
81
 
81
82
  // Switch through pages and verify that the respective pager button is active.
@@ -111,6 +112,31 @@ describe('Graphs overview screen validation', () => {
111
112
  verifyGraphExistence('urn:11', false);
112
113
  });
113
114
 
115
+ it('Should give the controls on the page accessible names', () => {
116
+ // Then the search field should have a visible label
117
+ GraphsOverviewSteps.getGraphsSearchLabel()
118
+ .should('be.visible')
119
+ .and('contain.text', 'Search Graphs');
120
+ GraphsOverviewSteps.getGraphsSearchInput().should('have.attr', 'id', 'search-graphs');
121
+ // And the table and the header controls should have accessible names
122
+ GraphsOverviewSteps.getResultsElement().should('have.attr', 'aria-label', 'Graphs')
123
+ .and('not.have.attr', 'aria-describedby');
124
+ GraphsOverviewSteps.getSelectAllGraphsCheckbox().should('have.attr', 'aria-label', 'Select all graphs');
125
+ GraphsOverviewSteps.getExportSelectedGraphsButton().should('have.attr', 'aria-label', 'Export selected graphs');
126
+ GraphsOverviewSteps.getDeleteSelectedGraphsButton().should('have.attr', 'aria-label', 'Removes all data from the selected graphs');
127
+ GraphsOverviewSteps.getActionsColumnHeader().should('contain.text', 'Actions');
128
+ // And no empty label should wrap the checkbox
129
+ GraphsOverviewSteps.getResultsHeader().find('label').should('not.exist');
130
+ // And the controls in each row should include the graph name
131
+ GraphsOverviewSteps.getSelectGraphCheckbox('urn:9').should('have.attr', 'aria-label', 'Select graph urn:9');
132
+ GraphsOverviewSteps.getExportGraphButton('urn:9').should('have.attr', 'aria-label', 'Export graph urn:9');
133
+ GraphsOverviewSteps.getDeleteGraphButton('urn:9').should('have.attr', 'aria-label', 'Remove all data from graph urn:9');
134
+ GraphsOverviewSteps.getGraphRow('urn:9').find('label').should('not.exist');
135
+ // And the default graph row should use the translated graph name
136
+ GraphsOverviewSteps.getDefaultGraphRow().find('.select-graph-checkbox')
137
+ .should('have.attr', 'aria-label', 'Select graph The default graph');
138
+ });
139
+
114
140
  it('Delete graph', () => {
115
141
  let graphToDelete = 'urn:9';
116
142
  cy.get(`${EXPORT_GRAPHS_TABLE_ID} tbody a[title="${graphToDelete}"]`)
@@ -125,7 +151,8 @@ describe('Graphs overview screen validation', () => {
125
151
  verifyVisibleGraphsCount(1);
126
152
  verifyGraphExistence('The default graph');
127
153
  // open default graph through the link and verify that the table view is rendered
128
- cy.getByTestId('graph-is-not-shaql').contains('The default graph').trigger('mouseover').click();
154
+ cy.getByTestId('graph-is-not-shaql').contains('The default graph').trigger('mouseover');
155
+ cy.getByTestId('graph-is-not-shaql').contains('The default graph').click();
129
156
  cy.url().should('contain', Cypress.config('baseUrl') + '/resource');
130
157
  YasrSteps.getResultTableHeader().should('be.visible');
131
158
  YasrSteps.getResultTableHeaderColumns().should('have.length', 5);
@@ -152,6 +152,32 @@ describe('Import user data: File upload', () => {
152
152
  ImportUserDataSteps.getResources().should('have.length', 1);
153
153
  });
154
154
 
155
+ it('Should give the controls on the page accessible names', () => {
156
+ // Given I have uploaded a file without importing it
157
+ const file = ImportUserDataSteps.createFile(testFiles[0], bnodes);
158
+ ImportUserDataSteps.selectFile(file);
159
+ ImportSettingsDialogSteps.uploadOnly();
160
+ ImportUserDataSteps.getResources().should('have.length', 1);
161
+ // Then the icon-only buttons and the row checkbox should have accessible names
162
+ ImportUserDataSteps.getHelpToggleButton().should('have.attr', 'aria-label', 'Get help on import');
163
+ ImportUserDataSteps.getStatusSelectMenuToggle().should('have.attr', 'aria-label', 'Select resources by status');
164
+ ImportUserDataSteps.getResourceSelectCheckbox('bnodes.ttl').should('have.attr', 'aria-label', 'Select bnodes.ttl');
165
+ ImportUserDataSteps.getResourceImportButton('bnodes.ttl').should('have.attr', 'aria-label', 'Import bnodes.ttl');
166
+ ImportUserDataSteps.getResourceRemoveButton('bnodes.ttl').should('have.attr', 'aria-label', 'Remove bnodes.ttl');
167
+ // And no empty context link should be rendered
168
+ ImportUserDataSteps.getResourceContextLink('bnodes.ttl').should('not.exist');
169
+ // And the filter field should have a visible label
170
+ ImportUserDataSteps.getFilterFieldLabel()
171
+ .should('be.visible')
172
+ .and('contain.text', 'Filter by name');
173
+ // When I import the file
174
+ ImportUserDataSteps.importFile(0);
175
+ ImportSettingsDialogSteps.import();
176
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
177
+ // Then the reset status button should have an accessible name
178
+ ImportUserDataSteps.getResourceResetButton('bnodes.ttl').should('have.attr', 'aria-label', 'Reset status of bnodes.ttl');
179
+ });
180
+
155
181
  it('Should be able to upload multiple unique files', () => {
156
182
  // Given there are no files uploaded yet
157
183
  ImportUserDataSteps.getResourcesTable().should('be.hidden');
@@ -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 {ToasterSteps} from '../../steps/toaster-steps.js';
6
7
 
7
8
  const FILE_TO_IMPORT = 'resource-test-data.ttl';
8
9
  const SEED_RESOURCE_ENCODED = 'http:%2F%2Fexample.com%2Fontology%23CustomerLoyalty';
@@ -101,6 +102,119 @@ describe('Reactodia graph explorer', () => {
101
102
  ReactodiaSteps.getElements().should('not.exist');
102
103
  });
103
104
 
105
+ // These run against the in-code REST stub. TODO: GDB-15242 switch to intercepts when the endpoints are available.
106
+ describe('Settings', () => {
107
+ it('should open the settings popover', () => {
108
+ // Given I open the reactodia view.
109
+ ReactodiaSteps.visit();
110
+
111
+ // When I click the Settings button.
112
+ ReactodiaSteps.openSettings();
113
+
114
+ // Then I expect the settings popover to be open.
115
+ ReactodiaSteps.getSettingsPopover().should('be.visible');
116
+ ReactodiaSteps.getBrowseButton().should('contain', 'Browse');
117
+ });
118
+
119
+ it('should not offer reset when the default settings are in use', () => {
120
+ // Given I open the settings of a repository without uploaded settings.
121
+ ReactodiaSteps.visit();
122
+ ReactodiaSteps.openSettings();
123
+
124
+ // Then I expect no reset action, because there is nothing to reset to.
125
+ ReactodiaSteps.getSettingsPopover().should('be.visible');
126
+ ReactodiaSteps.getResetButton().should('not.exist');
127
+ });
128
+
129
+ it('should cancel a selected file', () => {
130
+ // Given I have selected a settings file.
131
+ ReactodiaSteps.visit();
132
+ ReactodiaSteps.openSettings();
133
+ ReactodiaSteps.selectSettingsFile();
134
+ ReactodiaSteps.getSelectedSettingsFile().should('exist');
135
+
136
+ // When I cancel it.
137
+ ReactodiaSteps.clickCancelFile();
138
+
139
+ // Then I expect the file to be removed.
140
+ ReactodiaSteps.getSettingsPopover().should('not.contain', 'settings.ttl');
141
+ ReactodiaSteps.getUploadButton().should('be.disabled');
142
+ });
143
+
144
+ it('should ask for confirmation before uploading', () => {
145
+ // Given I have selected a settings file.
146
+ ReactodiaSteps.visit();
147
+ ReactodiaSteps.openSettings();
148
+ ReactodiaSteps.selectSettingsFile();
149
+
150
+ // When I upload it.
151
+ ReactodiaSteps.clickUpload();
152
+
153
+ // Then I expect a confirmation that warns the diagram may behave unexpectedly.
154
+ ReactodiaSteps.getConfirmDialog().should('be.visible')
155
+ .and('contain', 'The diagram might behave unexpectedly with the new settings.');
156
+
157
+ // When I cancel.
158
+ ReactodiaSteps.cancelDialog();
159
+
160
+ // Then I expect the popover to stay open with the file still selected.
161
+ ReactodiaSteps.getSettingsPopover().should('be.visible');
162
+ ReactodiaSteps.getSelectedSettingsFile().should('exist');
163
+
164
+ // When I upload and confirm.
165
+ ReactodiaSteps.clickUpload();
166
+ ReactodiaSteps.confirmDialog();
167
+
168
+ // Then I expect a success message and the diagram to be rendered.
169
+ ToasterSteps.verifySuccess('The settings were uploaded');
170
+ ReactodiaSteps.getWorkspace().should('exist');
171
+ });
172
+
173
+ it('should ask for confirmation before resetting', () => {
174
+ // Given the repository has uploaded settings.
175
+ ReactodiaSteps.visit();
176
+ ReactodiaSteps.openSettings();
177
+ ReactodiaSteps.selectSettingsFile();
178
+ ReactodiaSteps.clickUpload();
179
+ ReactodiaSteps.confirmDialog();
180
+ ToasterSteps.verifySuccess('The settings were uploaded');
181
+
182
+ // When I click outside the settings.
183
+ ReactodiaSteps.closeSettings();
184
+
185
+ // Then I expect the popover to close.
186
+ ReactodiaSteps.getSettingsPopover().should('not.exist');
187
+
188
+ // When I reset them.
189
+ ReactodiaSteps.openSettings();
190
+ ReactodiaSteps.getResetButton().should('be.visible');
191
+ ReactodiaSteps.clickReset();
192
+
193
+ // Then I expect a confirmation that warns the diagram may behave unexpectedly.
194
+ ReactodiaSteps.getConfirmDialog().should('be.visible')
195
+ .and('contain', 'The diagram might behave unexpectedly with the default settings.');
196
+
197
+ // When I confirm.
198
+ ReactodiaSteps.confirmDialog();
199
+
200
+ // Then I expect a success message and the diagram to be rendered.
201
+ ToasterSteps.verifySuccess('The settings were reset to the defaults');
202
+ ReactodiaSteps.getWorkspace().should('exist');
203
+ });
204
+
205
+ it('should export the current settings as a .ttl file', () => {
206
+ // Given I open the settings.
207
+ ReactodiaSteps.visit();
208
+ ReactodiaSteps.openSettings();
209
+
210
+ // When I export them.
211
+ ReactodiaSteps.clickExport();
212
+
213
+ // Then I expect a .ttl file named after the repository to be downloaded.
214
+ ReactodiaSteps.verifyFileDownloaded(`graph-navigator-settings-${repositoryId}.ttl`);
215
+ });
216
+ });
217
+
104
218
  describe('Repository switch', () => {
105
219
  let secondRepositoryId;
106
220
 
@@ -3,6 +3,7 @@ import {YasqeSteps} from '../../../steps/yasgui/yasqe-steps';
3
3
  import {SecurityStubs} from '../../../stubs/security-stubs';
4
4
  import {VisualGraphSteps} from '../../../steps/visual-graph-steps';
5
5
  import {ToasterSteps} from '../../../steps/toaster-steps';
6
+ import {SettingsSteps} from '../../../steps/setup/settings-steps';
6
7
 
7
8
  describe('My Settings', () => {
8
9
 
@@ -32,16 +33,12 @@ describe('My Settings', () => {
32
33
  //turn off inference, sameAs and count total results
33
34
  clickLabelBtn('#sameas-on')
34
35
  .then(() => {
35
- cy.get('#sameas-on')
36
- .find('.switch:checkbox')
37
- .should('not.be.visible');
36
+ SettingsSteps.getSameAsToggle().should('not.be.checked');
38
37
  });
39
38
 
40
39
  clickLabelBtn('#inference-on')
41
40
  .then(() => {
42
- cy.get('#inference-on')
43
- .find('.switch:checkbox')
44
- .should('not.be.visible');
41
+ SettingsSteps.getInferenceToggle().should('not.be.checked');
45
42
  });
46
43
 
47
44
  cy.get('#defaultCount:checkbox').uncheck();
@@ -95,9 +92,7 @@ describe('My Settings', () => {
95
92
  visitSettingsView();
96
93
 
97
94
  clickLabelBtn('#schema-on').then(() => {
98
- cy.get('#schema-on')
99
- .find('.switch:checkbox')
100
- .should('not.be.visible');
95
+ SettingsSteps.getSchemaToggle().should('not.be.checked');
101
96
  });
102
97
 
103
98
  getSaveButton()
@@ -152,14 +147,29 @@ describe('My Settings', () => {
152
147
  it('sameAs button should be disabled if inference is turned off', () => {
153
148
  clickLabelBtn('#inference-on')
154
149
  .then(() => {
155
- cy.get('#inference-on')
156
- .find('.switch:checkbox')
157
- .should('not.be.visible');
150
+ SettingsSteps.getInferenceToggle().should('not.be.checked');
158
151
  });
159
152
 
160
- cy.get('#sameas-on')
161
- .find('.switch:checkbox')
162
- .should('not.be.visible');
153
+ SettingsSteps.getSameAsToggle()
154
+ .should('be.disabled')
155
+ .and('not.be.checked');
156
+ });
157
+
158
+ it('should give the settings form controls accessible names', () => {
159
+ SettingsSteps.getUsernameLabel().should('contain', 'Username');
160
+
161
+ SettingsSteps.getSameAsToggleLabel().should('contain', 'Expand results over owl:SameAs');
162
+ SettingsSteps.getInferenceToggleLabel().should('contain', 'Enable inference');
163
+ SettingsSteps.getSchemaToggleLabel().should('contain', 'Show schema');
164
+
165
+ SettingsSteps.getAnyRepositoryReadCheckbox()
166
+ .should('have.attr', 'aria-label', 'Read access to Global (any data repository)');
167
+ SettingsSteps.getAnyRepositoryWriteCheckbox()
168
+ .should('have.attr', 'aria-label', 'Write access to Global (any data repository)');
169
+ SettingsSteps.getAnyRepositoryMaintainCheckbox()
170
+ .should('have.attr', 'aria-label', 'Maintain access to Global (any data repository)');
171
+ SettingsSteps.getAnyRepositoryGraphqlCheckbox()
172
+ .should('have.attr', 'aria-label', 'Restrict Global (any data repository) to GraphQL');
163
173
  });
164
174
 
165
175
  function getSaveButton() {