(assertType, text, context, strict = false)
| 2949 | } |
| 2950 | |
| 2951 | async function proceedSee(assertType, text, context, strict = false) { |
| 2952 | let description |
| 2953 | if (!context) { |
| 2954 | if (this.context === webRoot) { |
| 2955 | context = this.context |
| 2956 | description = 'web page' |
| 2957 | } else { |
| 2958 | description = `current context ${this.context}` |
| 2959 | context = './/*' |
| 2960 | } |
| 2961 | } else { |
| 2962 | description = `element ${context}` |
| 2963 | } |
| 2964 | |
| 2965 | const smartWaitEnabled = assertType === 'assert' |
| 2966 | const res = await this._locate(withStrictLocator(context), smartWaitEnabled) |
| 2967 | assertElementExists(res, context) |
| 2968 | let selected = await forEachAsync(res, async el => this.browser.getElementText(getElementId(el))) |
| 2969 | |
| 2970 | // apply ignoreCase option |
| 2971 | if (store?.currentStep?.opts?.ignoreCase === true) { |
| 2972 | text = text.toLowerCase() |
| 2973 | selected = selected.map(elText => elText.toLowerCase()) |
| 2974 | } |
| 2975 | |
| 2976 | if (strict) { |
| 2977 | if (Array.isArray(selected) && selected.length !== 0) { |
| 2978 | return selected.map(elText => equals(description)[assertType](text, elText)) |
| 2979 | } |
| 2980 | return equals(description)[assertType](text, selected) |
| 2981 | } |
| 2982 | return stringIncludes(description)[assertType](text, selected) |
| 2983 | } |
| 2984 | |
| 2985 | /** |
| 2986 | * Mimic Array.forEach() API, but with an async callback function. |
nothing calls this directly
no test coverage detected