80 lines
3.4 KiB
C#
80 lines
3.4 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using EnVisage.Code;
|
|
using NUnit.Framework;
|
|
using OpenQA.Selenium;
|
|
using OpenQA.Selenium.Remote;
|
|
using OpenQA.Selenium.Support.PageObjects;
|
|
using OpenQA.Selenium.Support.UI;
|
|
|
|
namespace IntegrationTests.Helpers.Pages
|
|
{
|
|
public class CreateScenarioPage : BasePage
|
|
{
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "Name")]
|
|
public IWebElement NameTextBox { get; set; }
|
|
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "Color")]
|
|
public IWebElement ColorTextBox { get; set; }
|
|
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "btnsave")]
|
|
public IWebElement SaveButton { get; set; }
|
|
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "StartDate")]
|
|
public IWebElement StartDateTextBox { get; set; }
|
|
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "EndDate")]
|
|
public IWebElement EndDateTextBox { get; set; }
|
|
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "MilestoneStartDate")]
|
|
public IWebElement MilestoneStartDateTextBox { get; set; }
|
|
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "TotalMilestones")]
|
|
public IWebElement TotalMilestonesTextBox { get; set; }
|
|
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "ProjectedRevenue")]
|
|
public IWebElement ProjectedRevenueTextBox { get; set; }
|
|
|
|
[CacheLookup]
|
|
[FindsBy(How = How.Id, Using = "GrossMargin")]
|
|
public IWebElement GrossMarginTextBox { get; set; }
|
|
|
|
public void EnterScenarioInfo(IWebDriver webDriver, string name, string color, Guid templateId, ScenarioType type, string startDate, string endDate, string mileDate, int milestones,
|
|
decimal revenue, decimal grossMargin)
|
|
{
|
|
NameTextBox.SendKeys(name);
|
|
ColorTextBox.SendKeys(color);
|
|
if (!Browser.SelectOptionByValue(webDriver, "Type", type.ToString()))
|
|
Assert.Fail("Cannot find an option with value '{0}' in select#Type.", type.ToString());
|
|
if (!Browser.SelectOptionByValue(webDriver, "TemplateId", templateId.ToString()))
|
|
Assert.Fail("Cannot find an option with value '{0}' in select#TemplateId.", templateId);
|
|
StartDateTextBox.Clear();StartDateTextBox.SendKeys(startDate);
|
|
EndDateTextBox.Clear();EndDateTextBox.SendKeys(endDate);
|
|
MilestoneStartDateTextBox.Clear();MilestoneStartDateTextBox.SendKeys(mileDate);
|
|
TotalMilestonesTextBox.Clear();TotalMilestonesTextBox.SendKeys(milestones.ToString(CultureInfo.InvariantCulture));
|
|
ProjectedRevenueTextBox.Clear();ProjectedRevenueTextBox.SendKeys(revenue.ToString(CultureInfo.InvariantCulture));
|
|
GrossMarginTextBox.Clear();GrossMarginTextBox.SendKeys(grossMargin.ToString(CultureInfo.InvariantCulture));
|
|
}
|
|
|
|
public void Save(IWebDriver webDriver)
|
|
{
|
|
Logger.Fatal("going to click save button");
|
|
// if button.click will not work then try JS click
|
|
//SaveButton.Click();
|
|
Browser.ExecuteJavaScript(webDriver, "$('#frmEditScenario').submit()");
|
|
Logger.Fatal("just clicked save button");
|
|
var wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(300));
|
|
var tr = wait.Until(driver => driver.FindElement(By.CssSelector("#prjcts tbody tr")));
|
|
Logger.Fatal("ended wait for save button");
|
|
}
|
|
}
|
|
}
|