New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trim in com.codeborne.selenide.Condition.getAttributeValue(WebElement, String) is problematic for exactValue #573

Closed
mseele opened this Issue Jul 17, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@mseele
Contributor

mseele commented Jul 17, 2017

Hi,

i want to test that my textarea field has a whitespace at the end.
Because of the "attr.trim()" in com.codeborne.selenide.Condition.getAttributeValue(WebElement, String) this is not possible.

When i test

dialog.description().shouldHave(exactValue("Regression test description "));

i always get following exception:

Element should have attribute value=Regression test description {By.id: dmm-uid-dialog_edit_description}
Element: '<textarea class="gwt-TextArea BBI4CJC-a-O" id="dmm-uid-dialog_edit_description" type="textarea" value="Regression test description "></textarea>'
Screenshot: file:/C:/dev/workspaces/dmm/dmmRegressionTests/build/reports/tests/1500282739757.3.png
Timeout: 4 s.
at com.codeborne.selenide.impl.WebElementSource.checkCondition(WebElementSource.java:66)
at com.codeborne.selenide.commands.Should.should(Should.java:35)
at com.codeborne.selenide.commands.Should.execute(Should.java:29)
at com.codeborne.selenide.commands.Should.execute(Should.java:12)
at com.codeborne.selenide.commands.Commands.execute(Commands.java:143)
at com.codeborne.selenide.impl.SelenideElementProxy.dispatchAndRetry(SelenideElementProxy.java:87)
at com.codeborne.selenide.impl.SelenideElementProxy.invoke(SelenideElementProxy.java:63)
at com.sun.proxy.$Proxy8.shouldHave(Unknown Source)
at de.guhsoft.dmm.tests.ui.pages.AbstractElementDialog$TextField.shouldBe(AbstractElementDialog.java:48)
at de.guhsoft.dmm.tests.ui.EntityTest.createAndEditProposals(EntityTest.java:336)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

In my opinion com.codeborne.selenide.Condition.exactValue(String) should be very strict and do not use trim(). The com.codeborne.selenide.Condition.value(String) can do this.

@asolntsev

This comment has been minimized.

Show comment
Hide comment
@asolntsev

asolntsev Jul 24, 2017

Contributor
Contributor

asolntsev commented Jul 24, 2017

@mseele

This comment has been minimized.

Show comment
Hide comment
@mseele

mseele Aug 1, 2017

Contributor

I've added pull request #578

Contributor

mseele commented Aug 1, 2017

I've added pull request #578

@mseele mseele referenced this issue Aug 1, 2017

Merged

Fix issue 573 #578

asolntsev added a commit that referenced this issue Aug 6, 2017

asolntsev added a commit that referenced this issue Aug 7, 2017

@asolntsev asolntsev self-assigned this Aug 7, 2017

@asolntsev asolntsev added this to the 4.6 milestone Aug 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment