-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTests.cs
63 lines (50 loc) · 1.72 KB
/
Tests.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
58
59
60
61
62
63
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Playwright;
using Scrutiny.CSharp;
using UsageExample.CSharp.Pages;
using Xunit;
using Xunit.Abstractions;
namespace UsageExample.CSharp;
public class Tests : IDisposable
{
private readonly ITestOutputHelper _outputHelper;
private readonly IPlaywright _playwright;
public Tests(ITestOutputHelper outputHelper)
{
outputHelper.WriteLine("Setting up browser drivers. This might take awhile");
Program.Main(new[] {"install"});
_playwright = Playwright.CreateAsync().GetAwaiter().GetResult();
outputHelper.WriteLine("Finished setting up browser drivers");
_outputHelper = outputHelper;
}
public void Dispose()
{
_playwright?.Dispose();
}
[Fact]
public async Task WithAttrs()
{
var isHeadless = Environment.GetEnvironmentVariable("CI") == "true";
var launchOptions = new BrowserTypeLaunchOptions
{
Headless = isHeadless
};
var browser = await _playwright.Firefox.LaunchAsync(launchOptions);
var context = await browser.NewContextAsync(new BrowserNewContextOptions {IgnoreHTTPSErrors = true});
var page = await context.NewPageAsync();
await page.GotoAsync("http://127.0.0.1:5000/home");
var config = new Configuration
{
Seed = 553931187,
MapOnly = false,
ComprehensiveActions = true,
ComprehensiveStates = true
};
var gs = new GlobalState(page, _outputHelper);
var result = await Scrutinize.Start<Home>(gs, config);
Assert.Equal(14, result.Steps.Count());
Assert.Equal(5, result.Graph.Count());
}
}