@@ -42,7 +42,7 @@ export let benchRun = new (class extends CPUBenchmarkPlaywright {
42
42
}
43
43
async init ( browser : Browser , page : Page ) {
44
44
await checkElementExists ( page , "#run" ) ;
45
- for ( let i = 0 ; i < config . WARMUP_COUNT ; i ++ ) {
45
+ for ( let i = 0 ; i < this . benchmarkInfo . warmupCount ; i ++ ) {
46
46
await clickElement ( page , "#run" ) ;
47
47
await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , ( i * 1000 + 1 ) . toFixed ( ) ) ;
48
48
await clickElement ( page , "#clear" ) ;
@@ -51,7 +51,7 @@ export let benchRun = new (class extends CPUBenchmarkPlaywright {
51
51
}
52
52
async run ( browser : Browser , page : Page ) {
53
53
await clickElement ( page , "#run" ) ;
54
- await checkElementContainsText ( page , "tbody>tr:nth-of-type(1000)>td:nth-of-type(1)" , ( ( config . WARMUP_COUNT + 1 ) * 1000 ) . toFixed ( ) ) ;
54
+ await checkElementContainsText ( page , "tbody>tr:nth-of-type(1000)>td:nth-of-type(1)" , ( ( this . benchmarkInfo . warmupCount + 1 ) * 1000 ) . toFixed ( ) ) ;
55
55
}
56
56
} ) ( ) ;
57
57
@@ -61,14 +61,14 @@ export const benchReplaceAll = new (class extends CPUBenchmarkPlaywright {
61
61
}
62
62
async init ( browser : Browser , page : Page ) {
63
63
await checkElementExists ( page , "#run" ) ;
64
- for ( let i = 0 ; i < config . WARMUP_COUNT ; i ++ ) {
64
+ for ( let i = 0 ; i < this . benchmarkInfo . warmupCount ; i ++ ) {
65
65
await clickElement ( page , "#run" ) ;
66
66
await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , ( i * 1000 + 1 ) . toFixed ( ) ) ;
67
67
}
68
68
}
69
69
async run ( browser : Browser , page : Page ) {
70
70
await clickElement ( page , "#run" ) ;
71
- await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , `${ config . WARMUP_COUNT * 1000 + 1 } ` ) ;
71
+ await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , `${ this . benchmarkInfo . warmupCount * 1000 + 1 } ` ) ;
72
72
}
73
73
} ) ( ) ;
74
74
@@ -99,7 +99,7 @@ export const benchSelect = new (class extends CPUBenchmarkPlaywright {
99
99
await checkElementExists ( page , "#run" ) ;
100
100
await clickElement ( page , "#run" ) ;
101
101
await checkElementContainsText ( page , "tbody>tr:nth-of-type(1000)>td:nth-of-type(1)" , "1000" ) ;
102
- for ( let i = 0 ; i <= config . WARMUP_COUNT ; i ++ ) {
102
+ for ( let i = 0 ; i <= this . benchmarkInfo . warmupCount ; i ++ ) {
103
103
await clickElement ( page , `tbody>tr:nth-of-type(${ i + 5 } )>td:nth-of-type(2)>a` ) ;
104
104
await checkElementHasClass ( page , `tbody>tr:nth-of-type(${ i + 5 } )` , "danger" ) ;
105
105
await checkCountForSelector ( page , "tbody>tr.danger" , 1 ) ;
@@ -119,16 +119,16 @@ export const benchSwapRows = new (class extends CPUBenchmarkPlaywright {
119
119
await checkElementExists ( page , "#run" ) ;
120
120
await clickElement ( page , "#run" ) ;
121
121
await checkElementExists ( page , "tbody>tr:nth-of-type(1000)>td:nth-of-type(1)" ) ;
122
- for ( let i = 0 ; i <= config . WARMUP_COUNT ; i ++ ) {
123
- let text = i % 2 == 0 ? "2" : "999" ;
124
- await clickElement ( page , "#swaprows" ) ;
125
- await checkElementContainsText ( page , "tbody>tr:nth-of-type(999)>td:nth-of-type(1)" , text ) ;
122
+ for ( let i = 0 ; i <= this . benchmarkInfo . warmupCount ; i ++ ) {
123
+ let text = i % 2 == 0 ? "2" : "999" ;
124
+ await clickElement ( page , "#swaprows" ) ;
125
+ await checkElementContainsText ( page , "tbody>tr:nth-of-type(999)>td:nth-of-type(1)" , text ) ;
126
126
}
127
127
}
128
128
async run ( browser : Browser , page : Page ) {
129
129
await clickElement ( page , "#swaprows" ) ;
130
- let text999 = config . WARMUP_COUNT % 2 == 0 ? "999" : "2" ;
131
- let text2 = config . WARMUP_COUNT % 2 == 0 ? "2" : "999" ;
130
+ let text999 = this . benchmarkInfo . warmupCount % 2 == 0 ? "999" : "2" ;
131
+ let text2 = this . benchmarkInfo . warmupCount % 2 == 0 ? "2" : "999" ;
132
132
await checkElementContainsText ( page , "tbody>tr:nth-of-type(999)>td:nth-of-type(1)" , text999 ) ;
133
133
await checkElementContainsText ( page , "tbody>tr:nth-of-type(2)>td:nth-of-type(1)" , text2 ) ;
134
134
}
@@ -143,23 +143,23 @@ export const benchRemove = new (class extends CPUBenchmarkPlaywright {
143
143
await checkElementExists ( page , "#run" ) ;
144
144
await clickElement ( page , "#run" ) ;
145
145
await checkElementExists ( page , "tbody>tr:nth-of-type(1000)>td:nth-of-type(1)" ) ;
146
- for ( let i = 0 ; i < config . WARMUP_COUNT ; i ++ ) {
147
- const rowToClick = config . WARMUP_COUNT - i + this . rowsToSkip ;
146
+ for ( let i = 0 ; i < this . benchmarkInfo . warmupCount ; i ++ ) {
147
+ const rowToClick = this . benchmarkInfo . warmupCount - i + this . rowsToSkip ;
148
148
await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ rowToClick } )>td:nth-of-type(1)` , rowToClick . toString ( ) ) ;
149
149
await clickElement ( page , `tbody>tr:nth-of-type(${ rowToClick } )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
150
- await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ rowToClick } )>td:nth-of-type(1)` , `${ this . rowsToSkip + config . WARMUP_COUNT + 1 } ` ) ;
150
+ await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ rowToClick } )>td:nth-of-type(1)` , `${ this . rowsToSkip + this . benchmarkInfo . warmupCount + 1 } ` ) ;
151
151
}
152
- await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip + 1 } )>td:nth-of-type(1)` , `${ this . rowsToSkip + config . WARMUP_COUNT + 1 } ` ) ;
152
+ await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip + 1 } )>td:nth-of-type(1)` , `${ this . rowsToSkip + this . benchmarkInfo . warmupCount + 1 } ` ) ;
153
153
await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip } )>td:nth-of-type(1)` , `${ this . rowsToSkip } ` ) ;
154
154
155
155
// Click on a row the second time
156
- await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip + 2 } )>td:nth-of-type(1)` , `${ this . rowsToSkip + config . WARMUP_COUNT + 2 } ` ) ;
156
+ await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip + 2 } )>td:nth-of-type(1)` , `${ this . rowsToSkip + this . benchmarkInfo . warmupCount + 2 } ` ) ;
157
157
await clickElement ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip + 2 } )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
158
- await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip + 2 } )>td:nth-of-type(1)` , `${ this . rowsToSkip + config . WARMUP_COUNT + 3 } ` ) ;
158
+ await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip + 2 } )>td:nth-of-type(1)` , `${ this . rowsToSkip + this . benchmarkInfo . warmupCount + 3 } ` ) ;
159
159
}
160
160
async run ( browser : Browser , page : Page ) {
161
161
await clickElement ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip } )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
162
- await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip } )>td:nth-of-type(1)` , `${ this . rowsToSkip + config . WARMUP_COUNT + 1 } ` ) ;
162
+ await checkElementContainsText ( page , `tbody>tr:nth-of-type(${ this . rowsToSkip } )>td:nth-of-type(1)` , `${ this . rowsToSkip + this . benchmarkInfo . warmupCount + 1 } ` ) ;
163
163
}
164
164
} ) ( ) ;
165
165
@@ -170,7 +170,7 @@ export const benchRunBig = new (class extends CPUBenchmarkPlaywright {
170
170
}
171
171
async init ( browser : Browser , page : Page ) {
172
172
await checkElementExists ( page , "#run" ) ;
173
- for ( let i = 0 ; i < config . WARMUP_COUNT ; i ++ ) {
173
+ for ( let i = 0 ; i < this . benchmarkInfo . warmupCount ; i ++ ) {
174
174
await clickElement ( page , "#run" ) ;
175
175
await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , ( i * 1000 + 1 ) . toFixed ( ) ) ;
176
176
await clickElement ( page , "#clear" ) ;
@@ -189,7 +189,7 @@ export const benchAppendToManyRows = new (class extends CPUBenchmarkPlaywright {
189
189
}
190
190
async init ( browser : Browser , page : Page ) {
191
191
await checkElementExists ( page , "#run" ) ;
192
- for ( let i = 0 ; i < config . WARMUP_COUNT ; i ++ ) {
192
+ for ( let i = 0 ; i < this . benchmarkInfo . warmupCount ; i ++ ) {
193
193
await clickElement ( page , "#run" ) ;
194
194
await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , ( i * 1000 + 1 ) . toFixed ( ) ) ;
195
195
await clickElement ( page , "#clear" ) ;
@@ -210,14 +210,14 @@ export const benchClear = new (class extends CPUBenchmarkPlaywright {
210
210
}
211
211
async init ( browser : Browser , page : Page ) {
212
212
await checkElementExists ( page , "#run" ) ;
213
- for ( let i = 0 ; i < config . WARMUP_COUNT ; i ++ ) {
213
+ for ( let i = 0 ; i < this . benchmarkInfo . warmupCount ; i ++ ) {
214
214
await clickElement ( page , "#run" ) ;
215
215
await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , ( i * 1000 + 1 ) . toFixed ( ) ) ;
216
216
await clickElement ( page , "#clear" ) ;
217
217
await checkElementNotExists ( page , "tbody>tr:nth-of-type(1000)>td:nth-of-type(1)" ) ;
218
218
}
219
219
await clickElement ( page , "#run" ) ;
220
- await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , ( config . WARMUP_COUNT * 1000 + 1 ) . toFixed ( ) ) ;
220
+ await checkElementContainsText ( page , "tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , ( this . benchmarkInfo . warmupCount * 1000 + 1 ) . toFixed ( ) ) ;
221
221
}
222
222
async run ( browser : Browser , page : Page ) {
223
223
await clickElement ( page , "#clear" ) ;
0 commit comments