@testomatio/reporter 0.6.9 → 0.7.0-beta

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 (61) hide show
  1. package/Changelog.md +9 -0
  2. package/README.md +16 -7
  3. package/lib/adapter/codecept.js +1 -1
  4. package/lib/adapter/cucumber/current.js +185 -0
  5. package/lib/adapter/cucumber/legacy.js +136 -0
  6. package/lib/adapter/cucumber.js +15 -135
  7. package/lib/adapter/cypress-plugin/index.js +4 -1
  8. package/lib/adapter/mocha.js +1 -0
  9. package/lib/adapter/webdriver.js +1 -0
  10. package/lib/fileUploader.js +2 -1
  11. package/lib/junit-adapter/csharp.js +18 -0
  12. package/lib/xmlReader.js +71 -3
  13. package/package.json +12 -9
  14. package/testcafe/package-lock.json +863 -0
  15. package/testcafe/package.json +1 -1
  16. package/.eslintrc.js +0 -35
  17. package/.github/workflows/node.js.yml +0 -30
  18. package/.prettierrc.js +0 -12
  19. package/example/codecept/codecept.conf.js +0 -29
  20. package/example/codecept/index_test.js +0 -10
  21. package/example/codecept/jsconfig.json +0 -5
  22. package/example/codecept/sample_test.js +0 -6
  23. package/example/codecept/steps.d.ts +0 -16
  24. package/example/codecept/steps_file.js +0 -10
  25. package/example/core/index.js +0 -15
  26. package/example/jest/index.test.js +0 -9
  27. package/example/jest/jest.config.js +0 -188
  28. package/example/jest/package.json +0 -13
  29. package/example/jest/sample.test.js +0 -13
  30. package/example/jest/yarn.lock +0 -8
  31. package/example/mocha/test/index.test.js +0 -13
  32. package/tests/adapter/config/index.js +0 -10
  33. package/tests/adapter/examples/codecept/codecept.conf.js +0 -33
  34. package/tests/adapter/examples/codecept/index_test.js +0 -11
  35. package/tests/adapter/examples/codecept/jsconfig.json +0 -5
  36. package/tests/adapter/examples/codecept/output/Test_for_suite_2_@Tc2171bd2.failed.png +0 -0
  37. package/tests/adapter/examples/codecept/output/Test_issue_for_suite_1_@Tca70c8c4.failed.png +0 -0
  38. package/tests/adapter/examples/codecept/sample_test.js +0 -7
  39. package/tests/adapter/examples/codecept/steps_file.js +0 -10
  40. package/tests/adapter/examples/jasmine/index.test.js +0 -11
  41. package/tests/adapter/examples/jasmine/passReporterOpts.sh +0 -8
  42. package/tests/adapter/examples/jest/index.test.js +0 -11
  43. package/tests/adapter/examples/jest/jest.config.js +0 -4
  44. package/tests/adapter/examples/mocha/index.test.js +0 -13
  45. package/tests/adapter/examples/mocha/mocha.config.js +0 -4
  46. package/tests/adapter/index.test.js +0 -136
  47. package/tests/adapter/utils/index.js +0 -40
  48. package/tests/data/artifacts/failed_test.png +0 -0
  49. package/tests/data/artifacts/screenshot1.png +0 -0
  50. package/tests/data/cli/RunCest.php +0 -1024
  51. package/tests/data/cli/SnapshotCest.php +0 -97
  52. package/tests/data/codecept.xml +0 -150
  53. package/tests/data/codecept2.xml +0 -25
  54. package/tests/data/java.xml +0 -25
  55. package/tests/data/junit1.xml +0 -70
  56. package/tests/data/minitest.xml +0 -25
  57. package/tests/data/phpunit.xml +0 -65
  58. package/tests/data/pytest.xml +0 -13
  59. package/tests/data/src/services/search_service_test.rb +0 -146
  60. package/tests/util_test.js +0 -51
  61. package/tests/xmlReader_test.js +0 -232
