graphdb-workbench-tests 2.2.2-TR2 → 2.2.2-TR4

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.
@@ -568,7 +568,7 @@ describe('Repositories', () => {
568
568
  testOntopConfigurationElementsVisibility('Constraint file', '#constraintFile');
569
569
  testOntopConfigurationElementsVisibility('Ontology file', '#owlFile');
570
570
  //verify driver download url
571
- compareDriverDownloadUrl('https://jdbc.postgresql.org/download.html');
571
+ compareDriverDownloadUrl('https://jdbc.postgresql.org/download');
572
572
 
573
573
  //Select Oracle driver type and verify elements and download url (if available)
574
574
  selectDatabaseDriver('Oracle');
@@ -956,8 +956,7 @@ describe('Repositories', () => {
956
956
  function compareDriverDownloadUrl(expectedUrl){
957
957
  cy.get('.uri')
958
958
  .should('be.visible')
959
- .and('have.attr', 'href')
960
- .and('contain', expectedUrl);
959
+ .and('have.attr', 'href', expectedUrl);
961
960
  }
962
961
 
963
962
  function getSHACLRepositoryCheckbox(){
@@ -202,7 +202,8 @@ describe('My Settings', () => {
202
202
  cy.get('.rdf-info-side-panel .filter-sidepanel').should('be.visible');
203
203
  cy.get('.include-schema-statements')
204
204
  .scrollIntoView().should('be.visible').click()
205
- .then(() => {
205
+ .then(($el) => {
206
+ cy.wrap($el).trigger('mouseleave', {force: true});
206
207
  cy.get('.include-schema-statements').scrollIntoView()
207
208
  .should('be.visible').and('not.be.checked');
208
209
  saveGraphSettings()
@@ -70,7 +70,6 @@ describe('SPARQL Templates', () => {
70
70
  getTemplateNameField().type(TEMPLATE_NAME);
71
71
  //Verify default query
72
72
  verifyQueryAreaEquals(DEFAULT_QUERY);
73
- clearQuery();
74
73
  //Paste new template query and verify content
75
74
  cy.pasteQuery(SPARQL_TEMPLATE);
76
75
  verifyQueryAreaEquals(SPARQL_TEMPLATE);
@@ -89,15 +88,6 @@ describe('SPARQL Templates', () => {
89
88
  getEditTemplateButton(TEMPLATE_NAME);
90
89
  cy.waitUntilQueryIsVisible();
91
90
  verifyQueryAreaEquals(SPARQL_TEMPLATE);
92
- clearQuery();
93
- //Change query to the default template again
94
- cy.pasteQuery(DEFAULT_QUERY);
95
- verifyQueryAreaEquals(DEFAULT_QUERY);
96
- getSaveButton().click();
97
- //Verify change to default template is persisted
98
- getEditTemplateButton(TEMPLATE_NAME);
99
- cy.waitUntilQueryIsVisible();
100
- verifyQueryAreaEquals(DEFAULT_QUERY);
101
91
  //Cancel as no changes have been made
102
92
  getCancelButton().click();
103
93
  //Delete template and verify templates table is empty
@@ -132,15 +122,6 @@ describe('SPARQL Templates', () => {
132
122
  return cy.get('#queryEditor .CodeMirror');
133
123
  }
134
124
 
135
- function clearQuery() {
136
- // Using force because the textarea is not visible
137
- getQueryTextArea().type(Cypress.env('modifierKey') + 'a{backspace}', {force: true});
138
- }
139
-
140
- function getQueryTextArea() {
141
- return getQueryArea().find('textarea');
142
- }
143
-
144
125
  function getSaveButton() {
145
126
  return cy.get('.save-query-btn');
146
127
  }
@@ -0,0 +1,125 @@
1
+ describe('SPARQL Templates', () => {
2
+
3
+ let repositoryId;
4
+ const TEMPLATE_NAME = "http://example.com/salary_template";
5
+ const SPARQL_TEMPLATE = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
6
+ "PREFIX factory: <http://factory/>\n" +
7
+ "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" +
8
+ "PREFIX spif: <http://spinrdf.org/spif#>\n" +
9
+ "INSERT {\n" +
10
+ "?id <http://factory/updatedOn> \"2021-10-01T07:55:38.238Z\"^^xsd:dateTime .\n" +
11
+ "?split spif:split (\"blaaa/blaa\" \"/\")\n" +
12
+ "} WHERE {\n" +
13
+ "?id rdf:type <http://factory/Factory> .\n" +
14
+ "?worker <http://factory/worksIn> ?id .\n" +
15
+ "?worker <http://factory/hasSalary> ?oldSalary .\n" +
16
+ "FILTER regex(STR(?id), \"fac\", \"i\")\n" +
17
+ "?split spif:split (\"blaaa/blaa\" \"/\")\n" +
18
+ "bind(now() as ?now)\n" +
19
+ "}";
20
+ const DEFAULT_QUERY = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
21
+ "PREFIX ex: <http://example.com#>\n" +
22
+ "DELETE {\n" +
23
+ " ?subject ex:myPredicate ?oldValue .\n" +
24
+ "} INSERT {\n" +
25
+ " ?subject ex:myPredicate ?newValue .\n" +
26
+ "} WHERE {\n" +
27
+ " ?id rdf:type ex:MyType .\n" +
28
+ " ?subject ex:isRelatedTo ?id .\n" +
29
+ "}\n";
30
+
31
+ before(() => {
32
+ repositoryId = 'sparql-templates-repo' + Date.now();
33
+ cy.createRepository({id: repositoryId});
34
+ });
35
+
36
+ beforeEach(() => {
37
+ cy.visit('/sparql-templates', {
38
+ onBeforeLoad: (win) => {
39
+ win.localStorage.setItem('com.ontotext.graphdb.repository', repositoryId);
40
+ }
41
+ });
42
+ cy.window()
43
+ .then(() => getTemplatesTable().scrollIntoView().should('be.visible'));
44
+ });
45
+
46
+ after(() => {
47
+ cy.deleteRepository(repositoryId);
48
+ });
49
+
50
+ it('Should create/edit/delete a SPARQL template', () => {
51
+ // The test is flaky because it depends on an asynchronous DB insert which can not be easily observed from the UI
52
+ //Click create template button
53
+ getCreateSparqlTemplateButton().click();
54
+ cy.waitUntilQueryIsVisible();
55
+ //Type a valid Template IRI value in the filed
56
+ getTemplateNameField().type(TEMPLATE_NAME);
57
+ //Paste new template query and verify content
58
+ cy.pasteQuery(SPARQL_TEMPLATE);
59
+ verifyQueryAreaEquals(SPARQL_TEMPLATE);
60
+ getSaveButton()
61
+ .scrollIntoView()
62
+ .click()
63
+ .then(() => {
64
+ cy.waitUntil(() =>
65
+ cy.get('.edit-query-btn')
66
+ .then((editBtn) => editBtn));
67
+ });
68
+ //Verify new template is stored in the templates table
69
+ getTemplatesTable().should('be.visible').and('contain', TEMPLATE_NAME);
70
+ //Edit template
71
+ getEditTemplateButton(TEMPLATE_NAME);
72
+ cy.waitUntilQueryIsVisible();
73
+ verifyQueryAreaEquals(SPARQL_TEMPLATE);
74
+ //Change query to the default template again
75
+ cy.pasteQuery(DEFAULT_QUERY);
76
+ verifyQueryAreaEquals(DEFAULT_QUERY);
77
+ getSaveButton()
78
+ .click()
79
+ .then(() => {
80
+ cy.waitUntil(() => cy.get('.edit-query-btn').should('be.visible'));
81
+ });
82
+ //Verify change to default template is persisted
83
+ getEditTemplateButton(TEMPLATE_NAME);
84
+ cy.waitUntilQueryIsVisible();
85
+ verifyQueryAreaEquals(DEFAULT_QUERY);
86
+ });
87
+
88
+ function getTemplatesTable() {
89
+ return cy.get('.sparql-templates-list');
90
+ }
91
+
92
+ function getCreateSparqlTemplateButton() {
93
+ return cy.get('.clearfix .create-sql-table-configuration');
94
+ }
95
+
96
+ function getTemplateNameField() {
97
+ return cy.get('.sparql-template-name');
98
+ }
99
+
100
+ function verifyQueryAreaEquals(query) {
101
+ // Using the CodeMirror instance because getting the value from the DOM is very cumbersome
102
+ getQueryArea().should((codeMirrorEl) => {
103
+ const cm = codeMirrorEl[0].CodeMirror;
104
+ expect(cm.getValue().trim()).to.equal(query.trim());
105
+ });
106
+ }
107
+
108
+ function getQueryArea() {
109
+ return cy.get('#queryEditor .CodeMirror');
110
+ }
111
+
112
+ function getSaveButton() {
113
+ return cy.get('.save-query-btn');
114
+ }
115
+
116
+ function getEditTemplateButton(templateName) {
117
+ return cy.get('#configurations-table tr')
118
+ .contains(templateName)
119
+ .parent()
120
+ .parent()
121
+ .within(() => {
122
+ cy.get('.icon-edit').click();
123
+ });
124
+ }
125
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.2.2-TR2",
3
+ "version": "2.2.2-TR4",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "start": "cypress open",
@@ -199,7 +199,7 @@ class ImportSteps {
199
199
  static verifyImportStatusDetails(fileToSelect, details) {
200
200
  ImportSteps.getServerFileElement(fileToSelect).find('.import-status .import-status-info').then(infoIconEl => {
201
201
  cy.wrap(infoIconEl).should('be.visible');
202
- cy.wrap(infoIconEl).trigger('mouseover');
202
+ cy.wrap(infoIconEl).trigger('mouseenter');
203
203
 
204
204
  cy.get('.popover-content').then(content => {
205
205
  cy.wrap(content).should('be.visible');