using System;
using Selenium;
using NUnit.Framework;

namespace webtests
{
	public class TestLogin
	{              
		internal static void LoginAdministrator(ISelenium selenium)
		{
			selenium.Open("/orciid/default.aspx");
			if (selenium.IsTextPresent("LOG OUT"))
			{
				selenium.Click("link=LOG OUT");
				selenium.WaitForPageToLoad("30000");
			}
			Assert.IsTrue(selenium.IsTextPresent("Welcome"));
			Assert.IsTrue(selenium.IsTextPresent("User name:"));
			Assert.IsTrue(selenium.IsTextPresent("Password:"));
			selenium.Type("UsernameTextBox", "admin");
			selenium.Type("PasswordTextBox", "admin");
			selenium.Click("LoginButton");
			selenium.WaitForPageToLoad("30000");
			if (selenium.IsTextPresent("Browser Compatibility Check"))
				selenium.WaitForPageToLoad("30000");
			Assert.IsTrue(selenium.IsTextPresent("Announcements"));
		}
	}
}
