angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.74k stars 2.31k forks source link

Extra whitespace from getText() in Edge 14 #3965

Open heathkit opened 7 years ago

heathkit commented 7 years ago

Our Travis smoke tests are almost passing! Unfortunately, there's an annoying issue with Edge 14 where getText() is returning extra whitespace.

[MicrosoftEdge 14.14393 Windows 10 #31] [16:20:59] I/sauce - Using SauceLabs selenium server at http://ondemand.saucelabs.com:80/wd/hub
[MicrosoftEdge 14.14393 Windows 10 #31] Started
[MicrosoftEdge 14.14393 Windows 10 #31] ..................FF..F.FF.FFF.........................
[MicrosoftEdge 14.14393 Windows 10 #31] 
[MicrosoftEdge 14.14393 Windows 10 #31] Failures:
[MicrosoftEdge 14.14393 Windows 10 #31] 1) locators by repeater should find by partial match
[MicrosoftEdge 14.14393 Windows 10 #31]   Message:
[MicrosoftEdge 14.14393 Windows 10 #31]     Expected 'T ' to equal 'T'.
[MicrosoftEdge 14.14393 Windows 10 #31]   Stack:
[MicrosoftEdge 14.14393 Windows 10 #31]     Error: Failed expectation
[MicrosoftEdge 14.14393 Windows 10 #31]         at Object.<anonymous> (/home/travis/build/angular/protractor/spec/basic/locators_spec.js:186:41)
[MicrosoftEdge 14.14393 Windows 10 #31]         at /home/travis/build/angular/protractor/node_modules/jasminewd2/index.js:102:25
[MicrosoftEdge 14.14393 Windows 10 #31]         at new ManagedPromise (/home/travis/build/angular/protractor/node_modules/selenium-webdriver/lib/promise.js:1067:7)
[MicrosoftEdge 14.14393 Windows 10 #31]         at controlFlowExecute (/home/travis/build/angular/protractor/node_modules/jasminewd2/index.js:87:18)
[MicrosoftEdge 14.14393 Windows 10 #31]         at TaskQueue.execute_ (/home/travis/build/angular/protractor/node_modules/selenium-webdriver/lib/promise.js:2970:14)
[MicrosoftEdge 14.14393 Windows 10 #31]         at TaskQueue.executeNext_ (/home/travis/build/angular/protractor/node_modules/selenium-webdriver/lib/promise.js:2953:27)
[MicrosoftEdge 14.14393 Windows 10 #31]         at asyncRun (/home/travis/build/angular/protractor/node_modules/selenium-webdriver/lib/promise.js:2860:25)
[MicrosoftEdge 14.14393 Windows 10 #31]         at /home/travis/build/angular/protractor/node_modules/selenium-webdriver/lib/promise.js:676:7
[MicrosoftEdge 14.14393 Windows 10 #31]         at process._tickCallback (internal/process/next_tick.js:103:7)

We should either special-case the tests to trim whitespace for edge, or something. There's already a bug tracking this on issues.microsoftedge.com

wswebcreation commented 7 years ago

@heathkit @vikerman

Shall I pick this up? And what should be the approach?

  1. Fix this by trimming the spaces?
  2. Upgrade all browsers to the "latest" versions?
CodeBast4rd commented 5 years ago

Please trim the whitespace before returning the string from getText() as documented in https://www.protractortest.org/#/api?view=webdriver.WebElement.prototype.getText.

Citation.

Get the visible innerText of this element, including sub-elements, without any leading or trailing whitespace. Visible elements are not hidden by CSS.

I have the same problem with safari 12 and safari 13.