graphdb-workbench-tests 3.1.0-WBM-9 → 3.1.0-plugins1

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 (71) hide show
  1. package/.nycrc +10 -0
  2. package/cypress-legacy.config.js +9 -1
  3. package/cypress-security.config.js +40 -0
  4. package/cypress.config.js +3 -1
  5. package/e2e-flaky/import/import-user-data-url.spec.js +63 -0
  6. package/e2e-legacy/explore/graphs-overview/graphs.overview.spec.js +1 -1
  7. package/e2e-legacy/graphql/filter-graphql-endpoints-on-management-view.spec.js +1 -4
  8. package/e2e-legacy/graphql/graphql-endpoint-management-view.spec.js +4 -4
  9. package/e2e-legacy/graphql/import-graphql-endpoint-definitions.spec.js +1 -10
  10. package/e2e-legacy/home/cookie-policy.spec.js +78 -59
  11. package/e2e-legacy/home/documentation-link.spec.js +31 -33
  12. package/e2e-legacy/home/google-analytics.spec.js +4 -6
  13. package/e2e-legacy/home/rdf-resource-search.spec.js +106 -138
  14. package/e2e-legacy/home/view-resource-autocomplete.spec.js +28 -15
  15. package/e2e-legacy/import/import-user-data-url.spec.js +0 -23
  16. package/e2e-legacy/import/import-user-data.spec.js +1 -2
  17. package/e2e-legacy/monitor/global-operation-statuses-component.spec.js +13 -9
  18. package/e2e-legacy/repository/repositories.spec.js +6 -6
  19. package/e2e-legacy/setup/autocomplete/autocomplete.spec.js +3 -4
  20. package/e2e-legacy/setup/jdbc/jdbc-create.spec.js +2 -2
  21. package/e2e-legacy/setup/sparql-template/sparql-template-create.js +10 -3
  22. package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +38 -9
  23. package/e2e-legacy/sparql-editor/saved-query/edit-query.spec.js +3 -6
  24. package/e2e-legacy/sparql-editor/saved-query/share-query.spec.js +2 -2
  25. package/e2e-legacy/ttyg/agent-list.spec.js +37 -2
  26. package/e2e-legacy/ttyg/chat-list.spec.js +1 -2
  27. package/e2e-legacy/ttyg/clone-agent.spec.js +1 -0
  28. package/e2e-legacy/ttyg/create-agent.spec.js +7 -6
  29. package/e2e-legacy/ttyg/edit-agent.spec.js +69 -9
  30. package/e2e-legacy/ttyg/ttyg-initial-state-with-selected-repository.spec.js +4 -2
  31. package/e2e-legacy/ttyg/ttyg-permission.spec.js +28 -20
  32. package/e2e-security/setup/home/cookie-policy.spec.js +64 -0
  33. package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +184 -0
  34. package/e2e-security/setup/users-and-access/graphql-user.spec.js +123 -0
  35. package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +69 -0
  36. package/e2e-security/setup/users-and-access/turn-on-security-and-password-change.spec.js +87 -0
  37. package/e2e-security/setup/users-and-access/user-and-access.spec.js +87 -0
  38. package/e2e-security/setup/users-and-access/users-and-access-initial-state.spec.js +38 -0
  39. package/fixtures/repositories/free-access.json +13 -0
  40. package/fixtures/ttyg/agent/get-agent-defaults-assistant-api.json +44 -0
  41. package/fixtures/ttyg/agent/get-agent-defaults.json +2 -0
  42. package/npm-shrinkwrap.json +7574 -1775
  43. package/package.json +9 -3
  44. package/plugins/index.js +1 -0
  45. package/steps/base-steps.js +4 -0
  46. package/steps/error-steps.js +4 -7
  47. package/steps/graphql/graphql-endpoint-management-steps.js +1 -1
  48. package/steps/home-steps.js +57 -32
  49. package/steps/import/import-steps.js +2 -2
  50. package/steps/login-steps.js +11 -0
  51. package/steps/main-menu-steps.js +13 -6
  52. package/steps/operations-statuses-component-steps.js +5 -10
  53. package/steps/rdf-resource-search-steps.js +55 -0
  54. package/steps/repository-steps.js +1 -0
  55. package/steps/setup/autocomplete-steps.js +4 -0
  56. package/steps/setup/settings-steps.js +18 -0
  57. package/steps/setup/user-and-access-steps.js +24 -2
  58. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +74 -11
  59. package/steps/ttyg/ttyg-view-steps.js +19 -4
  60. package/steps/widgets/active-repository-widget-steps.js +4 -0
  61. package/steps/yasgui/yasr-steps.js +4 -0
  62. package/stubs/browser-stubs.js +21 -0
  63. package/stubs/environment-stubs.js +9 -1
  64. package/stubs/repositories/repositories-stubs.js +4 -0
  65. package/stubs/security-stubs.js +4 -0
  66. package/stubs/ttyg/ttyg-stubs.js +18 -2
  67. package/support/e2e.js +2 -1
  68. package/support/repository-commands.js +14 -1
  69. package/e2e-flaky/setup/users-and-access/security-and-free-access.spec.js +0 -57
  70. package/e2e-flaky/ttyg/ttyg-permission.spec.js +0 -67
  71. package/fixtures/locale-en.json +0 -3361
