-
Notifications
You must be signed in to change notification settings - Fork 129
Expand file tree
/
Copy pathTextInputTest.java
More file actions
43 lines (32 loc) · 1.46 KB
/
TextInputTest.java
File metadata and controls
43 lines (32 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.yourcompany.Tests;
import com.yourcompany.Pages.GuineaPigPage;
import org.openqa.selenium.InvalidElementStateException;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.rmi.UnexpectedException;
import java.util.UUID;
/**
* Created by mehmetgerceker on 12/7/15.
*/
public class TextInputTest extends TestBase {
/**
* Runs a simple test verifying if the comment input is functional.
* @throws InvalidElementStateException
*/
@org.testng.annotations.Test(dataProvider = "hardCodedBrowsers")
public void verifyCommentInputTest(String browser, String version, String os, Method method)
throws MalformedURLException, InvalidElementStateException, UnexpectedException {
this.createDriver(browser, version, os, method.getName());
WebDriver driver = this.getWebDriver();
String commentInputText = UUID.randomUUID().toString();
this.annotate("Visiting GuineaPig page...");
GuineaPigPage page = GuineaPigPage.visitPage(driver);
this.annotate(String.format("Submitting comment: \"%s\"", commentInputText));
page.submitComment(commentInputText);
this.annotate(String.format("Asserting submitted comment is: \"%s\"", commentInputText));
Assert.assertTrue(page.getSubmittedCommentText().contains(commentInputText));
}
}