Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monthly Update #71

Merged
merged 5 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish-PROnly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
if("${{github.ref}}" -eq "refs/heads/main") { $suffix = "" } else { $suffix = "-preview" }
if("${{github.base_ref}}".Contains("main")) { $suffix = "" } else { $suffix = "-preview" }
.\.sonar\scanner\dotnet-sonarscanner begin /k:"AxaGuilDEv_webengine-dotnet" /o:"axaguildev" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build "./src" --no-restore --configuration Debug -p:AssemblyVersion=1.2.${{github.run_number}} -p:Version=1.2.${{github.run_number}}$suffix
dotnet-coverage collect 'dotnet test "./src/WebEngine.Test" --filter TestCategory!=Mobile' -f xml -o 'coverage.xml'
Expand Down
5 changes: 4 additions & 1 deletion src/AxaFrance.AxeExtended.HtmlReport/OverallReportBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,18 @@ public string Export(string fileName = null)

//Add tags
ruleResults.AppendLine($"<td>");
var additionalTags = options.AdditionalTags?.GetTagsByRule(ruleId);
/*
var additionalTags = options.AdditionalTags?.GetTagsByRule(rule.Key);
if (additionalTags != null)
{
foreach (var tag in additionalTags)
{
ruleResults.AppendLine($"<span class='tag'>{tag}</span>");
}
}
*/
ruleResults.AppendLine($"</td>");

