Skip to content
Snippets Groups Projects
FindExpertTest.java 6.22 KiB
package edu.ncsu.csc.itrust.selenium;


import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.support.ui.Select;

import edu.ncsu.csc.itrust.enums.TransactionType;

/*
 * This is the Selenium equivalent of FindExpertTest.java
 */
public class FindExpertTest extends iTrustSeleniumTest{
	
	/**
	 * Selenium html unit driver.
	 */
	private HtmlUnitDriver driver;
	
	/**
	 * MID of the test user "Random Person"
	 */
	private static final String RANDOM_PERSON_MID = "1";
	
	/**
	 * Default user password.
	 */
	private static final String PASSWORD = "pw";
	
	/**
	 * Build the absolute URL for Find Expert off of the base URL and relative url.
	 */
	private static final String FIND_EXPERT = ADDRESS + "/auth/patient/findExpert.jsp";
	
	/**
	 * Set up for testing by clearing and recreating
	 * all standard data, then performing UC47
	 * specific data generation.
	 */
	@Override
	protected void setUp() throws Exception {
		super.setUp(); // clear tables is called in super
		gen.clearAllTables();
		gen.standardData();
		gen.uc47SetUp();
	}
	
	/**
	 * Remove the UC47 specific data and clear all tables.
	 */
	@Override
	protected void tearDown() throws Exception {
		gen.uc47TearDown();
		gen.clearAllTables();
	}
	
	public void testEditAndFindExpert() throws Exception {
		// login admin
		driver = (HtmlUnitDriver)login("9000000001", "pw");
		String title = driver.getTitle();
		assertEquals("iTrust - Admin Home", title);
		assertLogged(TransactionType.HOME_VIEW, 9000000001L, 0L, "");
		
		// click on Edit Personnel
		driver.findElement(By.linkText("Edit Personnel")).click();
		// find hcp
		title = driver.getTitle();