summaryrefslogtreecommitdiff
path: root/spec/frontend/pipelines/test_reports/mock_data.js
blob: b0f22bc63fbe25eabec675828c0da201e7b465c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import { formatTime } from '~/lib/utils/datetime_utility';
import { TestStatus } from '~/pipelines/constants';

export const testCases = [
  {
    classname: 'spec.test_spec',
    execution_time: 0.000748,
    name: 'Test#subtract when a is 1 and b is 2 raises an error',
    stack_trace: null,
    status: TestStatus.SUCCESS,
    system_output: null,
  },
  {
    classname: 'spec.test_spec',
    execution_time: 0.000064,
    name: 'Test#subtract when a is 2 and b is 1 returns correct result',
    stack_trace: null,
    status: TestStatus.SUCCESS,
    system_output: null,
  },
  {
    classname: 'spec.test_spec',
    execution_time: 0.009292,
    name: 'Test#sum when a is 1 and b is 2 returns summary',
    stack_trace: null,
    status: TestStatus.FAILED,
    system_output:
      "Failure/Error: is_expected.to eq(3)\n\n  expected: 3\n       got: -1\n\n  (compared using ==)\n./spec/test_spec.rb:12:in `block (4 levels) in <top (required)>'",
  },
  {
    classname: 'spec.test_spec',
    execution_time: 0.00018,
    name: 'Test#sum when a is 100 and b is 200 returns summary',
    stack_trace: null,
    status: TestStatus.FAILED,
    system_output:
      "Failure/Error: is_expected.to eq(300)\n\n  expected: 300\n       got: -100\n\n  (compared using ==)\n./spec/test_spec.rb:21:in `block (4 levels) in <top (required)>'",
  },
  {
    classname: 'spec.test_spec',
    execution_time: 0,
    name: 'Test#skipped text',
    stack_trace: null,
    status: TestStatus.SKIPPED,
    system_output: null,
  },
];

export const testCasesFormatted = [
  {
    ...testCases[2],
    icon: 'status_failed_borderless',
    formattedTime: formatTime(testCases[0].execution_time * 1000),
  },
  {
    ...testCases[3],
    icon: 'status_failed_borderless',
    formattedTime: formatTime(testCases[1].execution_time * 1000),
  },
  {
    ...testCases[4],
    icon: 'status_skipped_borderless',
    formattedTime: formatTime(testCases[2].execution_time * 1000),
  },
  {
    ...testCases[0],
    icon: 'status_success_borderless',
    formattedTime: formatTime(testCases[3].execution_time * 1000),
  },
  {
    ...testCases[1],
    icon: 'status_success_borderless',
    formattedTime: formatTime(testCases[4].execution_time * 1000),
  },
];

export const testSuites = [
  {
    error_count: 0,
    failed_count: 2,
    name: 'rspec:osx',
    skipped_count: 0,
    success_count: 2,
    test_cases: testCases,
    total_count: 4,
    total_time: 60,
  },
  {
    error_count: 0,
    failed_count: 10,
    name: 'rspec:osx',
    skipped_count: 0,
    success_count: 50,
    test_cases: [],
    total_count: 60,
    total_time: 0.010284,
  },
];

export const testSuitesFormatted = testSuites.map(x => ({
  ...x,
  formattedTime: formatTime(x.total_time * 1000),
}));

export const testReports = {
  error_count: 0,
  failed_count: 2,
  skipped_count: 0,
  success_count: 2,
  test_suites: testSuites,
  total_count: 4,
  total_time: 0.010284,
};

export const testReportsWithNoSuites = {
  error_count: 0,
  failed_count: 2,
  skipped_count: 0,
  success_count: 2,
  test_suites: [],
  total_count: 4,
  total_time: 0.010284,
};