forked from bunsenapp/go-selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SendAlertText functionality and tests
- Loading branch information
heraclmene
committed
Dec 27, 2016
1 parent
1c7d3cb
commit df88659
Showing
7 changed files
with
162 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package integrationtests | ||
|
||
import ( | ||
"testing" | ||
|
||
goselenium "github.com/bunsenapp/go-selenium" | ||
) | ||
|
||
func Test_AlertSendAlertText_CanSendAlertTextCorrectly(t *testing.T) { | ||
setUp() | ||
defer tearDown() | ||
|
||
driver := createDriver(t) | ||
_, err := driver.CreateSession() | ||
if err != nil { | ||
t.Errorf("Create session error") | ||
} | ||
|
||
_, err = driver.Go("https://heraclmene.github.io/helpers/goselenium/prompt.html") | ||
if err != nil { | ||
t.Errorf("Error visiting URL") | ||
} | ||
|
||
resp, err := driver.SendAlertText("test") | ||
if err != nil || resp.State != "success" { | ||
t.Errorf("Error returned or sending alert text was not a success") | ||
} | ||
|
||
_, err = driver.AcceptAlert() | ||
if err != nil { | ||
t.Errorf("Error was returned when accepting alert.") | ||
} | ||
|
||
_, err = driver.AlertText() | ||
if err != nil { | ||
comErr := err.(goselenium.CommunicationError) | ||
if comErr.Response.State != goselenium.NoSuchAlert { | ||
t.Errorf("Error returned was not correct.") | ||
} | ||
} else { | ||
t.Errorf("Error returned was not correct.") | ||
} | ||
|
||
printObjectResult(resp) | ||
} |
This file contains 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