-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomePageTest.cs
55 lines (42 loc) · 1.35 KB
/
HomePageTest.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
using DotNet.Testcontainers.Builders;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Remote;
using Testcontainers.WebDriver;
using WeatherForcast.Selenium.Tests;
namespace TestProject1;
public class Tests
{
internal IWebDriver driver;
private WebDriverContainer _webDriverContainer;
private String videoFilePath = Path.Combine(CommonDirectoryPath.GetSolutionDirectory().DirectoryPath, "video.mp4");
[SetUp]
public async Task Init()
{
_webDriverContainer = new WebDriverBuilder()
.WithImage("selenium/standalone-firefox:123.0")
.WithRecording()
.Build();
await _webDriverContainer.StartAsync();
driver = new RemoteWebDriver(new Uri(_webDriverContainer.GetConnectionString()), new FirefoxOptions());
}
[Test]
public void SelectedLanguageShouldBeJava()
{
HomePage homePage = new HomePage(driver);
homePage.GoToPage();
String currentText = homePage.GetSelectedLanguage();
Assert.That(currentText.Equals("Java"), "Current result is: " + currentText);
}
[TearDown]
public async Task Cleanup()
{
await _webDriverContainer.StopAsync()
.ConfigureAwait(true);
await _webDriverContainer.ExportVideoAsync(videoFilePath)
.ConfigureAwait(true);
_webDriverContainer.DisposeAsync();
driver.Dispose();
}
}