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

Added method promt() for promt js alerts with input field #591

Merged
merged 1 commit into from Sep 28, 2017

Conversation

Projects
None yet
3 participants
@simple-elf
Contributor

simple-elf commented Aug 30, 2017

In some project I'm faced new alert() dialog - promt(). It created alert with input field (Screenshot).
Js code example:
var username = prompt("Please input your username");

So I added new Selenide method promt(), that inputs some text in such alert.

public static String promt(String expectedDialogText, String inputText) {
    if (!doDismissModalDialogs()) {
      Alert alert = switchTo().alert();
      String actualDialogText = alert.getText();
      if (inputText != null)
        alert.sendKeys(inputText);
      alert.accept();
      checkDialogText(expectedDialogText, actualDialogText);
      return actualDialogText;
    }
    return null;
  }

Also I added tests in AlertTest, and modified html page for tests.

@asolntsev

This comment has been minimized.

Show comment
Hide comment
@asolntsev

asolntsev Aug 31, 2017

Member

@simple-elf Travis CI build failed because of one failed test in htmlunit:

canSubmitPromtDialog

Element should have text 'Hello, Aegon Targaryen!' {#message}
Element: '<div id="message">Hello, null!</div>'
Screenshot: 
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.$Proxy27.shouldHave(Unknown Source)
	at integration.AlertTest.canSubmitPromtDialog(AlertTest.java:35)
Member

asolntsev commented Aug 31, 2017

@simple-elf Travis CI build failed because of one failed test in htmlunit:

canSubmitPromtDialog

Element should have text 'Hello, Aegon Targaryen!' {#message}
Element: '<div id="message">Hello, null!</div>'
Screenshot: 
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.$Proxy27.shouldHave(Unknown Source)
	at integration.AlertTest.canSubmitPromtDialog(AlertTest.java:35)
@simple-elf

This comment has been minimized.

Show comment
Hide comment
@simple-elf

simple-elf Sep 1, 2017

Contributor

HtmlUnitDriver 2.26 added prompt functional, but locally I can't pass that test.
Also I have mistake in method name 'promt' except 'prompt'

Contributor

simple-elf commented Sep 1, 2017

HtmlUnitDriver 2.26 added prompt functional, but locally I can't pass that test.
Also I have mistake in method name 'promt' except 'prompt'

@asolntsev

This comment has been minimized.

Show comment
Hide comment
@asolntsev

asolntsev Sep 10, 2017

Member

@simple-elf So, what is the status? Are you working on this PR? Do you need some help?

Member

asolntsev commented Sep 10, 2017

@simple-elf So, what is the status? Are you working on this PR? Do you need some help?

@simple-elf

This comment has been minimized.

Show comment
Hide comment
@simple-elf

simple-elf Sep 11, 2017

Contributor

Can you try run this test with HtmlUnitDriver 2.26?

Contributor

simple-elf commented Sep 11, 2017

Can you try run this test with HtmlUnitDriver 2.26?

@BorisOsipov

This comment has been minimized.

Show comment
Hide comment
@BorisOsipov

BorisOsipov Sep 11, 2017

Collaborator

@simple-elf we can't till resolve #585

Collaborator

BorisOsipov commented Sep 11, 2017

@simple-elf we can't till resolve #585

@asolntsev asolntsev added this to the 4.7 milestone Sep 27, 2017

@asolntsev asolntsev self-assigned this Sep 27, 2017

asolntsev added a commit that referenced this pull request Sep 27, 2017

asolntsev added a commit that referenced this pull request Sep 27, 2017

asolntsev added a commit that referenced this pull request Sep 28, 2017

@asolntsev asolntsev merged commit d8e9cf8 into codeborne:master Sep 28, 2017

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

asolntsev added a commit that referenced this pull request Sep 28, 2017

asolntsev added a commit that referenced this pull request Sep 28, 2017

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