This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed SonarQube and lgtm Added initial browser test Made Utilities internal
- Loading branch information
Showing
13 changed files
with
97 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using PuppeteerSharp; | ||
using PuppeteerSharp.Contrib.Extensions; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
namespace BlazorTable.Tests | ||
{ | ||
public class BrowserTests : IAsyncLifetime | ||
{ | ||
private string BaseAddress; | ||
|
||
private Browser Browser { get; set; } | ||
|
||
public async Task InitializeAsync() | ||
{ | ||
string filename = "BrowserTestsAddress.config"; | ||
|
||
if (File.Exists(filename)) | ||
BaseAddress = File.ReadAllText(filename); | ||
else | ||
throw new Exception($"Missing {filename}"); | ||
|
||
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision); | ||
|
||
Browser = await Puppeteer.LaunchAsync(new LaunchOptions | ||
{ | ||
Headless = true | ||
}); | ||
} | ||
|
||
public async Task DisposeAsync() | ||
{ | ||
await Browser?.CloseAsync(); | ||
} | ||
|
||
private async Task PrintPerf(Page page) | ||
{ | ||
var perf = await page.EvaluateExpressionAsync<long>("window.performance.timing.domContentLoadedEventEnd - window.performance.timing.navigationStart"); | ||
Console.WriteLine($"Load Time: {perf}ms"); | ||
} | ||
|
||
[Fact] | ||
public async Task CheckRoot() | ||
{ | ||
bool hasError = false; | ||
|
||
var page = await Browser.NewPageAsync(); | ||
|
||
page.Console += Page_Console; | ||
|
||
void Page_Console(object sender, ConsoleEventArgs e) | ||
{ | ||
if (e.Message.Type == ConsoleType.Error) | ||
hasError = true; | ||
} | ||
|
||
await page.GoToAsync(BaseAddress); | ||
|
||
(await page.WaitForSelectorAsync("div.table-responsive > table > tbody > tr:nth-child(1) > td:nth-child(3)")).InnerText().ShouldBe("Astrix Mariette"); | ||
|
||
hasError.ShouldBeFalse(); | ||
|
||
await PrintPerf(page); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
http://localhost:51076 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters