1
1
// import { testTextContains, testTextContainsJS, testTextNotContained, testClassContains, testElementLocatedByXpath, testElementNotLocatedByXPath, testElementLocatedById, clickElementById, clickElementByXPath, getTextByXPath } from './webdriverAccess'
2
2
3
3
import { Browser , Page } from "playwright-core" ;
4
- import * as benchmarksCommon from "./benchmarksCommon.js" ;
5
- import { BenchmarkType } from "./benchmarksCommon.js" ;
4
+ import {
5
+ Benchmark ,
6
+ BenchmarkImpl ,
7
+ BenchmarkType ,
8
+ CPUBenchmarkInfo ,
9
+ MemBenchmarkInfo ,
10
+ cpuBenchmarkInfos ,
11
+ memBenchmarkInfos ,
12
+ } from "./benchmarksCommon.js" ;
6
13
import { BenchmarkOptions , config , FrameworkData } from "./common.js" ;
7
14
import {
8
15
checkCountForSelector ,
@@ -13,16 +20,16 @@ import {
13
20
clickElement ,
14
21
} from "./playwrightAccess.js" ;
15
22
16
- export abstract class CPUBenchmarkPlaywright implements benchmarksCommon . BenchmarkImpl {
23
+ export abstract class CPUBenchmarkPlaywright implements BenchmarkImpl {
17
24
type = BenchmarkType . CPU ;
18
- constructor ( public benchmarkInfo : benchmarksCommon . CPUBenchmarkInfo ) { }
25
+ constructor ( public benchmarkInfo : CPUBenchmarkInfo ) { }
19
26
abstract init ( browser : Browser , page : Page , framework : FrameworkData ) : Promise < any > ;
20
27
abstract run ( browser : Browser , page : Page , framework : FrameworkData ) : Promise < any > ;
21
28
}
22
29
23
- export abstract class MemBenchmarkPlaywright implements benchmarksCommon . BenchmarkImpl {
30
+ export abstract class MemBenchmarkPlaywright implements BenchmarkImpl {
24
31
type = BenchmarkType . MEM ;
25
- constructor ( public benchmarkInfo : benchmarksCommon . MemBenchmarkInfo ) { }
32
+ constructor ( public benchmarkInfo : MemBenchmarkInfo ) { }
26
33
abstract init ( browser : Browser , page : Page , framework : FrameworkData ) : Promise < any > ;
27
34
abstract run ( browser : Browser , page : Page , framework : FrameworkData ) : Promise < any > ;
28
35
}
@@ -31,7 +38,7 @@ export type BenchmarkPlaywright = CPUBenchmarkPlaywright | MemBenchmarkPlaywrigh
31
38
32
39
export let benchRun = new ( class extends CPUBenchmarkPlaywright {
33
40
constructor ( ) {
34
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_01 ] ) ;
41
+ super ( cpuBenchmarkInfos [ Benchmark . _01 ] ) ;
35
42
}
36
43
async init ( browser : Browser , page : Page ) {
37
44
await checkElementExists ( page , "#run" ) ;
@@ -58,7 +65,7 @@ export let benchRun = new (class extends CPUBenchmarkPlaywright {
58
65
59
66
export const benchReplaceAll = new ( class extends CPUBenchmarkPlaywright {
60
67
constructor ( ) {
61
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_02 ] ) ;
68
+ super ( cpuBenchmarkInfos [ Benchmark . _02 ] ) ;
62
69
}
63
70
async init ( browser : Browser , page : Page ) {
64
71
await checkElementExists ( page , "#run" ) ;
@@ -79,7 +86,7 @@ export const benchReplaceAll = new (class extends CPUBenchmarkPlaywright {
79
86
80
87
export const benchUpdate = new ( class extends CPUBenchmarkPlaywright {
81
88
constructor ( ) {
82
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_03 ] ) ;
89
+ super ( cpuBenchmarkInfos [ Benchmark . _03 ] ) ;
83
90
}
84
91
async init ( browser : Browser , page : Page ) {
85
92
await checkElementExists ( page , "#run" ) ;
@@ -106,7 +113,7 @@ export const benchUpdate = new (class extends CPUBenchmarkPlaywright {
106
113
107
114
export const benchSelect = new ( class extends CPUBenchmarkPlaywright {
108
115
constructor ( ) {
109
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_04 ] ) ;
116
+ super ( cpuBenchmarkInfos [ Benchmark . _04 ] ) ;
110
117
}
111
118
async init ( browser : Browser , page : Page ) {
112
119
await checkElementExists ( page , "#run" ) ;
@@ -126,7 +133,7 @@ export const benchSelect = new (class extends CPUBenchmarkPlaywright {
126
133
127
134
export const benchSwapRows = new ( class extends CPUBenchmarkPlaywright {
128
135
constructor ( ) {
129
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_05 ] ) ;
136
+ super ( cpuBenchmarkInfos [ Benchmark . _05 ] ) ;
130
137
}
131
138
async init ( browser : Browser , page : Page ) {
132
139
await checkElementExists ( page , "#run" ) ;
@@ -147,7 +154,7 @@ export const benchSwapRows = new (class extends CPUBenchmarkPlaywright {
147
154
148
155
export const benchRemove = new ( class extends CPUBenchmarkPlaywright {
149
156
constructor ( ) {
150
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_06 ] ) ;
157
+ super ( cpuBenchmarkInfos [ Benchmark . _06 ] ) ;
151
158
}
152
159
async init ( browser : Browser , page : Page ) {
153
160
await checkElementExists ( page , "#run" ) ;
@@ -187,7 +194,7 @@ export const benchRemove = new (class extends CPUBenchmarkPlaywright {
187
194
188
195
export const benchRunBig = new ( class extends CPUBenchmarkPlaywright {
189
196
constructor ( ) {
190
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_07 ] ) ;
197
+ super ( cpuBenchmarkInfos [ Benchmark . _07 ] ) ;
191
198
}
192
199
async init ( browser : Browser , page : Page ) {
193
200
await checkElementExists ( page , "#run" ) ;
@@ -210,7 +217,7 @@ export const benchRunBig = new (class extends CPUBenchmarkPlaywright {
210
217
211
218
export const benchAppendToManyRows = new ( class extends CPUBenchmarkPlaywright {
212
219
constructor ( ) {
213
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_08 ] ) ;
220
+ super ( cpuBenchmarkInfos [ Benchmark . _08 ] ) ;
214
221
}
215
222
async init ( browser : Browser , page : Page ) {
216
223
await checkElementExists ( page , "#run" ) ;
@@ -225,7 +232,7 @@ export const benchAppendToManyRows = new (class extends CPUBenchmarkPlaywright {
225
232
226
233
export const benchClear = new ( class extends CPUBenchmarkPlaywright {
227
234
constructor ( ) {
228
- super ( benchmarksCommon . cpuBenchmarkInfos [ benchmarksCommon . BENCHMARK_09 ] ) ;
235
+ super ( cpuBenchmarkInfos [ Benchmark . _09 ] ) ;
229
236
}
230
237
async init ( browser : Browser , page : Page ) {
231
238
await checkElementExists ( page , "#run" ) ;
@@ -254,7 +261,7 @@ export const benchClear = new (class extends CPUBenchmarkPlaywright {
254
261
255
262
export const benchReadyMemory = new ( class extends MemBenchmarkPlaywright {
256
263
constructor ( ) {
257
- super ( benchmarksCommon . memBenchmarkInfos [ benchmarksCommon . BENCHMARK_21 ] ) ;
264
+ super ( memBenchmarkInfos [ Benchmark . _21 ] ) ;
258
265
}
259
266
async init ( browser : Browser , page : Page ) {
260
267
await checkElementExists ( page , "#run" ) ;
@@ -266,7 +273,7 @@ export const benchReadyMemory = new (class extends MemBenchmarkPlaywright {
266
273
267
274
export const benchRunMemory = new ( class extends MemBenchmarkPlaywright {
268
275
constructor ( ) {
269
- super ( benchmarksCommon . memBenchmarkInfos [ benchmarksCommon . BENCHMARK_22 ] ) ;
276
+ super ( memBenchmarkInfos [ Benchmark . _22 ] ) ;
270
277
}
271
278
async init ( browser : Browser , page : Page ) {
272
279
await checkElementExists ( page , "#run" ) ;
@@ -279,7 +286,7 @@ export const benchRunMemory = new (class extends MemBenchmarkPlaywright {
279
286
280
287
export const benchRun10KMemory = new ( class extends MemBenchmarkPlaywright {
281
288
constructor ( ) {
282
- super ( benchmarksCommon . memBenchmarkInfos [ benchmarksCommon . BENCHMARK_26 ] ) ;
289
+ super ( memBenchmarkInfos [ Benchmark . _26 ] ) ;
283
290
}
284
291
async init ( browser : Browser , page : Page ) {
285
292
await checkElementExists ( page , "#runlots" ) ;
@@ -292,7 +299,7 @@ export const benchRun10KMemory = new (class extends MemBenchmarkPlaywright {
292
299
293
300
export const benchUpdate5Memory = new ( class extends MemBenchmarkPlaywright {
294
301
constructor ( ) {
295
- super ( benchmarksCommon . memBenchmarkInfos [ benchmarksCommon . BENCHMARK_23 ] ) ;
302
+ super ( memBenchmarkInfos [ Benchmark . _23 ] ) ;
296
303
}
297
304
async init ( browser : Browser , page : Page ) {
298
305
await checkElementExists ( page , "#run" ) ;
@@ -312,7 +319,7 @@ export const benchUpdate5Memory = new (class extends MemBenchmarkPlaywright {
312
319
313
320
// export const benchReplace5Memory = new (class extends MemBenchmarkPlaywright {
314
321
// constructor() {
315
- // super(benchmarksCommon. memBenchmarkInfos[benchmarksCommon.BENCHMARK_24 ]);
322
+ // super(memBenchmarkInfos[Benchmark._24 ]);
316
323
// }
317
324
// async init(browser: Browser, page: Page) {
318
325
// await checkElementExists(page, "#run");
@@ -327,7 +334,7 @@ export const benchUpdate5Memory = new (class extends MemBenchmarkPlaywright {
327
334
328
335
export const benchCreateClear5Memory = new ( class extends MemBenchmarkPlaywright {
329
336
constructor ( ) {
330
- super ( benchmarksCommon . memBenchmarkInfos [ benchmarksCommon . BENCHMARK_25 ] ) ;
337
+ super ( memBenchmarkInfos [ Benchmark . _25 ] ) ;
331
338
}
332
339
async init ( browser : Browser , page : Page ) {
333
340
await checkElementExists ( page , "#run" ) ;
0 commit comments