From 5cef1bf20f88a2c3bb8944afbc6a328fc273aedd Mon Sep 17 00:00:00 2001 From: Evan Jacobs Date: Wed, 5 Oct 2016 22:11:15 -0400 Subject: [PATCH] Explicitly remove newlines from getText() (#3618) MSEdge does not properly remove newlines, which causes false negatives when using `textToBePresentInElement()` --- lib/expectedConditions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/expectedConditions.ts b/lib/expectedConditions.ts index 02902c192..a44c6a390 100644 --- a/lib/expectedConditions.ts +++ b/lib/expectedConditions.ts @@ -214,7 +214,8 @@ export class ProtractorExpectedConditions { Function { var hasText = () => { return elementFinder.getText().then((actualText: string): boolean => { - return actualText.indexOf(text) > -1; + // MSEdge does not properly remove newlines, which causes false negatives + return actualText.replace(/\r?\n|\r/g, '').indexOf(text) > -1; }); }; return this.and(this.presenceOf(elementFinder), hasText);