@testomatio/reporter 0.5.1 → 0.5.4-beta.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/Changelog.md CHANGED
@@ -1,3 +1,19 @@
1
+ # 0.5.4
2
+
3
+ Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
4
+
5
+ ```
6
+ TESTOMATIO_CREATE=1 TESTOMATIO=apiKey npx codeceptjs run
7
+ ```
8
+
9
+ # 0.5.3
10
+
11
+ * Fixed parsing suites
12
+
13
+ # 0.5.2
14
+
15
+ * Fixed multiple upload of artifacts in Cypress.io
16
+
1
17
  # 0.5.1
2
18
 
3
19
  * Fixed Cypress.io to report tests inside nested suites
@@ -6,6 +6,10 @@ const testomatioReporter = on => {
6
6
  const client = new TestomatClient({ apiKey: process.env.TESTOMATIO });
7
7
 
8
8
  on('before:run', async () => {
9
+ if (!client.title) {
10
+ client.title = `${run.config.projectName} tests @${run.browser.displayName} @${run.system.osName}`
11
+ if (client.title.includes('undefined')) delete client.title;
12
+ }
9
13
  await client.createRun();
10
14
  });
11
15
 
@@ -15,7 +19,9 @@ const testomatioReporter = on => {
15
19
  const videos = [results.video];
16
20
 
17
21
  for (const test of results.tests) {
18
- const latestAttempt = test.attempts[test.attempts.length - 1];
22
+ const lastAttemptIndex = test.attempts.length - 1;
23
+ const latestAttempt = test.attempts[lastAttemptIndex];
24
+
19
25
  const time = latestAttempt.duration;
20
26
  const error = latestAttempt.error;
21
27
 
@@ -23,16 +29,26 @@ const testomatioReporter = on => {
23
29
  const suiteTitle = test.title.pop();
24
30
 
25
31
  const testId = parseTest(title);
26
- const suiteId = '';
32
+ const suiteId = parseSuite(suiteTitle);
33
+
34
+ if (error) {
35
+ error.inspect = function() {
36
+ return this.codeFrame.frame;
37
+ }
38
+ }
27
39
 
28
40
  const screenshots = results.screenshots
29
41
  .filter(screenshot => screenshot.path.includes(title))
42
+ .filter(screenshot => screenshot.testAttemptIndex === lastAttemptIndex)
30
43
  .map(screenshot => screenshot.path);
44
+
31
45
  const files = [...videos, ...screenshots];
32
46
 
33
47
  const state = test.state === 'passed' ? TRConstants.PASSED : TRConstants.FAILED;
34
48
 
35
- addSpecTestsPromises.push(client.addTestRun(testId, state, { title, time, error, files, suite_title: suiteTitle, suite_id: suiteId }));
49
+ addSpecTestsPromises.push(client.addTestRun(testId, state, {
50
+ title, time, error, files, suite_title: suiteTitle, suite_id: suiteId
51
+ }));
36
52
  }
37
53
 
38
54
  await Promise.all(addSpecTestsPromises);
package/lib/client.js CHANGED
@@ -24,6 +24,7 @@ class TestomatClient {
24
24
  constructor(params) {
25
25
  this.apiKey = params.apiKey || process.env.TESTOMATIO;
26
26
  this.title = params.title || process.env.TESTOMATIO_TITLE;
27
+ this.createNewTests = !!process.env.TESTOMATIO_CREATE
27
28
  this.parallel = params.parallel;
28
29
  this.runId = process.env.runId;
29
30
  this.queue = Promise.resolve();
@@ -142,6 +143,7 @@ class TestomatClient {
142
143
 
143
144
  const json = JsonCycle.stringify({
144
145
  api_key: this.apiKey,
146
+ create: this.createNewTests,
145
147
  files,
146
148
  steps,
147
149
  status,
package/lib/util.js CHANGED
@@ -50,6 +50,7 @@ const isValidUrl = s => {
50
50
 
51
51
  module.exports = {
52
52
  parseTest,
53
+ parseSuite,
53
54
  ansiRegExp,
54
55
  isValidUrl,
55
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.5.1",
3
+ "version": "0.5.4-beta.1",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",