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

feat(commons): move selenium typings to common typings #45

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
15 changes: 13 additions & 2 deletions packages/commons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ This package exists primarily to help .NET tool developers integrate `axe-core`
* [Deque.AxeCore.Playwright](../playwright/README.md) in combination with [Playwright for .NET](https://playwright.dev/dotnet/)
* [Deque.AxeCore.Selenium](../selenium/README.md) in combination with [Selenium](https://www.selenium.dev/)'s [C# Selenium.WebDriver package](https://www.nuget.org/packages/Selenium.WebDriver)

### `AxeResult`

`AxeResult` represents the [axe-core Results Object](https://www.deque.com/axe/core-documentation/api-documentation/#results-object).

### `AxeRunContext`

`AxeRunContext` represents the [axe-core Context Parameter](https://www.deque.com/axe/core-documentation/api-documentation/#context-parameter).

### `AxeRunOptions`

`AxeRunOptions` represents the [axe-core Options Parameter](https://www.deque.com/axe/core-documentation/api-documentation/#options-parameter).

## Axe script providers

The `IAxeScriptProvider` interface is suitable for use as an option in an API for running an `axe-core` scan of a page. It specifies a single method, `GetScript()`, which returns a string containing JavaScript code suitable for injecting into a running page.
Expand All @@ -46,11 +58,10 @@ new FileAxeScriptProvider("./path/to/axe.min.js");
axeScriptProvider.GetScript(); // synchronously reads the contents of file ./path/to/axe.min.js
```


## License

This package, including its embedded copy of [axe-core][axe-core], is distributed under the terms of the [Mozilla Public License, version 2.0](../../LICENSE-Deque.AxeCore.Commons.txt).

## Acknowledgements

This package builds on past work from the [SeleniumAxeDotnet](https://github.com/TroyWalshProf/SeleniumAxeDotnet) and [PlaywrightAxeDotnet](https://github.com/IsaacWalker/PlaywrightAxeDotnet) projects (see [NOTICE.txt](../../NOTICE.txt)). We thank all of those projects' contributors for their work.
This package builds on past work from the [SeleniumAxeDotnet](https://github.com/TroyWalshProf/SeleniumAxeDotnet) and [PlaywrightAxeDotnet](https://github.com/IsaacWalker/PlaywrightAxeDotnet) projects (see [NOTICE.txt](../../NOTICE.txt)). We thank all of those projects' contributors for their work.
3 changes: 3 additions & 0 deletions packages/commons/src/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Deque.AxeCore.Commons.Test")]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Newtonsoft.Json.Linq;
using System;

namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
public class AxeResult
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
public class AxeResultCheck
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
public class AxeResultItem
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
public class AxeResultNode
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
public class AxeResultRelatedNode
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Text;

namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
/// <summary>
/// With AxeResultTarget, we will have either a <see cref="Selector"/> or <see cref="Selectors"/> for each target.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;

namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
class AxeResultTargetConverter : JsonConverter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
/// <summary>
/// Has the list of selectors that have to be included or excluded from scanning. If not specified the whole document will be scanned
/// </summary>
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
internal class AxeRunContext
public class AxeRunContext
{
[JsonProperty("include")]
public List<string[]> Include { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
/// <summary>
/// Used as part of <see cref="AxeRunOptions" to configure rules/tags to be executed/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Deque.AxeCore.Selenium
namespace Deque.AxeCore.Commons
{
public class AxeTestEnvironment
{
Expand Down
8 changes: 6 additions & 2 deletions packages/commons/src/Deque.AxeCore.Commons.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
</PropertyGroup>

<ItemGroup>
<None Include="../../../LICENSE-Deque.AxeCore.Commons.txt" Pack="true" PackagePath="LICENSE.txt"/>
<None Include="../../../NOTICE.txt" Pack="true" PackagePath="NOTICE.txt"/>
<None Include="../../../LICENSE-Deque.AxeCore.Commons.txt" Pack="true" PackagePath="LICENSE.txt" />
<None Include="../../../NOTICE.txt" Pack="true" PackagePath="NOTICE.txt" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NewtonSoft.Json" Version="13.0.1" />
</ItemGroup>

<!-- Running this using BeforeTagets="Restore" doesn't work if we run "dotnet restore" from solution folder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.IO;
using System.Linq;

namespace Deque.AxeCore.Selenium.Test
namespace Deque.AxeCore.Commons.Test
{
[TestFixture]
public class AxeResultTargetConverterTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using NUnit.Framework;
using System.Collections.Generic;

namespace Deque.AxeCore.Selenium.Test
namespace Deque.AxeCore.Commons.Test
{
[TestFixture]
public class AxeRunContextTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using NUnit.Framework;
using System.Collections.Generic;

namespace Deque.AxeCore.Selenium.Test
namespace Deque.AxeCore.Commons.Test
{
[TestFixture]
public class AxeRunOptionsTest
Expand Down
2 changes: 2 additions & 0 deletions packages/commons/test/Deque.AxeCore.Commons.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="NewtonSoft.Json" Version="13.0.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
Expand Down
1 change: 1 addition & 0 deletions packages/selenium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PM> Install-Package Deque.AxeCore.Selenium
Import this namespace:

```csharp
using Deque.AxeCore.Commons;
using Deque.AxeCore.Selenium;
```

Expand Down
1 change: 1 addition & 0 deletions packages/selenium/src/WebDriverExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OpenQA.Selenium;
using System;
using Deque.AxeCore.Commons;

namespace Deque.AxeCore.Selenium
{
Expand Down
1 change: 1 addition & 0 deletions packages/selenium/test/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using WebDriverManager;
using WebDriverManager.DriverConfigs;
using WebDriverManager.DriverConfigs.Impl;
using Deque.AxeCore.Commons;

// Setup parallelization
[assembly: Parallelizable(ParallelScope.All)]
Expand Down