Last active
March 9, 2018 14:10
-
-
Save pettomartino/bf8a5efb7a0d34ade06a7f5f08547405 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script> | |
function myFunc() { | |
var email = document.getElementById("email").value | |
var e = document.getElementById("select") | |
var selectedOption = e.options[e.selectedIndex].value | |
var checkBox = document.getElementById('defaultCheck1').checked | |
if (email == 'foo@bar' && checkBox && selectedOption == "audi") { | |
document.getElementById('button').innerText = "Sending..." | |
} | |
return false; | |
} | |
</script> | |
</head> | |
<body> | |
<form onsubmit="return myFunc()"> | |
<div class="form-group"> | |
<label for="email">Email address</label> | |
<input type="email" class="form-control" id="email" placeholder="[email protected]"> | |
</div> | |
<div class="form-group"> | |
<label for="exampleFormControlSelect1">Example select</label> | |
<select id="select"> | |
<option>Select an option</option> | |
<option value="saab">Saab</option> | |
<option value="mercedes">Mercedes</option> | |
<option value="audi">Audi</option> | |
</select> | |
</div> | |
<div class="form-check"> | |
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1"> | |
<label class="form-check-label" for="defaultCheck1"> | |
Default checkbox | |
</label> | |
</div> | |
<div class="form-group"> | |
<label for="exampleFormControlTextarea1">Example textarea</label> | |
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea> | |
</div> | |
<button type="submit" id="button" class="btn btn-primary">Send</button> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
'Show sending message just when default checkbox and Audi are selected': (browser) => { | |
browser | |
.url("http://localhost:8080/teste.html") | |
.waitForElementVisible('body', 50) | |
.useXpath() | |
.setValue("//*[contains(text(), 'Email address')]/following-sibling::input", 'foo@bar') // select input next to a label "Email address" | |
.click("//*[contains(text(), 'Default checkbox')]") | |
.click("//*[text()='Select an option']") | |
.click("//*[text()='Audi']") | |
.click("//*[text()='Send']") | |
.expect.element("//*[contains(text(), 'Sending...')]").to.be.present | |
} | |
} |
Author
pettomartino
commented
Mar 9, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment