1
1
import StatsMetadata from './StatsMetadata.vue'
2
2
3
3
describe ( 'mounts correctly' , ( ) => {
4
- const group1 = {
4
+ const group_linux_chrome = {
5
5
id : '123' ,
6
6
os : {
7
7
id : '123' ,
@@ -16,7 +16,7 @@ describe('mounts correctly', () => {
16
16
groupName : 'Staging' ,
17
17
}
18
18
19
- const group2 = {
19
+ const group_macos_edge = {
20
20
id : '123' ,
21
21
os : {
22
22
id : '123' ,
@@ -31,7 +31,7 @@ describe('mounts correctly', () => {
31
31
groupName : 'Production' ,
32
32
}
33
33
34
- const group3 = {
34
+ const group_windows_webkit = {
35
35
id : '123' ,
36
36
os : {
37
37
id : '123' ,
@@ -46,16 +46,31 @@ describe('mounts correctly', () => {
46
46
groupName : 'Production' ,
47
47
}
48
48
49
+ const group_windows_chrome = {
50
+ id : '123' ,
51
+ os : {
52
+ id : '123' ,
53
+ name : 'Windows' ,
54
+ nameWithVersion : 'Windows 12.3' ,
55
+ } ,
56
+ browser : {
57
+ id : '123' ,
58
+ formattedName : 'Chrome' ,
59
+ formattedNameWithVersion : 'Chrome 106' ,
60
+ } ,
61
+ groupName : 'Production' ,
62
+ }
63
+
49
64
it ( 'single values' , ( ) => {
50
65
const testingOrder = [ 'spec-duration 2:23' , 'operating-system Linux Debian' , 'browser Chrome 106' , 'testing-type component' ]
51
66
52
67
cy . mount ( ( ) => (
53
- < div class = 'bg-gray-50' >
68
+ < div class = 'flex bg-gray-50 gap-x-3 ' >
54
69
< StatsMetadata
55
70
order = { [ 'DURATION' , 'OS' , 'BROWSER' , 'TESTING' ] }
56
71
specDuration = { '2:23' }
57
72
testing = { 'component' }
58
- groups = { [ group1 ] }
73
+ groups = { [ group_linux_chrome ] }
59
74
/>
60
75
</ div >
61
76
) )
@@ -79,12 +94,12 @@ describe('mounts correctly', () => {
79
94
]
80
95
81
96
cy . mount ( ( ) => (
82
- < div class = 'bg-gray-50' >
97
+ < div class = 'flex bg-gray-50 gap-x-3 ' >
83
98
< StatsMetadata
84
99
order = { [ 'DURATION' , 'GROUPS' , 'G_OS' , 'G_BROWSERS' , 'TESTING' ] }
85
100
specDuration = { '2:23-3:40' }
86
101
testing = { 'e2e' }
87
- groups = { [ group2 , group1 , group3 ] }
102
+ groups = { [ group_macos_edge , group_linux_chrome , group_windows_webkit ] }
88
103
/>
89
104
</ div >
90
105
) )
@@ -98,13 +113,69 @@ describe('mounts correctly', () => {
98
113
cy . percySnapshot ( )
99
114
} )
100
115
116
+ it ( 'group values with 1 browser' , ( ) => {
117
+ const testingOrder = [
118
+ 'spec-duration 2:23-3:40' ,
119
+ 'group-server 2 groups' ,
120
+ 'operating-system-groups 2 operating systems' ,
121
+ 'browser-groups 1 browser' ,
122
+ 'testing-type e2e' ,
123
+ ]
124
+
125
+ cy . mount ( ( ) => (
126
+ < div class = 'flex bg-gray-50 gap-x-3' >
127
+ < StatsMetadata
128
+ order = { [ 'DURATION' , 'GROUPS' , 'G_OS' , 'G_BROWSERS' , 'TESTING' ] }
129
+ specDuration = { '2:23-3:40' }
130
+ testing = { 'e2e' }
131
+ groups = { [ group_linux_chrome , group_windows_chrome ] }
132
+ />
133
+ </ div >
134
+ ) )
135
+
136
+ cy . findByTestId ( 'stats-metadata' ) . children ( ) . should ( 'have.length' , 5 )
137
+ cy . findByTestId ( 'stats-metadata' ) . children ( ) . each ( ( ele , index ) => {
138
+ cy . wrap ( ele ) . should ( 'have.text' , testingOrder [ index ] )
139
+ cy . findByTestId ( testingOrder [ index ] ) . should ( 'be.visible' )
140
+ } )
141
+ } )
142
+
143
+ it ( 'group values with 1 os' , ( ) => {
144
+ const testingOrder = [
145
+ 'spec-duration 2:23-3:40' ,
146
+ 'group-server 2 groups' ,
147
+ 'operating-system-groups 1 operating system' ,
148
+ 'browser-groups 2 browsers' ,
149
+ 'testing-type e2e' ,
150
+ ]
151
+
152
+ cy . mount ( ( ) => (
153
+ < div class = 'flex bg-gray-50 gap-x-3' >
154
+ < StatsMetadata
155
+ order = { [ 'DURATION' , 'GROUPS' , 'G_OS' , 'G_BROWSERS' , 'TESTING' ] }
156
+ specDuration = { '2:23-3:40' }
157
+ testing = { 'e2e' }
158
+ groups = { [ group_windows_webkit , group_windows_chrome ] }
159
+ />
160
+ </ div >
161
+ ) )
162
+
163
+ cy . findByTestId ( 'stats-metadata' ) . children ( ) . should ( 'have.length' , 5 )
164
+ cy . findByTestId ( 'stats-metadata' ) . children ( ) . each ( ( ele , index ) => {
165
+ cy . wrap ( ele ) . should ( 'have.text' , testingOrder [ index ] )
166
+ cy . findByTestId ( testingOrder [ index ] ) . should ( 'be.visible' )
167
+ } )
168
+ } )
169
+
101
170
it ( 'shows the correct groupName' , ( ) => {
102
171
cy . mount ( ( ) => (
103
- < StatsMetadata
104
- order = { [ 'GROUP_NAME' , 'OS' , 'BROWSER' ] }
105
- groups = { [ group1 ] }
106
- groupName = { group1 . groupName }
107
- />
172
+ < div class = 'flex bg-gray-50 gap-x-3' >
173
+ < StatsMetadata
174
+ order = { [ 'GROUP_NAME' , 'OS' , 'BROWSER' ] }
175
+ groups = { [ group_linux_chrome ] }
176
+ groupName = { group_linux_chrome . groupName }
177
+ />
178
+ </ div >
108
179
) )
109
180
110
181
cy . findByTestId ( 'group_name Staging' ) . should ( 'be.visible' )
@@ -113,12 +184,12 @@ describe('mounts correctly', () => {
113
184
// This tests the functionality for arrMapping in StatsMetadata
114
185
it ( 'only displays unique browsers and calculates correct number of OS' , ( ) => {
115
186
cy . mount ( ( ) => (
116
- < div class = 'bg-gray-50' >
187
+ < div class = 'flex bg-gray-50 gap-x-3 ' >
117
188
< StatsMetadata
118
189
order = { [ 'DURATION' , 'GROUPS' , 'G_OS' , 'G_BROWSERS' , 'TESTING' ] }
119
190
specDuration = { '2:23-3:40' }
120
191
testing = { 'component' }
121
- groups = { [ group2 , group1 , group2 ] }
192
+ groups = { [ group_macos_edge , group_linux_chrome , group_macos_edge ] }
122
193
/>
123
194
</ div >
124
195
) )
0 commit comments