Skip to content
Snippets Groups Projects
ViewDiagnosisStatisticsTest.java 23.9 KiB
Newer Older
HMoss's avatar
HMoss committed
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
package edu.ncsu.csc.itrust.selenium;

import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
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;

/**
 * Test Diagnosis Trends / Epidemics page
 */
public class ViewDiagnosisStatisticsTest extends iTrustSeleniumTest {

	private HtmlUnitDriver driver;
	/**
	 * Sets up the test. Clears the tables then adds necessary data
	 */
	@Before
	public void setUp() throws Exception {
		super.setUp();
		gen.clearAllTables();
		gen.standardData();
		gen.patient_hcp_vists();
		gen.hcp_diagnosis_data();
	}

	/*
	 * Authenticate PHA
	 * MID 7000000001
	 * Password: pw
	 * Choose "Diagnosis Trends"
	 * Enter Fields:
	 * ICDCode: 72.00
	 * ZipCode: 27695
	 * StartDate: 06/28/2011, EndDate: 09/28/2011
	 */
	/**
	 * testViewDiagnosisTrends_PHAView1
	 * @throws Exception
	 */
	@Test
	public void testViewDiagnosisTrends_PHAView1() throws Exception {
		driver = (HtmlUnitDriver)login("7000000001", "pw");
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[2]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		WebElement elem = null;
		try {
			elem = driver.findElement(By.id("diagnosisStatisticsTable"));
			fail("Element should not be visible");
		} catch (NoSuchElementException d) {
			assertNull(elem);
		}
		//assertFalse(isElementPresent(By.id("diagnosisStatisticsTable")));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("72.00 - Mumps");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27695");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("06/28/2011");
		driver.findElement(By.name("endDate")).clear();
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		try {
			elem = driver.findElement(By.id("diagnosisStatisticsTable"));
			assertTrue(elem != null);
		} catch (NoSuchElementException d) {
			fail("Element should be present");
		}
		//assertTrue(isElementPresent(By.id("diagnosisStatisticsTable")));
		WebElement zip = elem.findElements(By.tagName("td")).get(2);
		/* I know this is a stupid assert. This is how it was originally */
		assertTrue(zip.getText().contains("0"));
		WebElement region = elem.findElements(By.tagName("td")).get(3);
		assertTrue(region.getText().contains("2"));
	}

