graphdb-workbench-tests 2.1.2 → 2.1.3-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.
@@ -1,3 +1,5 @@
1
+ import VisualGraphSteps from "../../steps/visual-graph-steps";
2
+
1
3
  const FILE_TO_IMPORT = 'wine.rdf';
2
4
  const DRY_GRAPH = "http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#Dry";
3
5
 
@@ -248,7 +250,7 @@ describe('Visual graph screen validation', () => {
248
250
  });
249
251
 
250
252
  it('Test verify mouse/keyboard actions', () => {
251
- let mouseActions = 'Mouse actions\n ' +
253
+ const mouseActions = 'Mouse actions\n ' +
252
254
  '\n \n \n \n ' +
253
255
  'Single click\n \n ' +
254
256
  'View node details and properties\n \n \n \n ' +
@@ -264,14 +266,14 @@ describe('Visual graph screen validation', () => {
264
266
  'Pin down or unpin the node\n \n \n \n ' +
265
267
  'Click and drag outside a node\n \n ' +
266
268
  'Move the whole graph\n';
267
- let touchActions = 'Touch actions\n \n \n \n \n ' +
269
+ const touchActions = 'Touch actions\n \n \n \n \n ' +
268
270
  'Tap\n \n ' +
269
271
  'View node details and properties\n \n \n \n ' +
270
272
  'Tap and hold\n \n ' +
271
273
  'Removes a node and its links\n \n \n \n ' +
272
274
  'Tap twice\n \n ' +
273
275
  'Load node connections\n';
274
- let keyboardActions = 'Keyboard actions\n \n \n \n ' +
276
+ const keyboardActions = 'Keyboard actions\n \n \n \n ' +
275
277
  'Left arrow\n \n ' +
276
278
  'Rotate the graph to the left\n \n \n \n ' +
277
279
  'Right arrow\n \n ' +
@@ -513,7 +515,7 @@ describe('Visual graph screen validation', () => {
513
515
  cy.get('.page-2-link').should('be.visible')
514
516
  .and('contain', 'Graph expansion');
515
517
  cy.get('.page-3-link').should('be.visible')
516
- .and('contain', 'Node basics')
518
+ .and('contain', 'Node basics');
517
519
  cy.get('.page-4-link').should('be.visible')
518
520
  .and('contain', 'Edge basics');
519
521
  cy.get('.page-5-link').should('be.visible')
@@ -523,13 +525,68 @@ describe('Visual graph screen validation', () => {
523
525
 
524
526
  cy.get('.expand-samples .list-group-item').first().click();
525
527
  getSaveConfig().click();
526
- cy.url().should('eq', Cypress.config('baseUrl') + '/graphs-visualizations')
528
+ cy.url().should('eq', Cypress.config('baseUrl') + '/graphs-visualizations');
527
529
  getGraphConfigurationsArea().should('be.visible')
528
530
  .and('contain', 'configName');
529
531
  getGraphConfigurationsArea().should('be.visible')
530
532
  .and('contain', 'No graph configs');
531
533
  });
532
534
 
535
+ it('CRUD on saved graph', () => {
536
+ const graphConfigName = 'MyGraphConfig_' + Date.now();
537
+ const namedGraph = 'myGraph' + Date.now();
538
+ const renamedGraph = 'myRenamedGraph' + Date.now();
539
+
540
+ //Creates saved graph
541
+ cy.visit('graphs-visualizations');
542
+ getCreateCustomGraphLink().click();
543
+ cy.url().should('include', '/config/save');
544
+ getGraphConfigName().type(graphConfigName);
545
+ cy.get('[data-cy="graph-config-by-graph-query-checkbox"]').check();
546
+ cy.get('[data-cy="query-editor"]').type('CONSTRUCT WHERE {?s ?p ?o} LIMIT 10', {parseSpecialCharSequences: false});
547
+ getSaveConfig().click();
548
+ cy.url().should('include', 'graphs-visualizations');
549
+ cy.contains('td', graphConfigName).parent().within(() => {
550
+ cy.get('[data-cy="graph-config-starting-point-query-results"]').click();
551
+ });
552
+ VisualGraphSteps
553
+ .updateGraphConfiguration(namedGraph);
554
+
555
+ //Visualize saved graph
556
+ cy.visit('graphs-visualizations');
557
+ cy.contains('td', namedGraph).parent().within(() => {
558
+ cy.get('td a').contains(namedGraph).click();
559
+ });
560
+ cy.get('[data-cy="save-or-update-graph"]').should('be.visible');
561
+
562
+ //Finds the button "Get URL to Graph" and opens the modal form "Copy URL to clipboard"
563
+ cy.visit('graphs-visualizations');
564
+ cy.contains('td', namedGraph).parent().within( () => {
565
+ cy.get('td a')
566
+ .get('[data-cy="copy-to-clipboard-saved-graph"]').click();
567
+ });
568
+ cy.get( '[id="copyToClipboardForm"]').contains('Copy URL to clipboard');
569
+
570
+ //Renames saved graph
571
+ cy.visit('graphs-visualizations');
572
+ cy.contains('td', namedGraph).parent().within( () => {
573
+ cy.get('td a')
574
+ .get('[data-cy="rename-saved-graph"]').click();
575
+ });
576
+ cy.get('[id="saveGraphForm"]')
577
+ .get('[id="wb-graphviz-savegraph-name"]').clear().type(renamedGraph)
578
+ .get('[id="wb-graphviz-savegraph-submit"]').click();
579
+ cy.get('.toast').contains('Saved graph ' + renamedGraph + ' was edited.');
580
+
581
+ //Deletes saved graph
582
+ VisualGraphSteps
583
+ .deleteSavedGraph(renamedGraph);
584
+
585
+ //Deletes graph config
586
+ VisualGraphSteps
587
+ .deleteGraphConfig(graphConfigName);
588
+ });
589
+
533
590
  // Visual graph home view access
534
591
 
535
592
  function getSearchField() {
@@ -545,7 +602,7 @@ describe('Visual graph screen validation', () => {
545
602
  cy.waitUntil(() =>
546
603
  cy.get('.graph-visualization')
547
604
  .find('.nodes-container')
548
- .then(nodesContainer => nodesContainer))
605
+ .then((nodesContainer) => nodesContainer))
549
606
  .then(() => {
550
607
  getNodes();
551
608
  });
@@ -585,14 +642,14 @@ describe('Visual graph screen validation', () => {
585
642
  }
586
643
 
587
644
  function showPreferredTypes(enable) {
588
- let command = enable ? 'check' : 'uncheck';
645
+ const command = enable ? 'check' : 'uncheck';
589
646
  getShowPreferredTypesOnlyCheckbox()[command]();
590
647
  }
591
648
 
592
649
  function toggleInferredStatements(enable) {
593
650
  openVisualGraphSettings();
594
651
  getSettingsPanel().should('be.visible');
595
- let command = enable ? 'check' : 'uncheck';
652
+ const command = enable ? 'check' : 'uncheck';
596
653
  getIncludeInferredStatementsCheckbox()[command]();
597
654
  saveSettings();
598
655
  }
@@ -1,7 +1,7 @@
1
1
  describe('Namespaces', () => {
2
2
 
3
3
  let repositoryId;
4
- let DEFAULT_NAMESPACES = {};
4
+ const DEFAULT_NAMESPACES = {};
5
5
 
6
6
  beforeEach(() => {
7
7
  repositoryId = 'namespaces-' + Date.now();
@@ -47,16 +47,16 @@ describe('Namespaces', () => {
47
47
 
48
48
  // Should render a table with some default namespaces
49
49
  getNamespacesTable().should('be.visible');
50
+ getRefreshedTableNamespaces();
50
51
  getNamespaces().should('have.length', getDefaultNamespacesLength());
51
52
 
52
53
  // Should provide pagination options
53
54
  getNamespacesPerPageMenu().within(() => {
54
- // Should show all namespaces by default (they are only 6 so they can be visualized all at once)
55
55
  cy.get('.dropdown-toggle')
56
56
  .should('contain', 'All')
57
57
  .click();
58
58
  cy.get('.page-size-option')
59
- .should('have.length', 1)
59
+ .should('have.length', getPagingCount())
60
60
  .and('contain', 'All');
61
61
  // Close the menu to avoid overlapping other elements
62
62
  cy.get('.dropdown-toggle').click();
@@ -126,11 +126,13 @@ describe('Namespaces', () => {
126
126
  .type('owl')
127
127
  .should('have.value', 'owl');
128
128
  getNamespaces()
129
- .should('have.length', 1)
130
- .and('contain', DEFAULT_NAMESPACES['owl']);
129
+ .should('contain', DEFAULT_NAMESPACES['owl']);
130
+ cy.visit('namespaces');
131
+ const updatedCount = getDefaultNamespacesLength();
132
+ getRefreshedTableNamespaces();
131
133
  getNamespacesHeaderPaginationInfo()
132
134
  .should('be.visible')
133
- .and('contain', 'Showing 1 - 1 of 1 results');
135
+ .and('contain', `Showing 1 - ${updatedCount} of ${updatedCount} results`);
134
136
 
135
137
  getNamespacesFilterField()
136
138
  .clear()
@@ -161,6 +163,7 @@ describe('Namespaces', () => {
161
163
 
162
164
  let updatedCount = getDefaultNamespacesLength() + 1;
163
165
  // Verify results table is refreshed
166
+ getRefreshedTableNamespaces();
164
167
  getNamespaces().should('have.length', updatedCount);
165
168
  getNamespacesHeaderPaginationInfo()
166
169
  .should('contain', `Showing 1 - ${updatedCount} of ${updatedCount} results`);
@@ -186,6 +189,7 @@ describe('Namespaces', () => {
186
189
  confirmModal();
187
190
 
188
191
  // Should have not created new record, should update the existing
192
+ getRefreshedTableNamespaces();
189
193
  getNamespaces()
190
194
  .should('have.length', getDefaultNamespacesLength() + 1)
191
195
  // This assert here ensures the table will contain the modified namespace before actually checking it because the table is
@@ -199,9 +203,11 @@ describe('Namespaces', () => {
199
203
 
200
204
  it('should allow to delete existing namespaces', () => {
201
205
  // Delete single namespace from it's actions
206
+ getRefreshedTableNamespaces();
202
207
  deleteNamespace('xsd');
203
208
  confirmModal();
204
209
 
210
+ getRefreshedTableNamespaces();
205
211
  let updatedCount = getDefaultNamespacesLength() - 1;
206
212
  // Verify results table is refreshed
207
213
  getNamespaces().should('have.length', updatedCount);
@@ -213,6 +219,7 @@ describe('Namespaces', () => {
213
219
  getDeleteNamespacesButton().click();
214
220
  confirmModal();
215
221
 
222
+ getRefreshedTableNamespaces();
216
223
  updatedCount = updatedCount - 2;
217
224
  // Verify results table is refreshed
218
225
  getNamespaces().should('have.length', updatedCount);
@@ -326,8 +333,13 @@ describe('Namespaces', () => {
326
333
  return getNamespacesTable().find('.namespace');
327
334
  }
328
335
 
336
+ function getRefreshedTableNamespaces() {
337
+ cy.get('[data-cy="namespaces-per-page-menu"]').click()
338
+ .get('[data-cy="all-label"]').click();
339
+ }
340
+
329
341
  function getNamespace(prefix) {
330
- return getNamespaces()
342
+ return getNamespacesTable().find('.namespace')
331
343
  .find('.namespace-prefix')
332
344
  .contains(prefix)
333
345
  .parentsUntil('tbody')
@@ -368,4 +380,20 @@ describe('Namespaces', () => {
368
380
  function getDefaultNamespacesLength() {
369
381
  return Object.keys(DEFAULT_NAMESPACES).length;
370
382
  }
383
+
384
+ function getPagingCount() {
385
+ const count = getDefaultNamespacesLength();
386
+ if (count <= 10) {
387
+ return 1;
388
+ }
389
+ if (count <= 20) {
390
+ return 2;
391
+ }
392
+ if (count <= 50) {
393
+ return 3;
394
+ }
395
+ if (count <= 100) {
396
+ return 4;
397
+ } else return 5;
398
+ }
371
399
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.1.2",
3
+ "version": "2.1.3-TR1",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "start": "cypress open",
@@ -0,0 +1,31 @@
1
+ class VisualGraphSteps {
2
+
3
+ static updateGraphConfiguration(namedGraph) {
4
+ cy.get('[data-cy="save-or-update-graph"]').click()
5
+ .get( '[id="wb-graphviz-savegraph-name"]').type(namedGraph)
6
+ .get('[id="wb-graphviz-savegraph-submit"]').click();
7
+ cy.get('.toast').contains('Saved graph ' + namedGraph + ' was saved');
8
+ }
9
+
10
+ static deleteSavedGraph(renamedGraph) {
11
+ cy.contains('td', renamedGraph).parent().within( () => {
12
+ cy.get('[data-cy="delete-saved-graph"]').click();
13
+ });
14
+ VisualGraphSteps.confirmDelete();
15
+ }
16
+
17
+ static deleteGraphConfig(graphConfigName) {
18
+ cy.contains('td', graphConfigName).parent().within( () => {
19
+ cy.get('[data-cy="delete-graph-config"]').click();
20
+ });
21
+ VisualGraphSteps.confirmDelete();
22
+ }
23
+
24
+ static confirmDelete() {
25
+ cy.get('.modal-footer .confirm-btn').click();
26
+ cy.get('.modal').should('not.exist');
27
+ }
28
+
29
+ }
30
+
31
+ export default VisualGraphSteps;