-
-
Notifications
You must be signed in to change notification settings - Fork 752
Expand file tree
/
Copy pathinternal_api_helper.js
More file actions
47 lines (37 loc) · 1.05 KB
/
Copy pathinternal_api_helper.js
File metadata and controls
47 lines (37 loc) · 1.05 KB
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
import HelperModule from '../../../lib/helper.js'
import ConfigModule from '../../../lib/config.js'
const Helper = HelperModule.default || HelperModule
const Config = ConfigModule.default || ConfigModule
class ConfigHelper extends Helper {
constructor(config) {
super(config)
this._withinActive = false
this._tries = 0
}
reportConfig() {
// Helper is loaded via import() (the ESM realm), so it has always shared the live config.
console.log(`API_HELPER marker=${Config.get().helpers.ConfigHelper.marker}`)
}
// --- used by the effects scenarios ---
_withinBegin() {
this._withinActive = true
}
_withinEnd() {
this._withinActive = false
}
seeMissing() {
throw new Error('element not found')
}
clickInside() {
console.log(`EFFECTS_CLICK withinActive=${this._withinActive}`)
}
pass() {
console.log('EFFECTS_PASS ran')
}
flaky() {
this._tries++
console.log(`EFFECTS_FLAKY try=${this._tries}`)
if (this._tries < 2) throw new Error('not ready yet')
}
}
export default ConfigHelper