Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jcjc
Created September 19, 2011 04:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcjc/1225976 to your computer and use it in GitHub Desktop.
Save jcjc/1225976 to your computer and use it in GitHub Desktop.
Sample Selenium-WebDriver tests
public void ShareSpecialCharTest() {
login(g_userDataMap.get(Constants.DEFAULT_USER));
g_nav.clickLeftButton();
String shareBody = Util.currentTime() + " " + TestData.SHARE_SPECIAL_CHAR;
HomeTest.verifyShareOnRecentActivity(driver, g_nav, shareBody);
}
public void ShareLimitTest() {
login(g_userDataMap.get(Constants.DEFAULT_USER));
g_nav.clickLeftButton();
String shareBody = Util.currentTime() + " " + TestData.SHARE_LONG;
HomeTest.verifyShareOnRecentActivity(driver, g_nav, shareBody);
}
public static void verifyShareOnRecentActivity(WebDriver driver,
Navigation nav, String shareBody) {
ShareView shareView = new ShareView(driver);
shareView.tapVisibility();
ActionSheet actionSheet = new ActionSheet(driver);
actionSheet.tapAction(Constants.VISIBLE_TO_CONNECTIONS_ONLY);
shareView = new ShareView(driver);
shareView.setBody(shareBody);
shareView.send();
HomeView nusView = new HomeView(driver);
nav.tap(Tab.DRAWER);
nav.tap(Tab.YOU);
ProfileView profileView = new ProfileView(driver);
profileView.tapRecentActivity();
UpdatesView recentActivity = new UpdatesView(driver);
List<NUSItem> activityList = recentActivity.getList();
NUSSimple shared = (NUSSimple) activityList.get(0);
String actualBody = shared.body();
Assert.assertEquals(actualBody, shareBody);
}
@brikis98
Copy link

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