foreach (var page in Result.PageResults)
{
if (Array.Find(page.Violations, x => x.Item.Id == ruleId) != null)
Expand Down
2 changes: 1 addition & 1 deletion src/AxaFrance.AxeExtended.HtmlReport/PageReportBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private string GenerateRuleSection(AxeResultEnhancedItem[] items, string path)
);
}
string tags = string.Join(" ", item.Item.Tags.Select(x => $"<div class='regularition'>{x}</div>"));
var additinalTags = Options.AdditionalTags?.GetTagsByRule(item.Item.Id);
var additinalTags = Options.AdditionalTags?.GetTagsByRule(item.Item);
if (additinalTags != null)
{
tags += string.Join(" ", additinalTags.Select(x => $"<div class='regularition'>{x}</div>"));
Expand Down
4 changes: 2 additions & 2 deletions src/AxaFrance.AxeExtended.HtmlReport/PageReportOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public sealed class PageReportOptions
public Language ReportLanguage { get; set; } = Language.English;

/// <summary>
/// In the report, show the RGAA tags (equivalent RGAA Test Methdologie) for each rule. Default is true.
/// In the report, show additional tags
/// Default value: will use additional tags provider to get equivalent RGAA test tags.
/// </summary>
public AdditionalTagsProvider AdditionalTags { get; set; } = new RgaaTagsProvider();
public TagsProvider AdditionalTags { get; set; } = new WcagTagsProvider();

/// <summary>
/// Gets or sets the value indicating if advanced screenshot should be used. Default is true.
Expand Down
9 changes: 5 additions & 4 deletions src/AxaFrance.AxeExtended.HtmlReport/RgaaTagsProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Deque.AxeCore.Commons;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -11,7 +12,7 @@ namespace AxaFrance.AxeExtended.HtmlReport
/// A mapping of Axe rules to RGAA rules, for future use
/// refers to the Mapping Rules Excel file
/// </summary>
internal class RgaaTagsProvider : AdditionalTagsProvider
internal class RgaaTagsProvider : TagsProvider
{

private static Dictionary<string, IEnumerable<string>> Mapping { get; } = new Dictionary<string, IEnumerable<string>>()
Expand Down Expand Up @@ -73,9 +74,9 @@ internal class RgaaTagsProvider : AdditionalTagsProvider
{"table-fake-caption", new string[] {"RGAA 5.1.1"}},
};

public override IEnumerable<string> GetTagsByRule(string ruleId)
public override IEnumerable<string> GetTagsByRule(AxeResultItem rule)
{

var ruleId = rule.Id;
if (Mapping.ContainsKey(ruleId))
{
return Mapping[ruleId];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Deque.AxeCore.Commons;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -9,13 +10,19 @@ namespace AxaFrance.AxeExtended.HtmlReport
/// <summary>
/// The provider to get additional tags for a rule.
/// </summary>
public abstract class AdditionalTagsProvider
public abstract class TagsProvider
{
/// <summary>
/// return a list of additional tags for a rule. if the rule is not found, return an empty list.
/// </summary>
/// <param name="ruleId">the identifier of the rule</param>
/// <returns>a list of additional tags for a given rule.</returns>
public abstract IEnumerable<string> GetTagsByRule(string ruleId);
public abstract IEnumerable<string> GetTagsByRule(AxeResultItem rule);

/// <summary>
/// If additional tags should be shown only on overall report.
/// The value is determined by tags provider
/// </summary>
public bool ShowOnOverallReportOnly { get; internal set; }
}
}
23 changes: 23 additions & 0 deletions src/AxaFrance.AxeExtended.HtmlReport/WcagTagsProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Deque.AxeCore.Commons;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AxaFrance.AxeExtended.HtmlReport
{
internal class WcagTagsProvider : TagsProvider
{
public override IEnumerable<string> GetTagsByRule(AxeResultItem rule)
{
foreach (var tag in rule.Tags)
{
if(tag.StartsWith("wcag"))
{
yield return tag;
}
}
}
}
}
10 changes: 7 additions & 3 deletions src/AxaFrance.WebEngine.MobileApp/AppFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.iOS;
using OpenQA.Selenium.Remote;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -230,10 +231,11 @@ private static AppiumDriver ConnectToDevice()

options.AddAdditionalAppiumOption("newCommandTimeout", 90);
options.AddAdditionalAppiumOption("nativeWebScreenshot", true);
options.AcceptInsecureCertificates = s.AllowAnyCertificate;

if (!string.IsNullOrEmpty(s.OsVersion))
{
options.AddAdditionalAppiumOption("os_version", s.OsVersion);
options.PlatformVersion = s.OsVersion;
}


Expand All @@ -258,12 +260,14 @@ private static AppiumDriver ConnectToDevice()
if (s.Platform == Platform.Android)
{
options.AutomationName = "UiAutomator2";
driver = new AndroidDriver(new Uri(appiumServerAddress), options);
driver = new AndroidDriver(new Uri(appiumServerAddress), options, TimeSpan.FromSeconds(180));
}
else if (s.Platform == Platform.iOS)
{
options.AutomationName = "XCUITest";
driver = new IOSDriver(new Uri(appiumServerAddress), options);
options.AddAdditionalAppiumOption("includeSafariInWebviews", true);
options.AddAdditionalAppiumOption("connectHardwareKeyboard", true);
driver = new IOSDriver(new Uri(appiumServerAddress), options, TimeSpan.FromSeconds(180));
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Selenium.WebDriver" Version="4.20.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.23.0" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/AxaFrance.WebEngine.ReportViewer/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<TextBlock Text="Test Cases:" Grid.Row="1" Style="{DynamicResource TextBlockViewHeaderHighlighted}" VerticalAlignment="Center" Margin="8,4" />
<ProgressBar Grid.ColumnSpan="2" Background="Green" Value="20" Maximum="100" Foreground="Red" x:Name="pgPassrate" />
<TextBlock Text="Test Cases:" Grid.Row="1" Style="{DynamicResource TextBlockViewHeaderHighlighted}" VerticalAlignment="Center" Margin="8,4" x:Name="txtTitle" />
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="4" HorizontalAlignment="Right" Panel.ZIndex="10">
<Button Style="{DynamicResource FlatButtonStyle}" Click="ShowXmlReport_Click">
<StackPanel Orientation="Horizontal">
Expand Down
6 changes: 4 additions & 2 deletions src/AxaFrance.WebEngine.ReportViewer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ private void Load()

double totalSeconds = currentReport.Duration.TotalSeconds;
ApplyFilter();

pgPassrate.Value = currentReport.Failed;
pgPassrate.Maximum = currentReport.Passed + currentReport.Failed;
pgPassrate.ToolTip = $"{currentReport.Passed} passed, {currentReport.Failed} failed";
IntializeErrorStatistic();
emptyPresenter.Visibility = Visibility.Collapsed;
}
Expand All @@ -113,7 +115,7 @@ private void ApplyFilter()
{
lvTestcases.SelectedIndex = 0;
}

txtTitle.Text = $"Test cases ({lvTestcases.Items.Count}/{currentReport.TestResult.Count})";
}

private TestSuiteReport currentReport;
Expand Down
6 changes: 3 additions & 3 deletions src/AxaFrance.WebEngine.Web/AxaFrance.WebEngine.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@


<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.1.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Selenium.WebDriver" Version="4.20.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.23.0" />
<PackageReference Include="SkiaSharp" Version="2.88.8" />
<PackageReference Include="WebDriverManager" Version="2.17.2" />
<PackageReference Include="WebDriverManager" Version="2.17.4" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions src/Samples.DataDriven/TestCases/TC_InsuranceQuote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ namespace Samples.DataDriven.TestCases
//Test case: Insurance Quote
public class TC_InsuranceQuote : TestCaseWeb
{
public TC_InsuranceQuote() {

public TC_InsuranceQuote() {
//Define Test steps
TestSteps = new TestStep[] {
new TestStep{ Action = nameof(Login)},
Expand Down
4 changes: 2 additions & 2 deletions src/Samples.LinearScripting/Samples.LinearScripting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Selenium.WebDriver" Version="4.20.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.23.0" />
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 17 additions & 0 deletions src/WebEngine.Test/UnitTests/AppMobileTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ public void IntegrationTest()
System.IO.File.Delete(junitReport);
}

[TestMethod]
public void BrowserstackTest()
{
var settings = Settings.Instance;
settings.Username = "cugnetpascal1";
settings.Password = "qTJD3xCzAxsuU3xykyQt";
settings.GridServerUrl = "https://hub-cloud.browserstack.com/wd/hub";
settings.AppId = "bs://6448e8709276b8c8c179bcb1d7ec6b1b2414e7c2";
settings.Device = "IPhone 13";
settings.OsVersion = "17";
using (var driver = AppFactory.GetDriver(Platform.iOS))
{
driver.Quit();
}

}

[TestMethod]
public void UnitTest()
{
Expand Down
Loading
Loading