	/*
	 * Authenticate PHA
	 * MID 7000000001
	 * Password: pw
	 * Choose "Epidemics"
	 * Enter Fields:
	 * Diagnosis: 84.50 Malaria
	 * ZipCode: 12345
	 * StartDate: 1/23/12
	 * Threshold: [leave blank]
	 */
	/**
	 * testViewDiagnosisTrendsEpidemic_InvalidThreshold
	 * @throws Exception
	 */
	@Test
	public void testViewDiagnosisTrendsEpidemic_InvalidThreshold()
			throws Exception {
		driver = (HtmlUnitDriver)login("7000000001", "pw");
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[2]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("epidemics");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("84.50 - Malaria");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("12345");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("01/23/2012");

		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_EPIDEMICS_VIEW, 7000000001L, 0L,	"");
	}

	/*
	 * Authenticate HCP MID 9000000008 Password: pw Choose "Diagnosis Trends"
	 * Enter Fields: ICDCode: 487.00 ZipCode: 27695 StartDate: 08/28/2011,
	 * EndDate: 09/28/2011 Document new office visit Add new diagnosis (487.00)
	 * Choose "Diagnosis Trends" Enter Fields: ICDCode: 487.00 ZipCode: 27695
	 * StartDate: 08/28/2011, EndDate: 09/28/2011
	 */
	/**
	 * testViewDiagnosisTrends_LHCPObserveIncrease
	 * 
	 * @throws Exception
	 */
	@Test
	public void testViewDiagnosisTrends_LHCPObserveIncrease() throws Exception {
		driver = (HtmlUnitDriver)login("9000000008", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]"))
				.click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("487.00 - Influenza");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27695");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("08/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");

		WebElement table = driver.findElement(By.id("diagnosisStatisticsTable"));
		long local1 = Long.parseLong(table.findElements(By.tagName("td")).get(2).getText());
		long region1 = Long.parseLong(table.findElements(By.tagName("td")).get(3).getText());
		
		// Click Document Office Visit
		driver.findElement(By.xpath("//div[@id='iTrustMenu']/div/div[3]/div/h2")).click();
		driver.findElement(By.linkText("Document Office Visit")).click();

		// Search and choose patient 25
		//search for patient 25 by MID
		driver.findElement(By.name("UID_PATIENTID")).sendKeys("25");
		
		//the button to click should have the text of the MID
		driver.findElement(By.cssSelector("input[value='25']")).submit();

		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-uap/documentOfficeVisit.jsp"));
		assertTrue(driver.getPageSource().contains("Click on an old office visit to modify:"));

		// Click "Yes, Document Office Visit"
		driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();

		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-uap/editOfficeVisit.jsp"));

		driver.findElement(By.name("visitDate")).clear();
		driver.findElement(By.name("visitDate")).sendKeys("09/28/2011");
		driver.findElement(By.name("notes")).clear();
		driver.findElement(By.name("notes")).sendKeys("I like diet-coke");
		driver.findElement(By.id("update")).click();
		assertTrue(driver.getPageSource().contains("Information Successfully Updated"));
		assertLogged(TransactionType.OFFICE_VISIT_CREATE, 9000000008L, 25L, "Office visit");

		new Select(driver.findElement(By.name("ICDCode"))).selectByVisibleText("487.00 - Influenza");
		driver.findElement(By.id("add_diagnosis")).click();
		assertTrue(driver.getPageSource().contains("Diagnosis information successfully updated."));

		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[2]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend again
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("487.00 - Influenza");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27606-1234");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("08/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");

		WebElement table2 = driver.findElement(By.id("diagnosisStatisticsTable"));
		long local2 = Long.parseLong(table2.findElements(By.tagName("td")).get(2).getText());
		long region2 = Long.parseLong(table2.findElements(By.tagName("td")).get(3).getText());

		assertEquals(local1 + 1, local2);
		assertEquals(region1 + 1, region2);
	}

	/*
	 * Authenticate HCP MID 9000000008 Password: pw Choose "Diagnosis Trends"
	 * Enter Fields: ICDCode: 487.00 ZipCode: 276 StartDate: 08/28/2011,
	 * EndDate: 09/28/2011
	 */
	/**
	 * testViewDiagnosisTrends_InvalidZip
	 * 
	 * @throws Exception
	 */
	public void testViewDiagnosisTrends_InvalidZip() throws Exception {
		driver = (HtmlUnitDriver)login("9000000008", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("487.00 - Influenza");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("276");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("08/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");

		assertTrue(driver.getPageSource().contains("Information not valid"));
		assertTrue(driver.getPageSource().contains("Zip Code must be 5 digits!"));
	}
	
	/*
	 * Authenticate HCP
	 * MID 9000000008
	 * Password: pw
	 * Choose "Diagnosis Trends"
	 * Enter Fields:
	 * ICDCode: 84.50
	 * ZipCode: 27519
	 * StartDate: 09/28/2011, EndDate: 08/28/2011
	 */
	/**
	 * testViewDiagnosisTrends_InvalidDates
	 * @throws Exception
	 */
	public void testViewDiagnosisTrends_InvalidDates() throws Exception {
		driver = (HtmlUnitDriver)login("9000000008", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]"))
				.click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("84.50 - Malaria");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27519");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("09/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("08/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");

		assertTrue(driver.getPageSource().contains("Information not valid"));
		assertTrue(driver.getPageSource().contains("Start date must be before end date!"));		
	}
	
	/*
	 * Authenticate HCP
	 * MID 9000000008
	 * Password: pw
	 * Choose "Diagnosis Trends"
	 * Enter Fields:
	 * ICDCode: 487.00
	 * ZipCode: 27695
	 * StartDate: 08/28/2011, EndDate: 09/28/2011
	 * Enter Fields:
	 * ICDCode: 487.00
	 * ZipCode: 27606
	 * StartDate: 08/28/2011, EndDate: 09/28/2011
	 */
	/**
	 * testViewDiagnosisTrends_SameRegionCount
	 * @throws Exception
	 */
	public void testViewDiagnosisTrends_SameRegionCount() throws Exception {
		driver = (HtmlUnitDriver)login("9000000008", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("84.50 - Malaria");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27695");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("06/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");
		
		WebElement table = driver.findElement(By.id("diagnosisStatisticsTable"));
		long region1 = Long.parseLong(table.findElements(By.tagName("td")).get(3).getText());
		
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("84.50 - Malaria");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27606");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("06/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");
		WebElement table2 = driver.findElement(By.id("diagnosisStatisticsTable"));
		long region2 = Long.parseLong(table2.findElements(By.tagName("td")).get(3).getText());
		
		assertEquals(region1, region2);
	}
	
	/*
	 * Authenticate HCP
	 * MID 9000000000
	 * Password: pw
	 * Choose "Diagnosis Trends"
	 * Enter Fields:
	 * ICDCode: 84.50
	 * ZipCode: 27519
	 * StartDate: 09/28/2011, EndDate: 09/28/2011
	 */
	/**
	 * testViewDiagnosisTrends_SameDateStartEnd
	 * @throws Exception
	 */
	public void testViewDiagnosisTrends_SameDateStartEnd() throws Exception {
		driver = (HtmlUnitDriver)login("9000000008", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("84.50 - Malaria");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27519");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("09/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");

		WebElement table = driver.findElement(By.id("diagnosisStatisticsTable"));
		long local = Long.parseLong(table.findElements(By.tagName("td")).get(2).getText());
		long region = Long.parseLong(table.findElements(By.tagName("td")).get(3).getText());
		assertEquals(local, 0);
		assertEquals(region, 0);
	}
	
	/*
	 * Authenticate HCP
	 * MID 9000000008
	 * Password: pw
	 * Choose "Diagnosis Trends"
	 * Enter Fields:
	 * ICDCode: 487.00
	 * ZipCode: 27607
	 * StartDate: 08/28/2011, EndDate: 09/28/2011
	 */
	/**
	 * testViewDiagnosisTrends_RegionNotLess
	 * @throws Exception
	 */
	public void testViewDiagnosisTrends_RegionNotLess() throws Exception {
		driver = (HtmlUnitDriver)login("9000000008", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("487.00 - Influenza");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27607");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("08/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");

		WebElement table = driver.findElement(By.id("diagnosisStatisticsTable"));
		long local = Long.parseLong(table.findElements(By.tagName("td")).get(2).getText());
		long region = Long.parseLong(table.findElements(By.tagName("td")).get(3).getText());
		assertTrue(local <= region);
	}
	
	/*
	 * Authenticate HCP
	 * MID 9000000008
	 * Password: pw
	 * Choose "Diagnosis Trends"
	 * Enter Fields:
	 * ICDCode: ""
	 * ZipCode: 27695
	 * StartDate: 08/28/2011, EndDate: 09/28/2011
	 */
	/**
	 * testViewDiagnosisTrends_NoDiagnosisSelected
	 * @throws Exception
	 */
	public void testViewDiagnosisTrends_NoDiagnosisSelected() throws Exception {
		driver = (HtmlUnitDriver)login("9000000008", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("trends");
		driver.findElement(By.id("select_View")).click();
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27695");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("06/28/2011");
		driver.findElement(By.name("endDate")).sendKeys("09/28/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_TRENDS_VIEW, 9000000008L, 0L, "");
		
		assertTrue(driver.getPageSource().contains("Information not valid"));
		assertTrue(driver.getPageSource().contains("ICDCode must be valid diagnosis!"));
	}
	
	/**
	 * viewDiagnosisEpidemics_NoEpidemicRecords
	 * @throws Exception
	 */
	public void testViewDiagnosisEpidemics_NoEpidemicRecords() throws Exception {
		driver = (HtmlUnitDriver)login("9000000000", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("epidemics");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("84.50 - Malaria");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("38201");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("06/02/2010");
		driver.findElement(By.name("threshold")).clear();
		driver.findElement(By.name("threshold")).sendKeys("110");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_EPIDEMICS_VIEW, 9000000000L, 0L, "");
		
		assertTrue(driver.getPageSource().contains("There is no epidemic occurring in the region."));
	}
	
	/**
	 * viewDiagnosisEpidemics_YesEpidemic
	 * @throws Exception
	 */
	public void testViewDiagnosisEpidemics_YesEpidemic() throws Exception {
		gen.influenza_epidemic();
		
		driver = (HtmlUnitDriver)login("9000000007", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("epidemics");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("487.00 - Influenza");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27607");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("11/02/2011");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_EPIDEMICS_VIEW, 9000000007L, 0L, "");
		assertFalse(driver.getPageSource().contains("THERE IS AN EPIDEMIC OCCURRING IN THIS REGION!"));
	}
	
	/**
	 * viewDiagnosisEpidemics_NoEpidemic
	 * @throws Exception
	 */
	public void testViewDiagnosisEpidemics_NoEpidemic() throws Exception {
		gen.influenza_epidemic();
		driver = (HtmlUnitDriver)login("9000000007", "pw");

		// Click Diagnosis Trends
		driver.findElement(By.cssSelector("h2.panel-title")).click();
		driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
		driver.findElement(By.linkText("Diagnosis Trends")).click();

		// View Trend
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		new Select(driver.findElement(By.name("viewSelect"))).selectByValue("epidemics");
		driver.findElement(By.id("select_View")).click();
		new Select(driver.findElement(By.name("icdCode"))).selectByVisibleText("487.00 - Influenza");
		driver.findElement(By.name("zipCode")).clear();
		driver.findElement(By.name("zipCode")).sendKeys("27607");
		driver.findElement(By.name("startDate")).clear();
		driver.findElement(By.name("startDate")).sendKeys("02/15/2010");
		driver.findElement(By.id("select_diagnosis")).click();
		assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp-pha/viewDiagnosisStatistics.jsp"));
		assertLogged(TransactionType.DIAGNOSIS_EPIDEMICS_VIEW, 9000000007L, 0L, "");
		assertTrue(driver.getPageSource().contains("There is no epidemic occurring in the region."));
	}
}