@@ -1,136 +0,0 @@
1
- const { assert } = require('chai');
2
- const { exec } = require('child_process');
3
- const ServerMock = require('mock-http-server');
4
- const JestReporter = require('../../lib/adapter/jest');
5
- const MochaReporter = require('../../lib/adapter/mocha');
6
- const JasmineReporter = require('../../lib/adapter/jasmine');
7
- const CodeceptReporter = require('../../lib/adapter/codecept');
8
- const { registerHandlers } = require('./utils');
9
- const { host, port, TESTOMATIO_URL, TESTOMATIO, RUN_ID } = require('./config');
10
-
11
- const params = [
12
- {
13
- adapterName: JestReporter.name,
14
- positiveCmd: `TESTOMATIO_URL=${TESTOMATIO_URL} TESTOMATIO=${TESTOMATIO} npm run test:adapter:jest:example`,
15
- negativeCmd: `TESTOMATIO_URL=${TESTOMATIO_URL} npm run test:adapter:jest:example`,
16
- },
17
- {
18
- adapterName: MochaReporter.name,
19
- positiveCmd: `TESTOMATIO_URL=${TESTOMATIO_URL} TESTOMATIO=${TESTOMATIO} npm run test:adapter:mocha:example`,
20
- negativeCmd: `TESTOMATIO_URL=${TESTOMATIO_URL} npm run test:adapter:mocha:example`,
21
- },
22
- {
23
- adapterName: JasmineReporter.name,
24
- positiveCmd: `TESTOMATIO_URL=${TESTOMATIO_URL} TESTOMATIO=${TESTOMATIO} npm run test:adapter:jasmine:example`,
25
- negativeCmd: `TESTOMATIO_URL=${TESTOMATIO_URL} npm run test:adapter:jasmine:example`,
26
- },
27
- {
28
- adapterName: CodeceptReporter.name,
29
- positiveCmd: `TESTOMATIO_URL=${TESTOMATIO_URL} TESTOMATIO=${TESTOMATIO} npm run test:adapter:jasmine:example`,
30
- negativeCmd: `TESTOMATIO_URL=${TESTOMATIO_URL} npm run test:adapter:jasmine:example`,
31
- },
32
- ];
33
-
34
- describe('Adapters', () => {
35
- const server = new ServerMock({ host, port });
36
-
37
- before(done => {
38
- server.start(() => {
39
- console.log(`[mock-http-server]: Server started at ${TESTOMATIO_URL}`);
40
-
41
- done();
42
- });
43
- });
44
-
45
- after(done => {
46
- server.stop(() => {
47
- console.log('[mock-http-server]: Server stopped');
48
-
49
- done();
50
- });
51
- });
52
-
53
- for (const { adapterName, positiveCmd, negativeCmd } of params) {
54
- describe(adapterName, () => {
55
- describe('positive tests', () => {
56
- before(function (done) {
57
- this.timeout(5000);
58
-
59
- registerHandlers(server, RUN_ID);
60
-
61
- exec(positiveCmd, () => done());
62
- });
63
-
64
- after(() => {
65
- server.reset();
66
- });
67
-
68
- it('POST :: /api/reporter :: should create a report if api_key has been provided', () => {
69
- const [req] = server.requests({ method: 'POST', path: '/api/reporter' });
70
-
71
- const expectedResult = { api_key: TESTOMATIO };
72
-
73
- assert.isObject(req.body);
74
- assert.deepEqual(req.body, expectedResult);
75
- });
76
-
77
- it('PUT :: /api/reporter/:runId :: should update run status', () => {
78
- const [req] = server.requests({ method: 'PUT', path: `/api/reporter/${RUN_ID}` });
79
-
80
- const expectedResult = { api_key: TESTOMATIO, status_event: 'fail', status: 'failed' };
81
-
82
- assert.isObject(req.body);
83
- assert.deepEqual(req.body, expectedResult);
84
- });
85
-
86
- it('POST :: /api/reporter/:runId/testrun :: should add a new test to run instance', () => {
87
- const reqs = server.requests({ method: 'POST', path: `/api/reporter/${RUN_ID}/testrun` });
88
-
89
- const expectedRequiredBodyKeys = [
90
- 'api_key',
91
- 'files',
92
- // 'steps',
93
- 'status',
94
- 'stack',
95
- 'example',
96
- 'title',
97
- 'message',
98
- 'run_time',
99
- 'artifacts',
100
- ];
101
-
102
- for (const req of reqs) {
103
- assert.isObject(req.body);
104
- assert.includeMembers(Object.keys(req.body), expectedRequiredBodyKeys);
105
-
106
- assert.strictEqual(req.body.api_key, TESTOMATIO);
107
- assert.isString(req.body.status);
108
- assert.isString(req.body.title);
109
- assert.isNumber(req.body.run_time);
110
- }
111
- });
112
- });
113
-
114
- describe('negative tests', () => {
115
- before(function (done) {
116
- this.timeout(5000);
117
-
118
- registerHandlers(server, RUN_ID);
119
-
120
- exec(negativeCmd, () => done());
121
- });
122
-
123
- after(() => {
124
- server.reset();
125
- });
126
-
127
- it('should ignore reporter if api_key has not been provided', () => {
128
- const requests = server.requests();
129
-
130
- assert.isArray(requests);
131
- assert.isEmpty(requests);
132
- });
133
- });
134
- });
135
- }
136
- });
@@ -1,40 +0,0 @@
1
- const registerHandlers = (server, RUN_ID) => {
2
- // client.createRun()
3
- server.on({
4
- method: 'POST',
5
- path: '/api/reporter',
6
- reply: {
7
- status: 200,
8
- headers: { 'content-type': 'application/json' },
9
- body: JSON.stringify({
10
- uid: RUN_ID,
11
- url: `http://127.0.0.1:3000/projects/test-project/runs/${RUN_ID}/report`,
12
- }),
13
- },
14
- });
15
-
16
- // client.updateRunStatus()
17
- server.on({
18
- method: 'PUT',
19
- path: `/api/reporter/${RUN_ID}`,
20
- reply: {
21
- status: 200,
22
- headers: { 'content-type': 'application/json' },
23
- },
24
- });
25
-
26
- // client.addTestRun()
27
- server.on({
28
- method: 'POST',
29
- path: `/api/reporter/${RUN_ID}/testrun`,
30
- reply: {
31
- status: 400,
32
- headers: { 'content-type': 'application/json' },
33
- body: JSON.stringify({ message: 'Test could not be matched' }),
34
- },
35
- });
36
- };
37
-
38
- module.exports = {
39
- registerHandlers,
40
- };