@@ -68,7 +68,7 @@ export const benchReplaceAll = new (class extends CPUBenchmarkPuppeteer {
68
68
}
69
69
async run ( page : Page ) {
70
70
await clickElement ( page , "pierce/#run" ) ;
71
- await checkElementContainsText ( page , "pierce/tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , "5001" ) ;
71
+ await checkElementContainsText ( page , "pierce/tbody>tr:nth-of-type(1)>td:nth-of-type(1)" , ` ${ config . WARMUP_COUNT * 1000 + 1 } ` ) ;
72
72
}
73
73
} ) ( ) ;
74
74
@@ -127,35 +127,39 @@ export const benchSwapRows = new (class extends CPUBenchmarkPuppeteer {
127
127
}
128
128
async run ( page : Page ) {
129
129
await clickElement ( page , "pierce/#swaprows" ) ;
130
- await checkElementContainsText ( page , "pierce/tbody>tr:nth-of-type(999)>td:nth-of-type(1)" , "2" ) ;
131
- await checkElementContainsText ( page , "pierce/tbody>tr:nth-of-type(2)>td:nth-of-type(1)" , "999" ) ;
130
+ let text999 = config . WARMUP_COUNT % 2 == 0 ? "999" : "2" ;
131
+ let text2 = config . WARMUP_COUNT % 2 == 0 ? "2" : "999" ;
132
+ await checkElementContainsText ( page , "pierce/tbody>tr:nth-of-type(999)>td:nth-of-type(1)" , text999 ) ;
133
+ await checkElementContainsText ( page , "pierce/tbody>tr:nth-of-type(2)>td:nth-of-type(1)" , text2 ) ;
132
134
}
133
135
} ) ( ) ;
134
136
135
137
export const benchRemove = new ( class extends CPUBenchmarkPuppeteer {
136
138
constructor ( ) {
137
139
super ( cpuBenchmarkInfos [ Benchmark . _06 ] ) ;
138
140
}
141
+ rowsToSkip = 4 ;
139
142
async init ( page : Page ) {
140
143
await checkElementExists ( page , "pierce/#run" ) ;
141
144
await clickElement ( page , "pierce/#run" ) ;
142
145
await checkElementExists ( page , "pierce/tbody>tr:nth-of-type(1000)>td:nth-of-type(1)" ) ;
143
146
for ( let i = 0 ; i < config . WARMUP_COUNT ; i ++ ) {
144
- await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ config . WARMUP_COUNT - i + 4 } )>td:nth-of-type(1)` , ( config . WARMUP_COUNT - i + 4 ) . toString ( ) ) ;
145
- await clickElement ( page , `pierce/tbody>tr:nth-of-type(${ config . WARMUP_COUNT - i + 4 } )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
146
- await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ config . WARMUP_COUNT - i + 4 } )>td:nth-of-type(1)` , "10" ) ;
147
+ const rowToClick = config . WARMUP_COUNT - i + this . rowsToSkip ;
148
+ await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ rowToClick } )>td:nth-of-type(1)` , rowToClick . toString ( ) ) ;
149
+ await clickElement ( page , `pierce/tbody>tr:nth-of-type(${ rowToClick } )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
150
+ await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ rowToClick } )>td:nth-of-type(1)` , `${ this . rowsToSkip + config . WARMUP_COUNT + 1 } ` ) ;
147
151
}
148
- await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(5 )>td:nth-of-type(1)` , "10" ) ;
149
- await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(4 )>td:nth-of-type(1)` , "4" ) ;
152
+ await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ this . rowsToSkip + 1 } )>td:nth-of-type(1)` , ` ${ this . rowsToSkip + config . WARMUP_COUNT + 1 } ` ) ;
153
+ await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ this . rowsToSkip } )>td:nth-of-type(1)` , ` ${ this . rowsToSkip } ` ) ;
150
154
151
155
// Click on a row the second time
152
- await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(6 )>td:nth-of-type(1)` , "11" ) ;
153
- await clickElement ( page , `pierce/tbody>tr:nth-of-type(6 )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
154
- await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(6 )>td:nth-of-type(1)` , "12" ) ;
156
+ await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ this . rowsToSkip + 2 } )>td:nth-of-type(1)` , ` ${ this . rowsToSkip + config . WARMUP_COUNT + 2 } ` ) ;
157
+ await clickElement ( page , `pierce/tbody>tr:nth-of-type(${ this . rowsToSkip + 2 } )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
158
+ await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ this . rowsToSkip + 2 } )>td:nth-of-type(1)` , ` ${ this . rowsToSkip + config . WARMUP_COUNT + 3 } ` ) ;
155
159
}
156
160
async run ( page : Page ) {
157
- await clickElement ( page , `pierce/tbody>tr:nth-of-type(4 )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
158
- await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(4 )>td:nth-of-type(1)` , "10" ) ;
161
+ await clickElement ( page , `pierce/tbody>tr:nth-of-type(${ this . rowsToSkip } )>td:nth-of-type(3)>a>span:nth-of-type(1)` ) ;
162
+ await checkElementContainsText ( page , `pierce/tbody>tr:nth-of-type(${ this . rowsToSkip } )>td:nth-of-type(1)` , ` ${ this . rowsToSkip + config . WARMUP_COUNT + 1 } ` ) ;
159
163
}
160
164
} ) ( ) ;
161
165
export const benchRunBig = new ( class extends CPUBenchmarkPuppeteer {
0 commit comments