Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Landing Page Test.
- *
- * @author ebartalos
- */
- public class GoogleBratislavaSearch
- extends PHXShared_AutomationTest
- {
- /**
- * Main testing method.
- */
- @Override
- public void execute() {
- // Go to https://www.google.com/?gws_rd=ssl
- navigateToCertainPage(" https://www.google.com/?gws_rd=ssl", false);
- // Verify presence of logo
- verifyElementPresent(By.id("hplogo"), "logo");
- // Verify presence of search input field
- verifyElementPresent(By.id("lst-ib"), "searchInput");
- // Verify presence of search button
- verifyElementPresent(By.name("btnK"), "searchSubmit");
- // Verify presence of feeling lucky button
- verifyElementPresent(By.name("btnI"), "feelingLucky");
- // Verify presence of footer
- verifyElementPresent(By.id("fbar"), "footer");
- // Verify presence of left half of footer
- verifyElementPresent(By.id("fsl"), "footerLeft");
- // Verify presence of right half of footer
- verifyElementPresent(By.id("fsr"), "footerRight");
- // Verify presence of "cookie" bar in footer
- verifyElementPresent(By.id("epbar"), "cookieBar");
- // Type "Bratislava" in the search input
- enterTextIntoElement(By.id("lst-ib"), "Bratislava", "Bratislava");
- // Click search button
- clickElement(By.name("btnG"), "clickSearch");
- // Verify if wikipedia is displayed in search results
- isTextPresent(By.id("gsr"), "wikipedia.org/wiki/Bratislava");
- }
- }
- 1. You do not have to add comment to each line. Better split your comment into some logical parts and add comments to them, for example
- //Verify elements of the page
- ...
- //Verify elements of the footer
- ...
- //Perform search and verify the search results are correct
- 2. It's better to use verifyElementVisible, not verifyElementPresent. verifyElementVisible verifies that the element is actually displayed on the page, while verifyElementPresent just verifies element is in HTML (but can be invisible)
- 3. "isTextPresent" returns just true or false, and writes information line. It does not fail the test if the text is not there!!!! So you are not catching the bug, if the link is not there. In your case I would use verifyTextPresent or verifyElementIsVisible(By.xpath("//a[contains(.,Bratislava - Wikipedia, the free encyclopedia)]"));
- 4. Your comment to the class name is wrong :) /**
- * Landing Page Test.
- 5. I would check presence of each link in the footer (Advertising, Business, etc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement