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

Accessibility: update to axe core 4.9 #73

Merged
merged 4 commits into from
Aug 21, 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
994 changes: 994 additions & 0 deletions src/AxaFrance.AxeExtended.HtmlReport/Assets/axe-core.fr.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/AxaFrance.AxeExtended.HtmlReport/Assets/report.en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"overall-banner-title": "Accessibility Report: Application {{Title}}",
"overall-banner-performed-at": "Test performed at: {{TimeStamp}}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
</PropertyGroup>

<ItemGroup>
<None Remove="Assets\axe-core.fr.json" />
<None Remove="Assets\axe-rgaa-extension.json" />
<None Remove="Assets\check-part.html" />
<None Remove="Assets\node-part.html" />
<None Remove="Assets\overall-result.html" />
Expand All @@ -27,7 +29,9 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Assets\axe-rgaa-extension.json" />
<EmbeddedResource Include="Assets\check-part.html" />
<EmbeddedResource Include="Assets\axe-core.fr.json" />
<EmbeddedResource Include="Assets\overall-result.html" />
<EmbeddedResource Include="Assets\overall-tablerow.html" />
<EmbeddedResource Include="Assets\page-result.html" />
Expand All @@ -36,7 +40,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Deque.AxeCore.Commons" Version="4.9.0" />
<PackageReference Include="Deque.AxeCore.Commons" Version="4.9.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
Expand Down
9 changes: 8 additions & 1 deletion src/AxaFrance.AxeExtended.HtmlReport/PageReportBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ public PageReportBuilder Build(AxeResult result)
/// <returns></returns>
public PageReportBuilder Build()
{
var result = this.Analyze(Config);
var config = Config.DeepClone();
if (Options.ReportLanguage == Language.French)
{
var locale = GetRessource("axe-core.fr.json");
//add or update the field "locale" in json object config, with the content of fr.json
config["locale"] = JObject.Parse(locale);
}
var result = this.Analyze(config as JObject);
Result = new AxePageResult(result, this);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Deque.AxeCore.Selenium" Version="4.9.0" />
<PackageReference Include="Deque.AxeCore.Selenium" Version="4.9.1" />
<PackageReference Include="SkiaSharp" Version="2.88.8" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.3.0.90" />
<PackageReference Include="Hummingbird.UI" Version="1.2.2772.2" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2478.35" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2651.64" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/AxaFrance.WebEngine.Runner/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"profiles": {
"WSL": {
"commandName": "WSL2",
"environmentVariables": {},
"distributionName": ""
},
"WebRunner": {
"commandName": "Project",
"commandLineArgs": "-encrypt helloworld -encryptionkey:abcdefghijklmn"
"commandLineArgs": "-browser:AndroidNative \"-device:Xiaomi Redmi Note 11\" -osVersion:11 -data:AXAPLUS_PARCOURS_CLES_SANTE_REMBOURSSEMENT.xml -a:AxaPlus.Automation.dll -appid:app-recette.apk -platform:Android",
"workingDirectory": "C:\\Users\\A269OL\\source\\repos\\webengine-dotnet-github\\src\\AxaFrance.WebEngine.Runner\\bin\\Debug\\net8.0"
}
}
}
4 changes: 2 additions & 2 deletions src/AxaFrance.WebEngine.Web/BrowserFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static WebDriver GetDriver(Platform platform, AxaFrance.WebEngine.Browser
/// <returns>WebDriver object</returns>
/// <remarks>
/// <para>
/// If you are another test framework, you must provide additional information to <see cref="Settings.Instance"/>, especially when testing on Mobile Devices.
/// If you are using another test framework, additional information must be provided to <see cref="Settings.Instance"/>, especially when testing on Mobile Devices.
/// </para>
/// <para>
/// This method will take account Desktop browsers and Mobile Devices. If <paramref name="platform"/> is valorized to 'Android'
Expand Down Expand Up @@ -415,7 +415,7 @@ private static object GetBrowserStackBrowserName(BrowserType browser)

private static WebDriver GetIEDriver()
{
throw new Exception("Internet Explorer is not supported anymore. Please update the browser and run tests in one of supported browsers: Chrome, Edge, Firefox and Safari");
throw new NotSupportedException("Internet Explorer is not supported anymore. Please update the browser and run tests in one of supported browsers: Chrome, Edge, Firefox and Safari");
}

private static WebDriver GetEdgeDriver(IEnumerable<string> browserOptions)
Expand Down
4 changes: 2 additions & 2 deletions src/Samples.Gherkin/Samples.Gherkin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.57" />
<PackageReference Include="SpecFlow.NUnit" Version="3.9.74" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Samples.LinearScripting/Samples.LinearScripting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.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">
Expand Down
114 changes: 61 additions & 53 deletions src/WebEngine.Test/UnitTests/Accessibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,75 +86,83 @@ public void AuditWithOptionsAndExportHtml()
public void AuditWithRGAAAndExportHtml()
{
//Execute mon test automatisé
using var driver = BrowserFactory.GetDriver(AxaFrance.WebEngine.Platform.Windows, BrowserType.ChromiumEdge);
driver.Navigate().GoToUrl("https://www.axa.fr");
try
using (var driver = BrowserFactory.GetDriver(AxaFrance.WebEngine.Platform.Windows, BrowserType.ChromiumEdge))
{
driver.FindElement(By.Id("footer_tc_privacy_button")).Click();
}
catch {
//if the cookie button does not exist, it's not a problem
}
driver.Navigate().GoToUrl("https://www.axa.fr");
try
{
driver.FindElement(By.Id("footer_tc_privacy_button")).Click();
}
catch
{
//if the cookie button does not exist, it's not a problem
}

var sw = Stopwatch.StartNew();
var sw = Stopwatch.StartNew();

var filename = new PageReportBuilder()
.WithRgaaExtension()
.WithSelenium(driver).Build().Export();
Debug.WriteLine($"Report generated in {sw.Elapsed.TotalSeconds} seconds");
Assert.IsTrue(File.Exists(filename));
var filename = new PageReportBuilder()
.WithOptions(new PageReportOptions() { ReportLanguage = Language.French })
.WithRgaaExtension()
.WithSelenium(driver).Build().Export();
Debug.WriteLine($"Report generated in {sw.Elapsed.TotalSeconds} seconds");
Assert.IsTrue(File.Exists(filename));
}

}

[TestMethod]
public void UserJourneyTest()
{
using var driver = BrowserFactory.GetDriver(AxaFrance.WebEngine.Platform.Windows, BrowserType.ChromiumEdge);
var defaultOptions = new PageReportOptions()
{
Title = "AXA.FR",
OutputFormat = OutputFormat.Zip
};
var builder = new OverallReportBuilder().WithDefaultOptions(defaultOptions);

//Analyze first page
driver.Navigate().GoToUrl("https://www.axa.fr/");
try
using (var driver = BrowserFactory.GetDriver(AxaFrance.WebEngine.Platform.Windows, BrowserType.ChromiumEdge))
{
driver.FindElement(By.Id("footer_tc_privacy_button")).Click();
}
catch {
//if the cookie button does not exist, it's not a problem
}
builder.WithSelenium(driver, "Main Page").Build();
var defaultOptions = new PageReportOptions()
{
Title = "AXA.FR",
OutputFormat = OutputFormat.Zip
};
var builder = new OverallReportBuilder().WithDefaultOptions(defaultOptions);

//Analyze second page
driver.Navigate().GoToUrl("https://www.axa.fr/pro.html");
try
{
driver.FindElement(By.Id("footer_tc_privacy_button")).Click();
}
catch {
//if the cookie button does not exist, it's not a problem
}
builder.WithSelenium(driver, "Pro").Build();
//Analyze first page
driver.Navigate().GoToUrl("https://www.axa.fr/");
try
{
driver.FindElement(By.Id("footer_tc_privacy_button")).Click();
}
catch
{
//if the cookie button does not exist, it's not a problem
}
builder.WithSelenium(driver, "Main Page").Build();

//Analyze second page
driver.Navigate().GoToUrl("https://www.axa.fr/pro.html");
try
{
driver.FindElement(By.Id("footer_tc_privacy_button")).Click();
}
catch
{
//if the cookie button does not exist, it's not a problem
}
builder.WithSelenium(driver, "Pro").Build();

//Analyze third page
driver.Navigate().GoToUrl("https://www.axa.fr/pro/services-assistance.html");
builder.WithSelenium(driver, "Assistance").Build();
//Analyze third page
driver.Navigate().GoToUrl("https://www.axa.fr/pro/services-assistance.html");
builder.WithSelenium(driver, "Assistance").Build();

//Demarche Inondation
driver.Navigate().GoToUrl("https://www.axa.fr/assurance-habitation/demarches-inondation.html");
builder.WithSelenium(driver, "Inondation").Build();
//Demarche Inondation
driver.Navigate().GoToUrl("https://www.axa.fr/assurance-habitation/demarches-inondation.html");
builder.WithSelenium(driver, "Inondation").Build();

driver.Navigate().GoToUrl("https://www.axa.fr/pro/devis-assurance-professionnelle.html");
builder.WithSelenium(driver, "Devis Pro").Build();
driver.Navigate().GoToUrl("https://www.axa.fr/pro/devis-assurance-professionnelle.html");
builder.WithSelenium(driver, "Devis Pro").Build();

driver.Navigate().GoToUrl("https://www.axa.fr/compte-bancaire.html");
builder.WithSelenium(driver, "Compte Bancaire").Build();
driver.Navigate().GoToUrl("https://www.axa.fr/compte-bancaire.html");
builder.WithSelenium(driver, "Compte Bancaire").Build();

string report = builder.Build().Export();
Assert.IsTrue(File.Exists(report));
string report = builder.Build().Export();
Assert.IsTrue(File.Exists(report));
}
}

}
Expand Down
20 changes: 2 additions & 18 deletions src/WebEngine.Test/UnitTests/AppMobileTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public void IntegrationTest()

TestSuiteApp app = new TestSuiteApp();
Settings settings = Settings.Instance;
settings.AppId = "TestData\\ApiDemos-debug.apk";
settings.AppId = "bs://e431031f604644eab52611190ccb96da80744c87";
settings.Platform = Platform.Android;
settings.Browser = BrowserType.AndroidNative;
settings.Device = "Android API 30";
settings.Device = "Xiaomi Redmi Note 11";
var testsuite = settings.TestSuite = app;
testsuite.Initialize(settings);
var result = testsuite.Run();
Expand All @@ -50,22 +50,6 @@ 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
4 changes: 2 additions & 2 deletions src/WebEngine.Test/WebEngine.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net48;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -27,7 +27,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.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">
Expand Down
Loading