package com.thoughtworks.selenium.corebased;
import com.thoughtworks.selenium.*;
/**
 * @author XlateHtmlSeleneseToJava
 * Generated from E:\buildroot\Dev\selenium-rc_svn\trunk\rc\clients\java\target\selenium-server\tests/TestConfirmations.html.
 */
public class TestConfirmations extends SeleneseTestCase
{
   public void testConfirmations() throws Throwable {
		selenium.setContext("Test Confirmation Verifification", "info");

/* Test verify Confirmation */
		// open|../tests/html/test_confirm.html|
		selenium.open("../tests/html/test_confirm.html");
		// chooseCancelOnNextConfirmation||
		selenium.chooseCancelOnNextConfirmation();
		// click|confirmAndLeave|
		selenium.click("confirmAndLeave");
		// verifyConfirmationPresent||
		assertTrue(selenium.isConfirmationPresent());
		boolean sawCondition7 = false;
		for (int second = 0; second < 60; second++) {
			try {
				if ((selenium.isConfirmationPresent())) {
					sawCondition7 = true;
					break;
				}
			}
			catch (Exception ignore) {
			}
			pause(1000);
		}
		assertTrue(sawCondition7);
		
		// assertConfirmationPresent||
		assertTrue(selenium.isConfirmationPresent());
		// verifyConfirmation|You are about to go to a dummy page.|
		verifyEquals("You are about to go to a dummy page.", selenium.getConfirmation());
		// verifyTitle|Test Confirm|
		verifyEquals("Test Confirm", selenium.getTitle());
		// clickAndWait|confirmAndLeave|
		selenium.click("confirmAndLeave");
		// verifyConfirmation|*dummy page*|
		verifyEquals("*dummy page*", selenium.getConfirmation());
		// verifyTitle|Dummy Page|
		verifyEquals("Dummy Page", selenium.getTitle());
		// open|../tests/html/test_confirm.html|
		selenium.open("../tests/html/test_confirm.html");

		boolean sawThrow15 = false;
		try {
					// assertConfirmation|This should fail - there are no confirmations|
		assertEquals("This should fail - there are no confirmations", selenium.getConfirmation());
		}
		catch (Throwable e) {
			sawThrow15 = true;
		}
		verifyTrue(sawThrow15);
		
		// clickAndWait|confirmAndLeave|
		selenium.click("confirmAndLeave");

		boolean sawThrow18 = false;
		try {
					// assertConfirmation|this should fail - wrong confirmation|
		assertEquals("this should fail - wrong confirmation", selenium.getConfirmation());
		}
		catch (Throwable e) {
			sawThrow18 = true;
		}
		verifyTrue(sawThrow18);
		
		// open|../tests/html/test_confirm.html|
		selenium.open("../tests/html/test_confirm.html");
		// clickAndWait|confirmAndLeave|
		selenium.click("confirmAndLeave");

		boolean sawThrow22 = false;
		try {
					// open|../tests/html/test_confirm.html|
		selenium.open("../tests/html/test_confirm.html");
		}
		catch (Throwable e) {
			sawThrow22 = true;
		}
		assertTrue(sawThrow22);
		

		checkForVerificationErrors();
	}
}
