/*
 * WebProcessTest
 */
package com.company.test;

import java.io.IOException;
import java.sql.SQLException;

import junit.framework.TestCase;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.thoughtworks.selenium.Selenium;


/**
 * Implements integration tests for a "Web process".
 *
 * @author Ralf Kintrup
 */
public final class WebProcessTest extends TestCase {
    private static final String sClass = "WebProcessTest";
    private static final Log log = LogFactory.getLog(WebProcessTest.class);
    private Selenium selenium = null;
    private static final String sBaseURL = "http://localhost:9090";

    public WebProcessTest(String arg0) {
        super(arg0);
    }

    protected void setUp() throws Exception {
        super.setUp();
        // Get a reference to the shared Selenium instance.
        this.setSelenium(ProcessSuite.getSelenium());
    }

    protected void tearDown() throws Exception {
        super.tearDown();
        this.setSelenium(null);
    }

    public void testMyWebProcess() {
        selenium.open(sBaseURL + "/myApp/");
        selenium.verifyTextPresent("Welcome to my test app");
        selenium.clickAndWait("link=Continue");
        selenium.verifyTitle("Some Title");
        selenium.verifyTextPresent("Register for my newsletter");
    }

    private Selenium getSelenium() {
        return selenium;
    }

    private void setSelenium(Selenium selenium) {
        this.selenium = selenium;
    }
}

