Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 5cef1bf

Browse files
Evan Jacobsheathkit
Evan Jacobs
authored andcommitted
Explicitly remove newlines from getText() (#3618)
MSEdge does not properly remove newlines, which causes false negatives when using `textToBePresentInElement()`
1 parent f36e981 commit 5cef1bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/expectedConditions.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ export class ProtractorExpectedConditions {
214214
Function {
215215
var hasText = () => {
216216
return elementFinder.getText().then((actualText: string): boolean => {
217-
return actualText.indexOf(text) > -1;
217+
// MSEdge does not properly remove newlines, which causes false negatives
218+
return actualText.replace(/\r?\n|\r/g, '').indexOf(text) > -1;
218219
});
219220
};
220221
return this.and(this.presenceOf(elementFinder), hasText);

0 commit comments

Comments
 (0)