Skip to content

Instantly share code, notes, and snippets.

View tjmaher's full-sized avatar

T.J. Maher tjmaher

View GitHub Profile
public abstract class CommonUtils {
private static int timeout = 10;
public CommonUtils() {
_driver = DriverUtils.getDriver();
}
public static WebDriver _driver;
public WebDriverWait wait;
public class PurchaseOrderTest {
public WebDriver driver;
@BeforeClass
public void setUp(){
driver = new FirefoxDriver();
}
@Test(priority = 1)
package com.java.headfirst.beatbox;
import javax.sound.midi.*;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.util.ArrayList;
public enum Instrument {
BASS_DRUM("Bass Drum", 35),
SIDE_STICK("Side Stick", 37),
CLOSED_HIGH_HAT("Closed High Hat", 42),
OPEN_HIGH_HAT("Open High Hat", 46);
private String label;
private int drumKey;
RemoteTestNG starting
LOGIN_PAGE: Navigating to the Login page...
Navigating to: https://the-internet.herokuapp.com/login
Thread id = 1
LOGIN_PAGE: Header is: Login Page
LOGIN_PAGE: Checking if the page elements display correctly.
LOGIN_PAGE: Entering username.
LOGIN_PAGE: Enter password.
SECURE_AREA: Checking if the page elements display correctly.
SECURE_AREA: Header is: Secure Area
package tests;
import base.DriverFactory;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
import utils.DriverUtils;
import static enums.UserEnum.*;
package utils;
import org.openqa.selenium.*;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.TestException;
public abstract class CommonUtils {
public enum LoginPageEnum implements ISelector {
HEADER("h2"),
USERNAME("[name='username']"),
PASSWORD("[name='password']"),
LOGIN_BUTTON("[type='submit'][class='radius']");
String id;
private LoginPageEnum(String Id){
package pages;
import enums.UserEnum;
import interfaces.ISelector;
import org.openqa.selenium.By;
import utils.CommonUtils;
import static org.testng.Assert.assertTrue;
public class LoginPage extends CommonUtils{
@tjmaher
tjmaher / CommonUtils.java
Created June 19, 2015 18:21
List of common utilities used for Selenium / Java tests
package utils;
import org.openqa.selenium.*;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.TestException;
public abstract class CommonUtils {