-
Notifications
You must be signed in to change notification settings - Fork 0
/
GinsengBrowserTests.cs
57 lines (49 loc) · 1.38 KB
/
GinsengBrowserTests.cs
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
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Gander.Unit;
using System.Collections.Generic;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.Linq;
namespace GinsengTest
{
[TestClass]
public class GinsengBrowserTests : SeleniumHelper
{
protected override Form LoginForm()
{
var form = new Form("/Account/Login", "frmLogin")
{
{ "Email", string.Empty },
{ "Password", string.Empty }
};
form.KeySource = InsertedKeySource.None;
return form;
}
protected override string LogoffUrl => "Account/Logoff";
[TestMethod]
public void SubmitRequest()
{
EnumDriversAndEnvironments((driver, env) =>
{
Login(driver, env);
int id = new Form("/Request/Create", "frmMain")
{
{ "ApplicationId", "Ginseng" },
{ "TypeId", "Fix" },
{ "Title", "Sample Request" },
{ "TextBody", $"This is a sample request created by unit test project in {env.Name} by {driver.GetType().Name}." }
}.Submit(driver, env);
Assert.IsTrue(env.AssertExists("SELECT 1 FROM [dbo].[Request] WHERE [Id]=@id", new { id }));
});
}
protected override IEnumerable<Gander.Unit.Abstract.Environment> GetEnvironments()
{
yield return new GinsengEnvironment("Prod", "http://ginseng.azurewebsites.net");
}
protected override IEnumerable<IWebDriver> GetWebDrivers()
{
yield return new ChromeDriver();
}
}
}