-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathE2ETest.cs
More file actions
63 lines (52 loc) · 1.44 KB
/
E2ETest.cs
File metadata and controls
63 lines (52 loc) · 1.44 KB
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
58
59
60
61
62
63
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Remote;
namespace WeatherForcast.Selenium.Tests;
[TestFixture("chrome")]
[TestFixture("firefox")]
public class Tests {
RemoteWebDriver _driver;
private readonly String _browser;
public Tests(String browser)
{
_browser = browser;
}
[SetUp]
public void Init()
{
if (_browser.Equals("chrome"))
{
var options = new ChromeOptions();
options.AddArgument("headless");
options.AddArgument("ignore-certificate-errors");
_driver = new RemoteWebDriver(new Uri(GridSetup.WebDriverUrl), options);
}
else if (_browser.Equals("firefox"))
{
var options = new FirefoxOptions();
_driver = new RemoteWebDriver(new Uri(GridSetup.WebDriverUrl), options);
}
}
[Test]
public void SelectedLanguageShouldBeJava()
{
HomePage homePage = new HomePage(_driver);
homePage.GoToPage();
String currentText = homePage.GetSelectedLanguage();
Assert.That(currentText.Equals("Java"), "Current result is: " + currentText);
}
[Test]
public void MainPageHeaderShouldBeCorrect()
{
HomePage homePage = new HomePage(_driver);
homePage.GoToPage();
String currentText = homePage.GetPageHeader();
Assert.That(currentText.Equals("Unit tests with real dependencies"), "Current result is: " + currentText);
}
[TearDown]
public void Cleanup()
{
_driver.Quit();
_driver.Dispose();
}
}