graphdb-workbench-tests 3.0.1-RC2 → 3.0.1

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.
package/cypress.config.js CHANGED
@@ -9,6 +9,10 @@ module.exports = defineConfig({
9
9
  defaultCommandTimeout: 40000,
10
10
  numTestsKeptInMemory: 10,
11
11
  e2e: {
12
+ retries: {
13
+ runMode: 2,
14
+ openMode: 0
15
+ },
12
16
  // We've imported your old cypress plugins here.
13
17
  // You may want to clean this up later by importing these.
14
18
  setupNodeEvents(on, config) {
@@ -2,6 +2,7 @@ import HomeSteps from '../../steps/home-steps';
2
2
  import {EnvironmentStubs} from "../../stubs/environment-stubs";
3
3
  import {SecurityStubs} from "../../stubs/security-stubs";
4
4
  import {SettingsSteps} from "../../steps/setup/settings-steps";
5
+ import {LicenseStubs} from "../../stubs/license-stubs";
5
6
 
6
7
  Cypress.env('set_default_user_data', false);
7
8
 
@@ -9,6 +10,7 @@ describe('Cookie policy', () => {
9
10
  beforeEach(() => {
10
11
  cy.setDefaultUserData(false);
11
12
  cy.viewport(1280, 1000);
13
+ LicenseStubs.stubFreeLicense();
12
14
  });
13
15
 
14
16
  afterEach(() => cy.setDefaultUserData());
@@ -248,40 +248,6 @@ describe('User and Access', () => {
248
248
  }
249
249
  });
250
250
  });
251
- });
252
-
253
- context('GraphQL only and Free Access', () => {
254
- let repositoryId1;
255
- let repositoryId2;
256
- let repositoryId3;
257
- const graphqlUser = 'graphqlUser';
258
-
259
- beforeEach(() => {
260
- cy.viewport(1280, 1000);
261
- RepositoriesStubs.spyGetRepositories();
262
- repositoryId1 = 'user-access-repo1-' + Date.now();
263
- repositoryId2 = 'user-access-repo2-' + Date.now();
264
- repositoryId3 = 'user-access-repo3-' + Date.now();
265
- cy.createRepository({id: repositoryId1});
266
- cy.createRepository({id: repositoryId2});
267
- cy.createRepository({id: repositoryId3});
268
- cy.presetRepository(repositoryId1);
269
- UserAndAccessSteps.visit();
270
- // Users table should be visible
271
- UserAndAccessSteps.getUsersTable().should('be.visible');
272
- });
273
-
274
- afterEach(() => {
275
- cy.loginAsAdmin().then(()=> {
276
- cy.deleteRepository(repositoryId1, true);
277
- cy.deleteRepository(repositoryId2, true);
278
- cy.deleteRepository(repositoryId3, true);
279
- cy.deleteUser(graphqlUser, true);
280
- cy.switchOffFreeAccess(true);
281
- cy.switchOffSecurity(true);
282
- });
283
-
284
- });
285
251
 
286
252
  it('Can have Free Access and GraphQL working together', () => {
287
253
  cy.wait('@getRepositories');
@@ -318,6 +284,10 @@ describe('User and Access', () => {
318
284
  runChecks(checks);
319
285
  }
320
286
  });
287
+ // Turn free access off
288
+ cy.loginAsAdmin().then(()=> {
289
+ cy.switchOffFreeAccess(true);
290
+ });
321
291
  });
322
292
  });
323
293
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.0.1-RC2",
3
+ "version": "3.0.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "3.0.1-RC2",
9
+ "version": "3.0.1",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "cypress": "^14.0.3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "3.0.1-RC2",
3
+ "version": "3.0.1",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
package/plugins/index.js CHANGED
@@ -12,6 +12,7 @@
12
12
  // the project's config changing)
13
13
 
14
14
  const del = require('del');
15
+ const retryTracker = {};
15
16
 
16
17
  module.exports = (on, config) => {
17
18
  // `on` is used to hook into various events Cypress emits
@@ -29,17 +30,69 @@ module.exports = (on, config) => {
29
30
  }
30
31
  });
31
32
 
32
- // keep only the videos for the failed specs
33
33
  on('after:spec', (spec, results) => {
34
+ // Retry tracking
35
+ if (!retryTracker.flaky) {
36
+ retryTracker.flaky = {};
37
+ }
38
+
39
+ if (!retryTracker.broken) {
40
+ retryTracker.broken = {};
41
+ }
42
+
43
+ results.tests.forEach((test) => {
44
+ const title = test.title.join(' ');
45
+ const attempts = test.attempts.length;
46
+ const retries = attempts - 1;
47
+
48
+ if (retries < 1) {
49
+ return;
50
+ }
51
+
52
+ if (test.state === 'passed') {
53
+ retryTracker.flaky[title] = retries;
54
+ }
55
+
56
+ if (test.state === 'failed') {
57
+ retryTracker.broken[title] = retries;
58
+ }
59
+ });
60
+
61
+ // Video cleanup
34
62
  if (results && results.video) {
35
- // Do we have failures for any retry attempts?
36
- const failures = results.tests.some((test) => {
37
- return test.attempts.some((attempt) => attempt.state === 'failed');
38
- });
63
+ const failures = results.tests.some((test) =>
64
+ test.attempts.some((attempt) => attempt.state === 'failed')
65
+ );
39
66
  if (!failures) {
40
- // delete the video if the spec passed and no tests retried
41
67
  return del(results.video);
42
68
  }
43
69
  }
44
70
  });
71
+
72
+ on('after:run', () => {
73
+ const { flaky = {}, broken = {} } = retryTracker;
74
+
75
+ const printGroup = (label, group) => {
76
+ const entries = Object.entries(group);
77
+ if (entries.length === 0) {
78
+ return;
79
+ }
80
+
81
+ console.log(`\n ${label} (${entries.length}):`);
82
+ entries.forEach(([name, retry]) => {
83
+ console.log(` * ${name}`);
84
+ console.log(` ↪ retried ${retry} time(s), total runs: ${retry + 1}`);
85
+ });
86
+ };
87
+
88
+ if (Object.keys(flaky).length === 0 && Object.keys(broken).length === 0) {
89
+ console.log('\n======================================== Retry Summary ========================================\n️ [PASS] No retried tests!\n====================================================================================================\n');
90
+ return;
91
+ }
92
+
93
+ console.log('\n======================================== Retry Summary ========================================');
94
+ printGroup('[WARNING] Flaky tests', flaky);
95
+ printGroup('[FAIL] Broken tests', broken);
96
+ console.log('====================================================================================================\n');
97
+ });
45
98
  };