Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Minor fixes #patch (#110)
Browse files Browse the repository at this point in the history
Removed SonarQube and lgtm
Added initial browser test
Made Utilities internal
  • Loading branch information
IvanJosipovic authored Apr 23, 2020
2 parents 879b5f2 + 8491f0c commit 7b894b6
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 33 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,4 @@ jobs:
dotnet-version: 3.1.201

- name: Dotnet Build
run: dotnet build -c Release

- name: Dotnet Test
run: dotnet test -c Release
run: dotnet build -c Release
22 changes: 5 additions & 17 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,13 @@ jobs:
with:
dotnet-version: 3.1.201

- name: SonarQube Install
run: dotnet tool install dotnet-sonarscanner --tool-path ./

- name: SonarQube Start
continue-on-error: true
run: ./dotnet-sonarscanner begin /o:ivanjosipovic /k:IvanJosipovic_BlazorTable /d:sonar.host.url=https://sonarcloud.io /d:sonar.login=${{ secrets.SONARQUBE_TOKEN }}

- name: Dotnet Build
run: dotnet build -c Release

- name: Dotnet Test
run: dotnet test -c Release

- name: Dotnet Publish
working-directory: src/BlazorTable.Sample.Wasm
run: dotnet publish -c Release

- name: SonarQube End
continue-on-error: true
run: ./dotnet-sonarscanner end /d:sonar.login=${{ secrets.SONARQUBE_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Test
id: netlify
uses: netlify/actions/cli@master
Expand All @@ -56,4 +40,8 @@ jobs:
run: |
$url = '${{ steps.netlify.outputs.NETLIFY_URL }}';
Write-Output $url;
shell: pwsh
Set-Content -Path "src/BlazorTable.Tests/BrowserTestsAddress.config" -Value $url;
shell: pwsh

- name: Dotnet Test
run: dotnet test -c Release
1 change: 0 additions & 1 deletion .sonarcloud.properties

This file was deleted.

3 changes: 1 addition & 2 deletions BlazorTable.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\cicd.yml = .github\workflows\cicd.yml
lgtm.yml = lgtm.yml
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
Expand All @@ -20,7 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorTable.Sample.Server",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorTable.Sample.Shared", "src\BlazorTable.Sample.Shared\BlazorTable.Sample.Shared.csproj", "{25E8AB75-2F08-463E-8499-0C5BBB20BC50}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorTable.Tests", "src\BlazorTable.Tests\BlazorTable.Tests.csproj", "{64B71D26-A307-4541-9B17-BD6709211F21}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorTable.Tests", "src\BlazorTable.Tests\BlazorTable.Tests.csproj", "{64B71D26-A307-4541-9B17-BD6709211F21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/BlazorTable.svg?style=flat-square)](https://www.nuget.org/packages/BlazorTable)
[![Nuget (with prereleases)](https://img.shields.io/nuget/dt/BlazorTable.svg?style=flat-square)](https://www.nuget.org/packages/BlazorTable)
![](https://github.com/IvanJosipovic/BlazorTable/workflows/CI/CD/badge.svg)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=IvanJosipovic_BlazorTable&metric=alert_status)](https://sonarcloud.io/dashboard?id=IvanJosipovic_BlazorTable)


Blazor Table Component with Sorting, Paging and Filtering
Expand Down
5 changes: 0 additions & 5 deletions lgtm.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/BlazorTable.Sample.Wasm/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51053/",
"applicationUrl": "http://localhost:51076/",
"sslPort": 0
}
},
Expand Down
Binary file added src/BlazorTable.Sample.Wasm/wwwroot/favicon.ico
Binary file not shown.
10 changes: 9 additions & 1 deletion src/BlazorTable.Tests/BlazorTable.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.0" />
<PackageReference Include="PuppeteerSharp" Version="2.0.3" />
<PackageReference Include="PuppeteerSharp.Contrib.Extensions" Version="1.0.0" />
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
Expand All @@ -24,4 +26,10 @@
<ProjectReference Include="..\BlazorTable\BlazorTable.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="BrowserTestsAddress.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
70 changes: 70 additions & 0 deletions src/BlazorTable.Tests/BrowserTests.cs
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);
}
}
}
1 change: 1 addition & 0 deletions src/BlazorTable.Tests/BrowserTestsAddress.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://localhost:51076
8 changes: 8 additions & 0 deletions src/BlazorTable/BlazorTable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@
<ItemGroup>
<Watch Include="..\**\*.razor" />
</ItemGroup>


<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>$(AssemblyName).Tests</_Parameter1>
<!-- We use the value of AssemblyName to declare the value of the attribute -->
</AssemblyAttribute>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/BlazorTable/Utillities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace BlazorTable
{
public static class Utillities
internal static class Utilities
{
public static IEnumerable<T> OrEmptyIfNull<T>(this IEnumerable<T> source)
{
Expand Down

0 comments on commit 7b894b6

Please sign in to comment.