graphdb-workbench-tests 3.2.0 → 3.3.0-TR2

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 (46) hide show
  1. package/cypress-security.config.js +12 -5
  2. package/e2e-legacy/explore/class-relationships/class-relationships.spec.js +1 -1
  3. package/e2e-legacy/home/cookie-policy.spec.js +8 -8
  4. package/e2e-legacy/home/rdf-resource-search.spec.js +12 -0
  5. package/e2e-legacy/setup/rdf-rank/rdf-rank.spec.js +2 -4
  6. package/e2e-legacy/setup/settings/my-settings.spec.js +46 -58
  7. package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +8 -3
  8. package/e2e-legacy/sparql-editor/actions/inferred-sameas.spec.js +3 -3
  9. package/e2e-legacy/sparql-editor/saved-query/readonly-query.spec.js +13 -16
  10. package/e2e-legacy/sparql-editor/yasqe-themes.spec.js +54 -0
  11. package/e2e-legacy/ttyg/agent-list.spec.js +1 -2
  12. package/e2e-legacy/ttyg/agent-select-menu.spec.js +1 -2
  13. package/e2e-legacy/ttyg/chat-list.spec.js +1 -2
  14. package/e2e-legacy/ttyg/chat-panel.spec.js +1 -2
  15. package/e2e-legacy/ttyg/clone-agent.spec.js +1 -2
  16. package/e2e-legacy/ttyg/create-agent.spec.js +2 -3
  17. package/e2e-legacy/ttyg/create-chat.spec.js +1 -2
  18. package/e2e-legacy/ttyg/delete-agent.spec.js +1 -2
  19. package/e2e-legacy/ttyg/edit-agent.spec.js +1 -2
  20. package/e2e-legacy/ttyg/ttyg-permission.spec.js +2 -6
  21. package/e2e-legacy/ttyg/ttyg-view.spec.js +1 -2
  22. package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +16 -7
  23. package/e2e-security/setup/users-and-access/graphql-user.spec.js +6 -3
  24. package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +1 -0
  25. package/e2e-security/setup/users-and-access/turn-on-security-and-password-change.spec.js +3 -3
  26. package/e2e-security/setup/users-and-access/user-and-access.spec.js +8 -8
  27. package/fixtures/ttyg/agent/get-similarity-indexes-for-another-repo.json +5 -3
  28. package/fixtures/ttyg/agent/get-similarity-indexes.json +17 -8
  29. package/npm-shrinkwrap.json +47 -47
  30. package/package.json +1 -1
  31. package/steps/application-steps.js +7 -5
  32. package/steps/class-views-steps.js +2 -3
  33. package/steps/home-steps.js +37 -29
  34. package/steps/login-steps.js +13 -4
  35. package/steps/repository-steps.js +4 -0
  36. package/steps/setup/rdf-rank-steps.js +0 -4
  37. package/steps/setup/user-and-access-steps.js +6 -10
  38. package/steps/sparql-editor-steps.js +5 -0
  39. package/steps/toaster-steps.js +18 -6
  40. package/steps/yasgui/yasqe-steps.js +6 -0
  41. package/stubs/repositories/repositories-stubs.js +151 -76
  42. package/support/e2e.js +3 -0
  43. package/support/repository-commands.js +9 -0
  44. package/support/settings-commands.js +16 -0
  45. package/stubs/repositories-stub.js +0 -73
  46. /package/e2e-legacy/graphql/{graphql-endpoint-management-with-selected-repository.spec.jsx → graphql-endpoint-management-with-selected-repository.spec.js} +0 -0
@@ -1,8 +1,15 @@
1
- const {defineConfig} = require('cypress');
1
+ import { defineConfig } from 'cypress';
2
+ import setupPlugins from './plugins/index.js';
2
3
 
3
4
  const isCoverage = process.env.COVERAGE === 'true';
4
5
 
5
- module.exports = defineConfig({
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({
6
13
  projectId: 'v35btb',
7
14
  fixturesFolder: 'fixtures',
8
15
  screenshotsFolder: 'report/screenshots',
@@ -19,10 +26,10 @@ module.exports = defineConfig({
19
26
  },
20
27
  // We've imported your old cypress plugins here.
21
28
  // You may want to clean this up later by importing these.
22
- setupNodeEvents(on, config) {
23
- require('./plugins')(on, config);
29
+ async setupNodeEvents(on, config) {
30
+ setupPlugins(on, config);
24
31
  if (isCoverage) {
25
- require('@bahmutov/cypress-code-coverage/plugin')(on, config)
32
+ await loadCodeCoverage(on, config);
26
33
  }
27
34
  return config;
28
35
  },
@@ -43,7 +43,7 @@ describe('Class relations screen validation', () => {
43
43
  });
44
44
  // Diagram should be visible and showing 10 classes
45
45
  ClassRelationshipsSteps.getDependenciesDiagram().should('be.visible').within(() => {
46
- cy.get('.group').should('have.length', 10);
46
+ cy.get('.group').should('have.length', 10);
47
47
  });
48
48
  });
49
49
 
@@ -1,20 +1,18 @@
1
1
  import HomeSteps from '../../steps/home-steps';
2
- import {EnvironmentStubs} from "../../stubs/environment-stubs";
3
- import {SecurityStubs} from "../../stubs/security-stubs";
4
- import {SettingsSteps} from "../../steps/setup/settings-steps";
5
- import {LicenseStubs} from "../../stubs/license-stubs";
2
+ import {SecurityStubs} from '../../stubs/security-stubs';
3
+ import {SettingsSteps} from '../../steps/setup/settings-steps';
4
+ import {LicenseStubs} from '../../stubs/license-stubs';
6
5
 
7
6
  Cypress.env('set_default_user_data', false);
8
7
 
9
-
10
8
  describe('Cookie policy', () => {
11
9
  beforeEach(() => {
12
- cy.setDefaultUserData(false);
10
+ cy.setCookieConsent(undefined);
13
11
  cy.viewport(1280, 1000);
14
12
  LicenseStubs.stubFreeLicense();
15
13
  });
16
14
 
17
- afterEach(() => cy.setDefaultUserData());
15
+ afterEach(() => cy.setCookieConsent(true));
18
16
 
19
17
  context('should show', () => {
20
18
  it('Should show consent popup to user', () => {
@@ -71,13 +69,15 @@ describe('Cookie policy', () => {
71
69
  });
72
70
 
73
71
  it('Should set cookies for tracking when accepted', () => {
72
+ cy.intercept('PATCH', `/rest/security/users/admin`).as('updateUser');
74
73
  HomeSteps.visitInProdMode();
75
- SecurityStubs.stubUpdateUserData('admin');
76
74
 
77
75
  // When I click Agree button
78
76
  HomeSteps.clickAgreeButton();
79
77
 
80
78
  // I expect to save cookie consent in user settings
79
+ // There are two requests one from the new shared component and one in the legacy
80
+ cy.wait('@updateUser');
81
81
  cy.wait('@updateUser');
82
82
 
83
83
  // Check if the GA tracking script is set correctly in the head
@@ -74,7 +74,10 @@ describe('RDF resource search', () => {
74
74
  // Given: There is a repository selected and I visit a page other than home.
75
75
  cy.presetRepository(repositoryId);
76
76
  ImportSteps.visit();
77
+ ImportSteps.getView().should('be.visible');
77
78
  BrowserStubs.stubWindowOpen();
79
+ // Then: Search rdf button should be visible
80
+ RdfResourceSearchSteps.getOpenButton().should('be.visible');
78
81
  // When: I open the search resource component
79
82
  RdfResourceSearchSteps.openRdfSearchBox();
80
83
  //Then: I should be able to type some text in the input
@@ -109,6 +112,9 @@ describe('RDF resource search', () => {
109
112
  cy.importServerFile(repositoryId, FILE_TO_IMPORT);
110
113
  // And: I visit the home page
111
114
  HomeSteps.visitAndWaitLoader();
115
+ HomeSteps.getView().should('be.visible');
116
+ HomeSteps.getRdfResourceSearchInput().should('be.visible');
117
+ RdfResourceSearchSteps.getShowViewResourceMessageButton().should('be.visible');
112
118
 
113
119
  // When: I click on the RDF resource search button
114
120
  RdfResourceSearchSteps.clickOnShowViewResourceMessageButton();
@@ -119,6 +125,12 @@ describe('RDF resource search', () => {
119
125
  //Navigate away from the Homepage, to be able to test the new resource search box
120
126
  HomeSteps.visitAndWaitLoader();
121
127
  BrowserStubs.stubWindowOpen();
128
+ HomeSteps.getView().should('be.visible');
129
+ HomeSteps.getRdfResourceSearchInput().should('be.visible');
130
+ RdfResourceSearchSteps.getShowViewResourceMessageButton().should('be.visible');
131
+
132
+ // Then: The input for RDF resource search should not be visible (This is the legacy component used prior to the migration)
133
+ HomeSteps.getRdfResourceSearchInput().should('be.visible');
122
134
  // When: I click on the RDF resource search button
123
135
  RdfResourceSearchSteps.clickOnShowViewResourceMessageButton();
124
136
  // Then: The input for RDF resource search should be visible (This is the legacy component used prior to the migration)
@@ -1,4 +1,5 @@
1
1
  import {RdfRankSteps} from "../../../steps/setup/rdf-rank-steps";
2
+ import {ToasterSteps} from "../../../steps/toaster-steps";
2
3
 
3
4
  describe('RDF Rank view', () => {
4
5
 
@@ -98,10 +99,7 @@ describe('RDF Rank view', () => {
98
99
  RdfRankSteps.getIncludedPredicatesFilter()
99
100
  .find('.tag-list .tag-item')
100
101
  .should('have.length', 0);
101
- RdfRankSteps.getToast()
102
- .find('.toast-error')
103
- .should('be.visible')
104
- .and('contain', 'is not a valid IRI');
102
+ ToasterSteps.verifyError('is not a valid IRI')
105
103
 
106
104
  // Enter valid one and rebuild
107
105
  RdfRankSteps.getIncludedPredicatesFilter()
@@ -1,14 +1,15 @@
1
- import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
- import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
3
- import {SecurityStubs} from "../../../stubs/security-stubs";
4
- import {VisualGraphSteps} from "../../../steps/visual-graph-steps";
1
+ import {SparqlEditorSteps} from '../../../steps/sparql-editor-steps';
2
+ import {YasqeSteps} from '../../../steps/yasgui/yasqe-steps';
3
+ import {SecurityStubs} from '../../../stubs/security-stubs';
4
+ import {VisualGraphSteps} from '../../../steps/visual-graph-steps';
5
+ import {ToasterSteps} from '../../../steps/toaster-steps';
5
6
 
6
7
  describe('My Settings', () => {
7
8
 
8
9
  let repositoryId;
9
- const testResultCountQuery = "select * where { \n" +
10
- "\t?s ?p ?o .\n" +
11
- "} limit 1001";
10
+ const testResultCountQuery = 'select * where { \n' +
11
+ '\t?s ?p ?o .\n' +
12
+ '} limit 1001';
12
13
  const FILE_TO_IMPORT = 'wine.rdf';
13
14
 
14
15
  beforeEach(() => {
@@ -43,11 +44,8 @@ describe('My Settings', () => {
43
44
  .should('not.be.visible');
44
45
  });
45
46
 
46
- cy.get('#defaultCount:checkbox').uncheck()
47
- .then(() => {
48
- cy.get('#defaultCount:checkbox')
49
- .should('not.be.checked');
50
- });
47
+ cy.get('#defaultCount:checkbox').uncheck();
48
+ cy.get('#defaultCount:checkbox').should('not.be.checked');
51
49
 
52
50
  // Note that saving settings takes time.
53
51
  // Make sure that visiting SPARQL view
@@ -75,23 +73,19 @@ describe('My Settings', () => {
75
73
 
76
74
  turnOnLabelBtn('#sameas-on');
77
75
  turnOnLabelBtn('#inference-on');
78
- cy.get('#defaultCount:checkbox').check()
79
- .then(() => {
80
- cy.get('#defaultCount:checkbox')
81
- .should('be.visible')
82
- .and('be.checked');
83
- });
76
+ cy.get('#defaultCount:checkbox').check();
77
+ cy.get('#defaultCount:checkbox').should('be.visible').and('be.checked');
84
78
  });
85
79
  });
86
80
 
87
81
  it('Should test the "Show schema ON/OFF by default in visual graph" setting in My Settings', () => {
88
- const DRY_GRAPH = "http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#Dry";
89
82
  //Verify that schema statements are ON in My settings
90
83
  cy.get('#schema-on').find('.switch:checkbox').should('be.checked');
91
84
  cy.enableAutocomplete(repositoryId);
92
85
  //Verify that schema statements ON is reflected in Visual graph
93
86
  VisualGraphSteps.openDryWineUri();
94
- cy.get('.visual-graph-settings-btn').scrollIntoView().click();
87
+ cy.get('.visual-graph-settings-btn').scrollIntoView();
88
+ cy.get('.visual-graph-settings-btn').click();
95
89
  cy.get('.rdf-info-side-panel .filter-sidepanel').should('be.visible');
96
90
  cy.get('.include-schema-statements').should('be.visible').and('be.checked');
97
91
  saveGraphSettings()
@@ -117,37 +111,37 @@ describe('My Settings', () => {
117
111
 
118
112
  cy.get('.visual-graph-settings-btn').click();
119
113
  cy.get('.rdf-info-side-panel .filter-sidepanel').should('be.visible');
120
- cy.get('.include-schema-statements')
121
- .scrollIntoView().should('be.visible').click()
122
- .then(($el) => {
123
- cy.wrap($el).trigger('mouseleave', {force: true});
124
- cy.get('.include-schema-statements').scrollIntoView()
125
- .should('be.visible').and('not.be.checked');
126
- saveGraphSettings()
127
- .then(() => cy.get('.predicate').should('not.exist'));
128
- });
114
+ cy.get('.include-schema-statements').scrollIntoView();
115
+ cy.get('.include-schema-statements').should('be.visible').click();
116
+ cy.get('.include-schema-statements').then(($el) => {
117
+ cy.wrap($el).trigger('mouseleave', {force: true});
118
+ cy.get('.include-schema-statements').scrollIntoView();
119
+ cy.get('.include-schema-statements').should('be.visible').and('not.be.checked');
120
+ saveGraphSettings()
121
+ .then(() => cy.get('.predicate').should('not.exist'));
122
+ });
129
123
  //return to My Settings to revert the changes
130
124
  visitSettingsView();
131
125
  // Wait for loader to disappear
132
126
  cy.get('.ot-loader').should('not.be.visible');
133
127
  clickLabelBtn('#schema-on')
134
128
  .then(() => {
135
- cy.waitUntil(() =>
136
- cy.get('#schema-on')
137
- .find('input[type="checkbox"]')
138
- .scrollIntoView()
139
- .then(input => input && input.attr('checked')));
129
+ cy.waitUntil(() => {
130
+ cy.get('#schema-on')
131
+ .find('input[type="checkbox"]')
132
+ .scrollIntoView();
133
+ return cy.get('#schema-on')
134
+ .find('input[type="checkbox"]').then(input => input && input.attr('checked'));
135
+ }
136
+ );
140
137
  });
141
138
  });
142
139
 
143
140
  it('Saving administrator credentials with checked unset password should show modal window to warn user about' +
144
141
  ' unsetting the password', () => {
145
142
  // User role is administrator
146
- cy.get('#noPassword:checkbox').check()
147
- .then(() => {
148
- cy.get('#noPassword:checkbox')
149
- .should('be.checked');
150
- });
143
+ cy.get('#noPassword:checkbox').check();
144
+ cy.get('#noPassword:checkbox').should('be.checked');
151
145
  getSaveButton().click()
152
146
  .then(() => {
153
147
  cy.get('.modal-dialog').find('.lead').contains('If you unset the password and then enable security,' +
@@ -169,20 +163,17 @@ describe('My Settings', () => {
169
163
  });
170
164
 
171
165
  function getSaveButton() {
172
- return cy.get('#wb-user-submit').scrollIntoView().should('be.visible');
166
+ cy.get('#wb-user-submit').scrollIntoView();
167
+ return cy.get('#wb-user-submit').should('be.visible');
173
168
  }
174
169
 
175
170
  function verifyUserSettingsUpdated() {
176
- cy.waitUntil(() =>
177
- cy.get('#toast-container')
178
- .then(toast => toast && toast.text().includes('The user admin was updated')));
171
+ cy.waitUntil(() => ToasterSteps.verifySuccess('The user admin was updated'));
179
172
  }
180
173
 
181
174
  function saveGraphSettings() {
182
- return cy.get('.save-settings-btn')
183
- .scrollIntoView()
184
- .should('be.visible')
185
- .click();
175
+ cy.get('.save-settings-btn').scrollIntoView();
176
+ return cy.get('.save-settings-btn').should('be.visible').click();
186
177
  }
187
178
 
188
179
  function visitSettingsView() {
@@ -201,19 +192,16 @@ describe('My Settings', () => {
201
192
  }
202
193
 
203
194
  function clickLabelBtn(btnId) {
204
- return cy.get(btnId)
205
- .find('.switch.mr-0').scrollIntoView().should('be.visible').click();
195
+ cy.get(btnId).find('.switch.mr-0').scrollIntoView();
196
+ return cy.get(btnId).find('.switch.mr-0').should('be.visible').click();
206
197
  }
207
198
 
208
199
  function turnOnLabelBtn(btnId) {
209
- cy.get(btnId)
210
- .find('input[type="checkbox"]').check({force: true})
211
- .then(() => {
212
- cy.waitUntil(() =>
213
- cy.get(btnId)
214
- .find('input[type="checkbox"]')
215
- .scrollIntoView()
216
- .then(input => input && input.attr('checked')));
217
- });
200
+ cy.get(btnId).find('input[type="checkbox"]').check({force: true});
201
+
202
+ cy.waitUntil(() => {
203
+ cy.get(btnId).find('input[type="checkbox"]').scrollIntoView();
204
+ return cy.get(btnId).find('input[type="checkbox"]').then(input => input && input.attr('checked'));
205
+ });
218
206
  }
219
207
  });
@@ -16,12 +16,12 @@ describe('User and Access', () => {
16
16
  const ROLE_CUSTOM_ADMIN = "#roleAdmin";
17
17
  const DEFAULT_ADMIN_PASSWORD = "root";
18
18
 
19
+ // eslint-disable-next-line no-undef
19
20
  context('', () => {
20
21
  const user = "user";
21
22
 
22
23
  beforeEach(() => {
23
24
  UserAndAccessSteps.visit();
24
- cy.window();
25
25
  // Users table should be visible
26
26
  UserAndAccessSteps.getUsersTable().should('be.visible');
27
27
  });
@@ -30,6 +30,7 @@ describe('User and Access', () => {
30
30
  cy.loginAsAdmin().then(()=> {
31
31
  cy.deleteUser(user, true);
32
32
  cy.switchOffSecurity(true);
33
+ cy.switchOffFreeAccess(false);
33
34
  });
34
35
  });
35
36
 
@@ -142,14 +143,16 @@ describe('User and Access', () => {
142
143
  UserAndAccessSteps.getFreeAccessSwitchInput().should('be.checked');
143
144
  // And I should see a success message
144
145
  ToasterSteps.verifySuccess('Free access has been enabled.');
146
+ ToasterSteps.getToast().should('not.exist')
145
147
  UserAndAccessSteps.getUsersTable().should('be.visible');
146
148
  // When I toggle Free Access OFF
147
149
  UserAndAccessSteps.toggleFreeAccess();
148
150
  // Then I should see a success message
149
- ToasterSteps.verifySuccess('Free access has been disabled.');
151
+ ToasterSteps.getToast().should('exist');
152
+ ToasterSteps.getToasterMessage().should('contain', 'Free access has been disabled.');
150
153
  });
151
154
  })
152
-
155
+ // eslint-disable-next-line no-undef
153
156
  context('GraphQL only', () => {
154
157
  let repositoryId1;
155
158
  let repositoryId2;
@@ -395,6 +398,7 @@ describe('User and Access', () => {
395
398
  function testForUser(name, isAdmin) {
396
399
  //enable security
397
400
  UserAndAccessSteps.toggleSecurity();
401
+ LoginSteps.visitLoginPageWithReturnUrl('/users')
398
402
  //login new user
399
403
  LoginSteps.loginWithUser(name, PASSWORD);
400
404
  //verify permissions
@@ -468,6 +472,7 @@ describe('User and Access', () => {
468
472
 
469
473
  function runChecks(checks = {}) {
470
474
  Object.entries(checks).forEach(([selector, assertions]) => {
475
+ // eslint-disable-next-line cypress/no-assigning-return-values
471
476
  let chain = cy.get(selector);
472
477
 
473
478
  // assertions is an array, e.g. ["exist", ["contain.text", "Hello"], "be.visible"]
@@ -1,7 +1,7 @@
1
1
  import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
2
  import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
3
- import {RepositoriesStub} from "../../../stubs/repositories-stub";
4
3
  import {AutocompleteStubs} from "../../../stubs/autocomplete/autocomplete-stubs";
4
+ import {RepositoriesStubs} from '../../../stubs/repositories/repositories-stubs.js';
5
5
 
6
6
  describe('Expand results over owl:sameAs', () => {
7
7
 
@@ -10,8 +10,8 @@ describe('Expand results over owl:sameAs', () => {
10
10
  beforeEach(() => {
11
11
  repositoryId = 'sparql-editor-' + Date.now();
12
12
  cy.presetRepository(repositoryId);
13
- RepositoriesStub.stubOntopRepository(repositoryId);
14
- RepositoriesStub.stubNameSpaces(repositoryId);
13
+ RepositoriesStubs.stubOntopRepository(repositoryId);
14
+ RepositoriesStubs.stubNameSpaces(repositoryId);
15
15
  AutocompleteStubs.stubAutocompleteEnabled(false);
16
16
  });
17
17
 
@@ -1,10 +1,9 @@
1
- import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
- import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
- import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
4
- import {UserAndAccessSteps} from "../../../steps/setup/user-and-access-steps";
5
- import {SavedQuery} from "../../../steps/yasgui/saved-query";
6
- import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
7
- import {LoginSteps} from "../../../steps/login-steps";
1
+ import {SparqlEditorSteps} from '../../../steps/sparql-editor-steps';
2
+ import {YasguiSteps} from '../../../steps/yasgui/yasgui-steps';
3
+ import {QueryStubs} from '../../../stubs/yasgui/query-stubs';
4
+ import {SavedQuery} from '../../../steps/yasgui/saved-query';
5
+ import {SavedQueriesDialog} from '../../../steps/yasgui/saved-queries-dialog';
6
+ import {LoginSteps} from '../../../steps/login-steps';
8
7
 
9
8
  const USER_NAME = 'saved_query_user';
10
9
  const USER_ADMINISTRATOR = 'admin';
@@ -21,24 +20,21 @@ describe('Readonly saved query', () => {
21
20
  cy.presetRepository(repositoryId);
22
21
  QueryStubs.stubDefaultQueryResponse(repositoryId);
23
22
  cy.createUser({username: USER_NAME, password: PASSWORD});
24
- UserAndAccessSteps.visit();
25
- UserAndAccessSteps.toggleSecurity();
23
+ cy.switchOnSecurity();
26
24
  });
27
25
 
28
26
  afterEach(() => {
29
- cy.loginAsAdmin().then(()=> {
30
- cy.switchOffSecurity(true);
31
- cy.deleteUser(USER_NAME, true);
32
- cy.deleteRepository(repositoryId);
27
+ cy.loginAsAdmin().then(() => {
28
+ cy.switchOffSecurity(true);
29
+ cy.deleteUser(USER_NAME, true);
30
+ cy.deleteRepository(repositoryId);
33
31
  });
34
32
  });
35
33
 
36
34
  it('Should not allow modifying a saved query if it is readonly', () => {
35
+ SparqlEditorSteps.visitSparqlEditorPage()
37
36
  // Given: There is a public saved query created by a user.
38
37
  LoginSteps.loginWithUser(USER_NAME, PASSWORD);
39
- // Wait for the users page to be loaded, before changing the URL to ensure the user is logged in successfully
40
- UserAndAccessSteps.isUsersUrlLoaded();
41
- SparqlEditorSteps.visitSparqlEditorPage();
42
38
  YasguiSteps.getYasgui().should('be.visible');
43
39
  const savedQueryName = SavedQuery.generateQueryName();
44
40
  SavedQuery.create(savedQueryName);
@@ -46,6 +42,7 @@ describe('Readonly saved query', () => {
46
42
 
47
43
  // When: I log in with another user
48
44
  LoginSteps.loginWithUser(USER_ADMINISTRATOR, PASSWORD);
45
+ SparqlEditorSteps.visitSparqlEditorPage();
49
46
  // and open the popup with the saved query.
50
47
  YasguiSteps.showSavedQueries();
51
48
 
@@ -0,0 +1,54 @@
1
+ import {QueryStubs} from '../../stubs/yasgui/query-stubs.js';
2
+ import SparqlSteps from '../../steps/sparql-steps.js';
3
+ import {YasqeSteps} from '../../steps/yasgui/yasqe-steps.js';
4
+
5
+ describe('YASQE Themes', () => {
6
+
7
+ let repositoryId;
8
+ const THEME_PERSISTENCE_KEY = 'ls.workbench-settings';
9
+ beforeEach(() => {
10
+ cy.removeLocalStorage(THEME_PERSISTENCE_KEY);
11
+ repositoryId = 'yasqe-theme-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ cy.enableAutocomplete(repositoryId);
16
+ });
17
+
18
+ afterEach(() => {
19
+ cy.deleteRepository(repositoryId);
20
+ cy.removeLocalStorage(THEME_PERSISTENCE_KEY);
21
+ });
22
+
23
+ it('should apply the default theme if theme is not persisted in local store', () => {
24
+ // GIVEN: No theme is persisted.
25
+ cy.removeLocalStorage(THEME_PERSISTENCE_KEY);
26
+ // WHEN: A page is visited with ontotext-yasgui-web-component rendered in it.
27
+ SparqlSteps.visit();
28
+ YasqeSteps.getYasqe().should('be.visible');
29
+ // THEN the default theme should be applied.
30
+ YasqeSteps.getCodeMirrorEl().should('have.class', 'cm-s-default');
31
+ });
32
+
33
+ it('should apply the default theme if the light theme is persisted in local store', () => {
34
+ // GIVEN: light theme is persisted to local store
35
+ cy.setLocalStorage(THEME_PERSISTENCE_KEY, JSON.stringify({"theme":"default-theme","mode":"light"}));
36
+
37
+ // WHEN: A page is visited with ontotext-yasgui-web-component rendered in it.
38
+ SparqlSteps.visit();
39
+ YasqeSteps.getYasqe().should('be.visible');
40
+ // THEN the default theme should be applied.
41
+ YasqeSteps.getCodeMirrorEl().should('have.class', 'cm-s-default');
42
+ });
43
+
44
+ it('should apply the moxer theme if the dark theme is persisted in local store', () => {
45
+ // GIVEN: dark theme is persisted to local store
46
+ cy.setLocalStorage(THEME_PERSISTENCE_KEY, JSON.stringify({"theme":"default-theme","mode":"dark"}));
47
+
48
+ // WHEN: A page is visited with ontotext-yasgui-web-component rendered in it.
49
+ SparqlSteps.visit();
50
+ YasqeSteps.getYasqe().should('be.visible');
51
+ // THEN the moxer theme should be applied.
52
+ YasqeSteps.getCodeMirrorEl().should('have.class', 'cm-s-moxer');
53
+ });
54
+ });
@@ -1,13 +1,12 @@
1
1
  import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
2
2
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
4
- import {RepositoriesStub} from "../../stubs/repositories-stub";
5
4
  import {TtygAgentSettingsModalSteps} from "../../steps/ttyg/ttyg-agent-settings-modal.steps";
6
5
 
7
6
  describe('TTYG agent list', () => {
8
7
  beforeEach(() => {
9
8
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
10
- RepositoriesStub.stubBaseEndpoints('starwars');
9
+ RepositoriesStubs.stubBaseEndpoints('starwars');
11
10
  cy.presetRepository('starwars');
12
11
  });
13
12
 
@@ -2,7 +2,6 @@ import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
2
2
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
4
4
  import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
5
- import {RepositoriesStub} from "../../stubs/repositories-stub";
6
5
 
7
6
  describe('TTYG agent select menu', () => {
8
7
 
@@ -10,7 +9,7 @@ describe('TTYG agent select menu', () => {
10
9
 
11
10
  beforeEach(() => {
12
11
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
13
- RepositoriesStub.stubBaseEndpoints(repositoryId);
12
+ RepositoriesStubs.stubBaseEndpoints(repositoryId);
14
13
  cy.presetRepository(repositoryId);
15
14
  TTYGStubs.stubChatsListGetNoResults();
16
15
  });
@@ -6,13 +6,12 @@ import {ApplicationSteps} from "../../steps/application-steps";
6
6
  import HomeSteps from "../../steps/home-steps";
7
7
  import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
8
8
  import {AlertDialogSteps} from "../../steps/alert-dialog-steps";
9
- import {RepositoriesStub} from "../../stubs/repositories-stub";
10
9
 
11
10
  describe('TTYG chat list', () => {
12
11
 
13
12
  beforeEach(() => {
14
13
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
15
- RepositoriesStub.stubBaseEndpoints('starwars');
14
+ RepositoriesStubs.stubBaseEndpoints('starwars');
16
15
  cy.presetRepository('starwars');
17
16
  });
18
17
 
@@ -3,14 +3,13 @@ import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
4
4
  import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
5
5
  import {ApplicationSteps} from "../../steps/application-steps";
6
- import {RepositoriesStub} from "../../stubs/repositories-stub";
7
6
 
8
7
  describe('Ttyg ChatPanel', () => {
9
8
 
10
9
  beforeEach(() => {
11
10
  // Create an actual repository to prevent stubbing all background requests that are not related to the ttyg view
12
11
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
13
- RepositoriesStub.stubBaseEndpoints('starwars');
12
+ RepositoriesStubs.stubBaseEndpoints('starwars');
14
13
  cy.presetRepository('starwars');
15
14
  TTYGStubs.stubChatsListGet();
16
15
  TTYGStubs.stubAgentListGet();
@@ -2,14 +2,13 @@ import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
2
2
  import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
3
3
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
4
4
  import {TtygAgentSettingsModalSteps} from "../../steps/ttyg/ttyg-agent-settings-modal.steps";
5
- import {RepositoriesStub} from "../../stubs/repositories-stub";
6
5
 
7
6
  describe('TTYG clone an agent', () => {
8
7
  const repositoryId = 'starwars';
9
8
 
10
9
  beforeEach(() => {
11
10
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
12
- RepositoriesStub.stubBaseEndpoints(repositoryId);
11
+ RepositoriesStubs.stubBaseEndpoints(repositoryId);
13
12
  cy.presetRepository(repositoryId);
14
13
  TTYGStubs.stubAgentDefaultsGet();
15
14
  });
@@ -3,8 +3,7 @@ import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
4
4
  import {TtygAgentSettingsModalSteps} from "../../steps/ttyg/ttyg-agent-settings-modal.steps";
5
5
  import {ConnectorStubs} from "../../stubs/connector-stubs";
6
- import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
7
- import {RepositoriesStub} from "../../stubs/repositories-stub";
6
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps"
8
7
  import {AlertDialogSteps} from "../../steps/alert-dialog-steps";
9
8
  import {ApplicationSteps} from '../../steps/application-steps.js';
10
9
 
@@ -13,7 +12,7 @@ describe('TTYG create new agent', () => {
13
12
 
14
13
  beforeEach(() => {
15
14
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
16
- RepositoriesStub.stubBaseEndpoints(repositoryId);
15
+ RepositoriesStubs.stubBaseEndpoints(repositoryId);
17
16
  cy.presetRepository(repositoryId);
18
17
  TTYGStubs.stubAgentDefaultsGet();
19
18
  });
@@ -1,5 +1,4 @@
1
1
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
2
- import {RepositoriesStub} from "../../stubs/repositories-stub";
3
2
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
4
3
  import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
5
4
  import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
@@ -9,7 +8,7 @@ describe('TTYG create chat', () => {
9
8
  beforeEach(() => {
10
9
  // Create an actual repository to prevent stubbing all background requests that are not related to the ttyg view
11
10
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
12
- RepositoriesStub.stubBaseEndpoints('starwars');
11
+ RepositoriesStubs.stubBaseEndpoints('starwars');
13
12
  cy.presetRepository('starwars');
14
13
  TTYGStubs.stubChatsListGet("/ttyg/chats/create/get-chats-before-create.json");
15
14
  TTYGStubs.stubAgentListGet();
@@ -2,14 +2,13 @@ import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
2
2
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
4
4
  import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
5
- import {RepositoriesStub} from "../../stubs/repositories-stub";
6
5
 
7
6
  describe('TTYG delete agent', () => {
8
7
  const repositoryId = 'starwars';
9
8
 
10
9
  beforeEach(() => {
11
10
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
12
- RepositoriesStub.stubBaseEndpoints(repositoryId);
11
+ RepositoriesStubs.stubBaseEndpoints(repositoryId);
13
12
  cy.presetRepository(repositoryId);
14
13
  });
15
14