package/.nycrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "temp-directory": "../.nyc_output",
3
+ "include": [
4
+ "packages/legacy-workbench/src/**/*.js"
5
+ ],
6
+ "exclude": [
7
+ "packages/root-config/**",
8
+ "packages/shared-components/**"
9
+ ]
10
+ }
@@ -1,5 +1,7 @@
1
1
  const {defineConfig} = require('cypress');
2
2
 
3
+ const isCoverage = process.env.COVERAGE === 'true';
4
+
3
5
  module.exports = defineConfig({
4
6
  projectId: 'v35btb',
5
7
  fixturesFolder: 'fixtures',
@@ -8,6 +10,8 @@ module.exports = defineConfig({
8
10
  video: true,
9
11
  defaultCommandTimeout: 25000,
10
12
  numTestsKeptInMemory: 10,
13
+ viewportWidth: 1280,
14
+ viewportHeight: 720,
11
15
  e2e: {
12
16
  retries: {
13
17
  runMode: 2,
@@ -16,7 +20,11 @@ module.exports = defineConfig({
16
20
  // We've imported your old cypress plugins here.
17
21
  // You may want to clean this up later by importing these.
18
22
  setupNodeEvents(on, config) {
19
- return require('./plugins')(on, config);
23
+ require('./plugins')(on, config);
24
+ if (isCoverage) {
25
+ require('@bahmutov/cypress-code-coverage/plugin')(on, config)
26
+ }
27
+ return config;
20
28
  },
21
29
  baseUrl: 'http://localhost:9000',
22
30
  specPattern: 'e2e-legacy/**/*.{js,jsx,ts,tsx}',
@@ -0,0 +1,40 @@
1
+ const {defineConfig} = require('cypress');
2
+
3
+ const isCoverage = process.env.COVERAGE === 'true';
4
+
5
+ module.exports = defineConfig({
6
+ projectId: 'v35btb',
7
+ fixturesFolder: 'fixtures',
8
+ screenshotsFolder: 'report/screenshots',
9
+ videosFolder: 'report/videos',
10
+ video: true,
11
+ defaultCommandTimeout: 25000,
12
+ numTestsKeptInMemory: 10,
13
+ viewportWidth: 1280,
14
+ viewportHeight: 720,
15
+ e2e: {
16
+ retries: {
17
+ runMode: 2,
18
+ openMode: 0
19
+ },
20
+ // We've imported your old cypress plugins here.
21
+ // You may want to clean this up later by importing these.
22
+ setupNodeEvents(on, config) {
23
+ require('./plugins')(on, config);
24
+ if (isCoverage) {
25
+ require('@bahmutov/cypress-code-coverage/plugin')(on, config)
26
+ }
27
+ return config;
28
+ },
29
+ baseUrl: 'http://localhost:9000',
30
+ specPattern: 'e2e-security/**/*.{js,jsx,ts,tsx}',
31
+ supportFile: 'support/e2e.js',
32
+ reporter: "cypress-multi-reporters",
33
+ reporterOptions: {
34
+ configFile: 'cypress-reporter-config.json'
35
+ }
36
+ },
37
+ env: {
38
+ set_default_user_data: true
39
+ }
40
+ });
package/cypress.config.js CHANGED
@@ -8,8 +8,10 @@ module.exports = defineConfig({
8
8
  video: true,
9
9
  screenshotOnRunFailure: true,
10
10
  trashAssetsBeforeRuns: true,
11
- defaultCommandTimeout: 40000,
11
+ defaultCommandTimeout: 10000,
12
12
  numTestsKeptInMemory: 10,
13
+ viewportWidth: 1280,
14
+ viewportHeight: 720,
13
15
  e2e: {
14
16
  retries: {
15
17
  runMode: 2,
@@ -0,0 +1,63 @@
1
+ import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
2
+ import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
3
+
4
+ describe('Import user data: URL import', () => {
5
+
6
+ let repositoryId;
7
+
8
+ const IMPORT_URL = 'https://www.w3.org/TR/owl-guide/wine.rdf';
9
+ const JSONLD_FORMAT = 'JSON-LD';
10
+ const VALID_URL_RDF_FORMAT = 'RDF/XML';
11
+ const RDF_ERROR_MESSAGE = 'RDF Parse Error:';
12
+ const IMPORT_JSONLD_URL = 'https://example.com/0007-context.jsonld';
13
+
14
+ beforeEach(() => {
15
+ repositoryId = 'user-import-' + Date.now();
16
+ cy.createRepository({id: repositoryId});
17
+ ImportUserDataSteps.visitUserImport(repositoryId);
18
+ });
19
+
20
+ afterEach(() => {
21
+ cy.deleteRepository(repositoryId);
22
+ });
23
+
24
+ // Test fails because GDB waits for the import link to be resolved and since it is invalid it waits for a timeout, blocking all other requests
25
+ it('should import JSON-LD file via URL with correct request body', () => {
26
+ cy.intercept('GET', `/rest/repositories/${repositoryId}/import/upload`).as('upload');
27
+
28
+ ImportUserDataSteps.stubPostJSONLDFromURL(repositoryId);
29
+ ImportUserDataSteps.openImportURLDialog(IMPORT_JSONLD_URL);
30
+ ImportUserDataSteps.selectRDFFormat(JSONLD_FORMAT);
31
+ ImportUserDataSteps.clickImportUrlButton();
32
+ ImportSettingsDialogSteps.import();
33
+ cy.wait('@postJsonldUrl').then((xhr) => {
34
+ expect(xhr.request.body.name).to.eq('https://example.com/0007-context.jsonld');
35
+ expect(xhr.request.body.data).to.eq('https://example.com/0007-context.jsonld');
36
+ expect(xhr.request.body.type).to.eq('url');
37
+ expect(xhr.request.body.hasContextLink).to.be.true;
38
+ });
39
+ cy.waitUntil(() =>
40
+ cy.wait('@upload').then((xhr) => {
41
+ console.log(xhr.response.body)
42
+ return xhr.response.body[0]?.status === 'ERROR'
43
+ }), {timeout: 10000, interval: 1000}
44
+ )
45
+ });
46
+
47
+ it('should show error on invalid JSON-LD URL', () => {
48
+ cy.intercept('GET', `/rest/repositories/${repositoryId}/import/upload`).as('upload');
49
+
50
+ ImportUserDataSteps.stubPostJSONLDFromURL();
51
+ ImportUserDataSteps.openImportURLDialog(IMPORT_JSONLD_URL);
52
+ ImportUserDataSteps.selectRDFFormat(JSONLD_FORMAT);
53
+ ImportUserDataSteps.clickImportUrlButton();
54
+ ImportSettingsDialogSteps.import();
55
+ cy.waitUntil(() =>
56
+ cy.wait('@upload').then((xhr) => {
57
+ console.log(xhr.response.body)
58
+ return xhr.response.body[0]?.status === 'ERROR'
59
+ }), {timeout: 10000, interval: 1000}
60
+ )
61
+ ImportUserDataSteps.checkImportedResource(0, IMPORT_JSONLD_URL, 'https://example.com/0007-context.jsonld');
62
+ });
63
+ });
@@ -125,7 +125,7 @@ describe('Graphs overview screen validation', () => {
125
125
  verifyVisibleGraphsCount(1);
126
126
  verifyGraphExistence('The default graph');
127
127
  // open default graph through the link and verify that the table view is rendered
128
- cy.contains('The default graph').click();
128
+ cy.getByTestId('graph-is-not-shaql').contains('The default graph').trigger('mouseover').click();
129
129
  cy.url().should('contain', Cypress.config('baseUrl') + '/resource');
130
130
  YasrSteps.getResultTableHeader().should('be.visible');
131
131
  YasrSteps.getResultTableHeaderColumns().should('have.length', 5);
@@ -17,10 +17,7 @@ describe('GraphQL endpoints filtering', () => {
17
17
  cy.deleteRepository(repositoryId);
18
18
  });
19
19
 
20
- /**
21
- * TODO Fixme broken due migration (Error unknown)
22
- */
23
- it.skip('should be able to filter endpoints', () => {
20
+ it('should be able to filter endpoints', () => {
24
21
  // Given I have a repository with active GraphQL endpoints
25
22
  // When I visit the endpoint management view
26
23
  GraphqlEndpointManagementSteps.visit();
@@ -69,6 +69,8 @@ describe('GraphQL endpoints management', () => {
69
69
  // Given I have a repository with active GraphQL endpoints
70
70
  // When I visit the endpoint management view
71
71
  GraphqlEndpointManagementSteps.visit();
72
+ // And I toggle the 3rd endpoint's active state to inactive
73
+ GraphqlEndpointManagementSteps.toggleEndpointActiveState(2);
72
74
  // Then I should see the endpoints info
73
75
  GraphqlEndpointManagementSteps.getEndpointTable().within(() => {
74
76
  cy.get('thead th').should('have.length', 10);
@@ -85,7 +87,6 @@ describe('GraphQL endpoints management', () => {
85
87
  GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
86
88
  GraphqlEndpointManagementSteps.verifyEndpointInfo([
87
89
  {
88
- status: 'deleted',
89
90
  id: 'swapi',
90
91
  label: 'Ontotext Star Wars Ontology',
91
92
  description: '',
@@ -96,7 +97,6 @@ describe('GraphQL endpoints management', () => {
96
97
  properties: 68
97
98
  },
98
99
  {
99
- status: 'deleted',
100
100
  id: 'swapi-planets',
101
101
  label: 'Star Wars planets API',
102
102
  description: '',
@@ -107,12 +107,12 @@ describe('GraphQL endpoints management', () => {
107
107
  properties: 10
108
108
  },
109
109
  {
110
- status: 'deleted',
110
+ status: "deleted",
111
111
  id: 'swapi-species',
112
112
  label: 'Star Wars species API',
113
113
  description: '',
114
114
  default: false,
115
- active: true,
115
+ active: false,
116
116
  modified: ApplicationSteps.getCurrentDate(),
117
117
  types: 2,
118
118
  properties: 17
@@ -73,7 +73,6 @@ describe('Graphql: import endpoint definitions', () => {
73
73
 
74
74
  GraphqlEndpointManagementSteps.verifyEndpointInfo([
75
75
  {
76
- status: 'deleted',
77
76
  id: 'swapi',
78
77
  label: 'Ontotext Star Wars Ontology',
79
78
  description: '',
@@ -86,10 +85,7 @@ describe('Graphql: import endpoint definitions', () => {
86
85
  ]);
87
86
  });
88
87
 
89
- /**
90
- * TODO Fixme broken due migration (Error unknown)
91
- */
92
- it.skip('should be able to import broken endpoint definition', () => {
88
+ it('should be able to import broken endpoint definition', () => {
93
89
  visitAndOpenImportModal();
94
90
  // When I select the file to upload
95
91
  ImportEndpointDefinitionModalSteps.selectFile(brokenSwapiDefinitionPath);
@@ -170,7 +166,6 @@ describe('Graphql: import endpoint definitions', () => {
170
166
  GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 3);
171
167
  GraphqlEndpointManagementSteps.verifyEndpointInfo([
172
168
  {
173
- status: 'deleted',
174
169
  id: 'swapi',
175
170
  label: 'Ontotext Star Wars Ontology',
176
171
  description: '',
@@ -181,7 +176,6 @@ describe('Graphql: import endpoint definitions', () => {
181
176
  properties: 68
182
177
  },
183
178
  {
184
- status: 'deleted',
185
179
  id: 'swapi-planets',
186
180
  label: 'Star Wars planets API',
187
181
  description: '',
@@ -192,7 +186,6 @@ describe('Graphql: import endpoint definitions', () => {
192
186
  properties: 10
193
187
  },
194
188
  {
195
- status: 'deleted',
196
189
  id: 'swapi-species',
197
190
  label: 'Star Wars species API',
198
191
  description: '',
@@ -236,7 +229,6 @@ describe('Graphql: import endpoint definitions', () => {
236
229
  GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 2);
237
230
  GraphqlEndpointManagementSteps.verifyEndpointInfo([
238
231
  {
239
- status: 'deleted',
240
232
  id: 'swapi-planets',
241
233
  label: 'Star Wars planets API',
242
234
  description: '',
@@ -247,7 +239,6 @@ describe('Graphql: import endpoint definitions', () => {
247
239
  properties: 10
248
240
  },
249
241
  {
250
- status: 'deleted',
251
242
  id: 'swapi-species',
252
243
  label: 'Star Wars species API',
253
244
  description: '',
@@ -7,10 +7,7 @@ import {LicenseStubs} from "../../stubs/license-stubs";
7
7
  Cypress.env('set_default_user_data', false);
8
8
 
9
9
 
10
- /**
11
- * TODO: Fix me. Broken due to migration (Cookie policy is not implemented in the new footer)
12
- */
13
- describe.skip('Cookie policy', () => {
10
+ describe('Cookie policy', () => {
14
11
  beforeEach(() => {
15
12
  cy.setDefaultUserData(false);
16
13
  cy.viewport(1280, 1000);
@@ -19,71 +16,93 @@ describe.skip('Cookie policy', () => {
19
16
 
20
17
  afterEach(() => cy.setDefaultUserData());
21
18
 
22
- it('Should show consent popup to user', () => {
23
- HomeSteps.visit();
24
- EnvironmentStubs.stubWbProdMode();
25
- HomeSteps.getCookieConsentPopup().should('exist').and('be.visible');
26
- // When I click on the link
27
- HomeSteps.clickCookiePolicyLink();
28
- // Then I see the cookie policy
29
- HomeSteps.getCookiePolicyModal().should('exist').and('be.visible');
30
- });
19
+ context('should show', () => {
20
+ it('Should show consent popup to user', () => {
21
+ HomeSteps.visitInProdMode();
22
+ HomeSteps.getCookieConsentPopup().should('exist').and('be.visible');
23
+ // When I click on the link
24
+ HomeSteps.clickCookiePolicyLink();
25
+ // Then I see the cookie policy
26
+ HomeSteps.getCookiePolicyModal().should('exist').and('be.visible');
27
+ });
31
28
 
32
- it('Should show cookie policy to user in user settings', () => {
33
- SettingsSteps.visit();
34
- EnvironmentStubs.stubWbProdMode();
35
- SettingsSteps.getCookiePolicyButton().should('exist').and('be.visible');
29
+ it('Should show cookie policy to user in user settings', () => {
30
+ SettingsSteps.visitInProdMode();
31
+ SettingsSteps.getCookiePolicyButton().should('exist').and('be.visible');
36
32
 
37
- // When I click on the link
38
- SettingsSteps.clickCookiePolicyLink();
39
- // Then I see the cookie policy
40
- SettingsSteps.getCookiePolicyModal().should('exist').and('be.visible');
41
- });
33
+ // When I click on the link
34
+ SettingsSteps.clickCookiePolicyLink();
35
+ // Then I see the cookie policy
36
+ SettingsSteps.getCookiePolicyModal().should('exist').and('be.visible');
37
+ });
42
38
 
43
- it('Should NOT show consent popup to user when tracking is not applicable', () => {
44
- HomeSteps.visit();
45
- HomeSteps.getCookieConsentPopup().should('not.exist');
46
- });
39
+ it('Should save consent in user settings', () => {
40
+ HomeSteps.visitInProdMode();
41
+ SecurityStubs.stubUpdateUserData('admin');
47
42
 
48
- it('Should NOT show cookie policy to user when tracking is not applicable', () => {
49
- SettingsSteps.visit();
50
- SettingsSteps.getCookiePolicyButton().should('not.exist');
51
- });
43
+ // When I click Agree button
44
+ HomeSteps.clickAgreeButton();
45
+
46
+ // I expect to save cookie consent in user settings
47
+ cy.wait('@updateUser').then((xhr) => {
48
+ expect(xhr.request.body.appSettings).to.include({
49
+ DEFAULT_INFERENCE: true,
50
+ DEFAULT_VIS_GRAPH_SCHEMA: true,
51
+ DEFAULT_SAMEAS: true,
52
+ IGNORE_SHARED_QUERIES: false,
53
+ EXECUTE_COUNT: true
54
+ });
55
+
56
+ // Assert COOKIE_CONSENT properties, excluding updatedAt
57
+ expect(xhr.request.body.appSettings.COOKIE_CONSENT).to.include({
58
+ policyAccepted: true
59
+ });
52
60
 
53
- it('Should save consent in user settings', () => {
54
- HomeSteps.visit();
55
- EnvironmentStubs.stubWbProdMode();
56
- SecurityStubs.stubUpdateUserData('admin');
57
-
58
- // When I click Agree button
59
- HomeSteps.clickAgreeButton();
60
-
61
- // I expect to save cookie consent in user settings
62
- cy.wait('@updateUser').then((xhr) => {
63
- expect(xhr.request.body.appSettings).to.include({
64
- DEFAULT_INFERENCE: true,
65
- DEFAULT_VIS_GRAPH_SCHEMA: true,
66
- DEFAULT_SAMEAS: true,
67
- IGNORE_SHARED_QUERIES: false,
68
- EXECUTE_COUNT: true
61
+ // Assert that updatedAt is present, is a number, and is a reasonable timestamp
62
+ const updatedAt = xhr.request.body.appSettings.COOKIE_CONSENT.updatedAt;
63
+ expect(updatedAt).to.exist;
64
+ expect(updatedAt).to.be.a('number');
65
+
66
+ // Check that updatedAt is within 1 hour of the current time
67
+ const oneHourInMilliseconds = 60 * 60 * 1000;
68
+ const now = Date.now();
69
+ expect(updatedAt).to.be.within(now - oneHourInMilliseconds, now + oneHourInMilliseconds);
69
70
  });
71
+ });
72
+
73
+ it('Should set cookies for tracking when accepted', () => {
74
+ HomeSteps.visitInProdMode();
75
+ SecurityStubs.stubUpdateUserData('admin');
76
+
77
+ // When I click Agree button
78
+ HomeSteps.clickAgreeButton();
70
79
 
71
- // Assert COOKIE_CONSENT properties, excluding updatedAt
72
- expect(xhr.request.body.appSettings.COOKIE_CONSENT).to.include({
73
- policyAccepted: true,
74
- statistic: true,
75
- thirdParty: true
80
+ // I expect to save cookie consent in user settings
81
+ cy.wait('@updateUser');
82
+
83
+ // Check if the GA tracking script is set correctly in the head
84
+ cy.document()
85
+ .get('head script')
86
+ .should("have.attr", "src")
87
+ .should('include', 'https://www.googletagmanager.com/gtm.js?id=GTM-WBP6C6Z4');
88
+
89
+ // Check if the installation ID cookie is set correctly
90
+ cy.getCookie('_wb').then((cookie) => {
91
+ expect(cookie).to.exist;
92
+ expect(cookie.value).to.match(/^WB1\.[a-zA-Z0-9\-]+\.\d+$/); // Check the cookie structure: WB1.<installationId>.<timestamp>
76
93
  });
94
+ })
95
+ })
77
96
 
78
- // Assert that updatedAt is present, is a number, and is a reasonable timestamp
79
- const updatedAt = xhr.request.body.appSettings.COOKIE_CONSENT.updatedAt;
80
- expect(updatedAt).to.exist;
81
- expect(updatedAt).to.be.a('number');
97
+ context('should not show', () => {
98
+ it('Should NOT show consent popup to user when tracking is not applicable', () => {
99
+ HomeSteps.visitInDevMode();
100
+ HomeSteps.getCookieConsentPopup().should('not.exist');
101
+ });
82
102
 
83
- // Check that updatedAt is within 1 hour of the current time
84
- const oneHourInMilliseconds = 60 * 60 * 1000;
85
- const now = Date.now();
86
- expect(updatedAt).to.be.within(now - oneHourInMilliseconds, now + oneHourInMilliseconds);
103
+ it('Should NOT show cookie policy to user when tracking is not applicable', () => {
104
+ SettingsSteps.visitInDevMode();
105
+ SettingsSteps.getCookiePolicyButton().should('not.exist');
87
106
  });
88
107
  });
89
108
  });
@@ -1,63 +1,61 @@
1
1
  import HomeSteps from '../../steps/home-steps';
2
2
  import {EnvironmentStubs} from "../../stubs/environment-stubs";
3
+ import {MainMenuSteps} from "../../steps/main-menu-steps";
4
+ import {BrowserStubs} from "../../stubs/browser-stubs";
3
5
 
4
- /**
5
- * TODO: Fix me. Broken due to migration (The main menu is changed)
6
- */
7
- describe.skip('Documentation links resolver', () => {
6
+ describe('Documentation links resolver', () => {
8
7
 
9
8
  beforeEach(() => {
10
9
  cy.viewport(1280, 1000);
10
+ EnvironmentStubs.spyProductInfo();
11
11
  });
12
12
 
13
13
  it('Should link to master version when in dev mode', () => {
14
- HomeSteps.visit();
15
- EnvironmentStubs.stubWbDevMode();
16
- HomeSteps.clickHelpMenu();
14
+ HomeSteps.visitInDevMode();
15
+ waitForProductInfo();
16
+ BrowserStubs.stubWindowOpen();
17
+ MainMenuSteps.clickOnMenuHelp();
17
18
  // Assert that links point to the master version
18
19
  assertDocumentationLinks('master');
20
+
19
21
  });
20
22
 
21
23
  it('Should link to master version when in prod mode and unofficial version', () => {
22
24
  EnvironmentStubs.stubProductInfo('10.8-TR1-test');
23
- HomeSteps.visit();
24
- EnvironmentStubs.stubWbProdMode();
25
- HomeSteps.clickHelpMenu();
25
+ HomeSteps.visitInProdMode();
26
+ waitForProductInfo();
27
+ BrowserStubs.stubWindowOpen();
28
+ MainMenuSteps.clickOnMenuHelp();
26
29
  // Assert that links point to the master version
27
30
  assertDocumentationLinks('master');
28
31
  });
29
32
 
30
33
  it('Should link to GDB version when in prod mode and official version', () => {
31
34
  EnvironmentStubs.stubProductInfo('10.8');
32
- HomeSteps.visit();
33
- EnvironmentStubs.stubWbProdMode();
34
- HomeSteps.clickHelpMenu();
35
+ HomeSteps.visitInProdMode();
36
+ waitForProductInfo();
37
+ BrowserStubs.stubWindowOpen();
38
+ MainMenuSteps.clickOnMenuHelp();
35
39
  // Assert that links point to the specific GDB version
36
40
  assertDocumentationLinks('10.8');
37
41
  });
38
42
  });
39
43
 
44
+ function waitForProductInfo() {
45
+ // We must wait for both requests, old legacy one and the new from the API
46
+ cy.wait(EnvironmentStubs.PRODUCT_INFO_ALIAS());
47
+ cy.wait(EnvironmentStubs.PRODUCT_INFO_ALIAS());
48
+ }
49
+
40
50
  function assertDocumentationLinks(version) {
41
51
  const baseUrl = `https://graphdb.ontotext.com/documentation/${version}`;
42
52
 
43
- HomeSteps.getDocumentationLink()
44
- .should('exist')
45
- .and('be.visible')
46
- .find('a')
47
- .should('have.attr', 'href', `${baseUrl}/index.html`)
48
- .and('contain.text', 'Documentation');
49
-
50
- HomeSteps.getTutorialsLink()
51
- .should('exist')
52
- .and('be.visible')
53
- .find('a')
54
- .should('have.attr', 'href', `${baseUrl}/tutorials.html`)
55
- .and('contain.text', 'Tutorials');
56
-
57
- HomeSteps.getSupportLink()
58
- .should('exist')
59
- .and('be.visible')
60
- .find('a')
61
- .should('have.attr', 'href', `${baseUrl}/support.html`)
62
- .and('contain.text', 'Support');
53
+ MainMenuSteps.clickOnSubMenu('Documentation')
54
+ cy.get(BrowserStubs.WINDOW_OPEN_ALIAS()).should('have.been.calledWithMatch', `${baseUrl}/index.html`, "_blank")
55
+
56
+ MainMenuSteps.clickOnSubMenu('Tutorials')
57
+ cy.get(BrowserStubs.WINDOW_OPEN_ALIAS()).should('have.been.calledWithMatch', `${baseUrl}/tutorials.html`, "_blank")
58
+
59
+ MainMenuSteps.clickOnSubMenu('Support')
60
+ cy.get(BrowserStubs.WINDOW_OPEN_ALIAS()).should('have.been.calledWithMatch', `${baseUrl}/support.html`, "_blank")
63
61
  }
@@ -11,9 +11,9 @@ describe('Google analytics', () => {
11
11
  // Note: Google API calls are stubbed for all specs in support/index.js
12
12
  it('Should set GA tracking code in header and a cookie when free license and prodMode', () => {
13
13
  LicenseStubs.stubFreeLicense();
14
- HomeSteps.visit();
15
- EnvironmentStubs.stubWbProdMode();
14
+ HomeSteps.visitInProdMode();
16
15
 
16
+ // Check if the GA tracking script is set correctly in the head
17
17
  cy.document()
18
18
  .get('head script')
19
19
  .should("have.attr", "src")
@@ -28,8 +28,7 @@ describe('Google analytics', () => {
28
28
 
29
29
  it('Should set GA tracking code in header and cookie when evaluation enterprise license and prodMode', () => {
30
30
  LicenseStubs.stubEvaluationLicense();
31
- HomeSteps.visit();
32
- EnvironmentStubs.stubWbProdMode();
31
+ HomeSteps.visitInProdMode();
33
32
 
34
33
  cy.document()
35
34
  .get('head script')
@@ -45,8 +44,7 @@ describe('Google analytics', () => {
45
44
 
46
45
  it('Should NOT set GA tracking code in header and cookie when enterprise license in prodMode', () => {
47
46
  LicenseStubs.stubEnterpriseLicense();
48
- HomeSteps.visit();
49
- EnvironmentStubs.stubWbProdMode();
47
+ HomeSteps.visitInProdMode();
50
48
 
51
49
  cy.document()
52
50
  .get('head script')