-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Lombiq/issue/LMBQ-253
LMBQ-253: Reimplement Orchard-Login-as-Anybody submodule
- Loading branch information
Showing
33 changed files
with
444 additions
and
463 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
* -crlf | ||
* text=auto | ||
|
||
# Enforce Windows newlines for C# files to avoid false positives with IDE0055 warning. | ||
# See https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/issues/106 for more information. | ||
*.cs text eol=crlf | ||
|
||
# Keep LF line endings in pnpm-lock.yaml files to prevent Git from reporting this file as changed after pnpm touches it. | ||
pnpm-lock.yaml text eol=lf |
48 changes: 24 additions & 24 deletions
48
.github/workflows/create-jira-issues-for-community-activities.yml
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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
name: Create Jira issues for community activities | ||
|
||
on: | ||
discussion: | ||
types: [created] | ||
issues: | ||
types: [opened] | ||
pull_request_target: | ||
types: [opened] | ||
|
||
jobs: | ||
create-jira-issues-for-community-activities: | ||
name: Create Jira issues for community activities | ||
uses: Lombiq/GitHub-Actions/.github/workflows/create-jira-issues-for-community-activities.yml@dev | ||
secrets: | ||
JIRA_BASE_URL: ${{ secrets.DEFAULT_JIRA_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.DEFAULT_JIRA_USER_EMAIL }} | ||
JIRA_API_TOKEN: ${{ secrets.DEFAULT_JIRA_API_TOKEN }} | ||
JIRA_PROJECT_KEY: ${{ secrets.DEFAULT_JIRA_PROJECT_KEY }} | ||
DISCUSSION_JIRA_ISSUE_DESCRIPTION: ${{ secrets.DEFAULT_DISCUSSION_JIRA_ISSUE_DESCRIPTION }} | ||
ISSUE_JIRA_ISSUE_DESCRIPTION: ${{ secrets.DEFAULT_ISSUE_JIRA_ISSUE_DESCRIPTION }} | ||
PULL_REQUEST_JIRA_ISSUE_DESCRIPTION: ${{ secrets.DEFAULT_PULL_REQUEST_JIRA_ISSUE_DESCRIPTION }} | ||
with: | ||
issue-component: Lombiq.LoginAsAnybody | ||
name: Create Jira issues for community activities | ||
|
||
on: | ||
discussion: | ||
types: [created] | ||
issues: | ||
types: [opened] | ||
pull_request_target: | ||
types: [opened] | ||
|
||
jobs: | ||
create-jira-issues-for-community-activities: | ||
name: Create Jira issues for community activities | ||
uses: Lombiq/GitHub-Actions/.github/workflows/create-jira-issues-for-community-activities.yml@dev | ||
secrets: | ||
JIRA_BASE_URL: ${{ secrets.DEFAULT_JIRA_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.DEFAULT_JIRA_USER_EMAIL }} | ||
JIRA_API_TOKEN: ${{ secrets.DEFAULT_JIRA_API_TOKEN }} | ||
JIRA_PROJECT_KEY: ${{ secrets.DEFAULT_JIRA_PROJECT_KEY }} | ||
DISCUSSION_JIRA_ISSUE_DESCRIPTION: ${{ secrets.DEFAULT_DISCUSSION_JIRA_ISSUE_DESCRIPTION }} | ||
ISSUE_JIRA_ISSUE_DESCRIPTION: ${{ secrets.DEFAULT_ISSUE_JIRA_ISSUE_DESCRIPTION }} | ||
PULL_REQUEST_JIRA_ISSUE_DESCRIPTION: ${{ secrets.DEFAULT_PULL_REQUEST_JIRA_ISSUE_DESCRIPTION }} | ||
with: | ||
issue-component: Lombiq.LoginAsAnybody |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
name: Publish to NuGet | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
publish-nuget: | ||
name: Publish to NuGet | ||
uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@dev | ||
secrets: | ||
API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }} | ||
name: Publish to NuGet | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
publish-nuget: | ||
name: Publish to NuGet | ||
uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@dev | ||
secrets: | ||
API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }} |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name: Validate Pull Request | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
validate-pull-request: | ||
name: Validate Pull Request | ||
uses: Lombiq/GitHub-Actions/.github/workflows/validate-submodule-pull-request.yml@dev | ||
name: Validate Pull Request | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
validate-pull-request: | ||
name: Validate Pull Request | ||
uses: Lombiq/GitHub-Actions/.github/workflows/validate-submodule-pull-request.yml@dev |
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
.vs/ | ||
.idea/ | ||
.vscode/ | ||
obj/ | ||
bin/ | ||
artifacts/ | ||
wwwroot/ | ||
node_modules/ | ||
*.user | ||
.pnpm-debug.log | ||
|
||
# Mac | ||
.DS_Store |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
Copyright © 2015, [Lombiq Technologies Ltd.](https://lombiq.com) | ||
|
||
All rights reserved. | ||
|
||
For more information and requests about licensing please [contact us through our website](https://lombiq.com/contact-us). | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
Copyright © 2015, [Lombiq Technologies Ltd.](https://lombiq.com) | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
17 changes: 17 additions & 0 deletions
17
Lombiq.LoginAsAnybody.Tests.UI/Extensions/Configurations.cs
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,17 @@ | ||
using Lombiq.Tests.UI.Services; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Lombiq.LoginAsAnybody.Tests.UI.Extensions; | ||
|
||
public static class Configurations | ||
{ | ||
// We are checking a page with Unauthorized status code, so we need to make an exception here. | ||
public static readonly Action<OrchardCoreUITestExecutorConfiguration> IgnoreUnauthorizedBrowserLogEntries = | ||
configuration => | ||
configuration.AssertBrowserLog = | ||
logEntries => | ||
OrchardCoreUITestExecutorConfiguration.AssertBrowserLogIsEmpty( | ||
logEntries.Where(logEntry => | ||
!logEntry.Message.ContainsOrdinalIgnoreCase("the server responded with a status of 401"))); | ||
} |
41 changes: 41 additions & 0 deletions
41
Lombiq.LoginAsAnybody.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs
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,41 @@ | ||
using Lombiq.Tests.UI.Extensions; | ||
using Lombiq.Tests.UI.Models; | ||
using Lombiq.Tests.UI.Services; | ||
using OpenQA.Selenium; | ||
using Shouldly; | ||
using System.Threading.Tasks; | ||
|
||
namespace Lombiq.LoginAsAnybody.Tests.UI.Extensions; | ||
|
||
public static class TestCaseUITestContextExtensions | ||
{ | ||
public static async Task TestLoginAsAnybodyAsync(this UITestContext context) | ||
{ | ||
await context.SignInDirectlyAndGoToDashboardAsync(); | ||
|
||
var userParameters = UserRegistrationParameters.CreateDefault(); | ||
await context.CreateUserAsync(userParameters.UserName, userParameters.Password, userParameters.Email); | ||
|
||
await context.GoToUsersAsync(); | ||
await context.ClickReliablyOnAsync(By.XPath("//a[contains(.,'Log in as user')]")); | ||
|
||
(await context.GetCurrentUserNameAsync()).ShouldBe(userParameters.UserName); | ||
} | ||
|
||
public static async Task TestLoginAsAnybodyAuthorizationAsync(this UITestContext context) | ||
{ | ||
var userParameters = UserRegistrationParameters.CreateDefault(); | ||
await context.CreateUserAsync(userParameters.UserName, userParameters.Password, userParameters.Email); | ||
|
||
// The role needs this permission to visit the users page. | ||
await context.AddPermissionToRoleAsync("ManageUsers", "Moderator"); | ||
await context.AddUserToRoleAsync(userParameters.UserName, "Moderator"); | ||
|
||
await context.SignInDirectlyAndGoToDashboardAsync(userParameters.UserName); | ||
await context.GoToUsersAsync(); | ||
|
||
context.Missing(By.XPath("//a[contains(.,'Log in as user')]")); | ||
await context.GoToAdminRelativeUrlAsync("/Users/SwitchUser/userId"); | ||
context.Exists(By.XPath("//h1[contains(text(),'You are not authorized to view this content.')]")); | ||
} | ||
} |
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,13 @@ | ||
Copyright © 2023, [Lombiq Technologies Ltd.](https://lombiq.com) | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 changes: 33 additions & 0 deletions
33
Lombiq.LoginAsAnybody.Tests.UI/Lombiq.LoginAsAnybody.Tests.UI.csproj
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,33 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<Title>Lombiq Login as Anybody for Orchard Core - UI Test Extensions</Title> | ||
<Authors>Lombiq Technologies</Authors> | ||
<Copyright>Copyright © 2023, Lombiq Technologies Ltd.</Copyright> | ||
<Description>Lombiq Login as Anybody for Orchard Core - UI Test Extensions: Extensions to aid in UI testing Lombiq Login as Anybody for Orchard Core.</Description> | ||
<PackageIcon>NuGetIcon.png</PackageIcon> | ||
<PackageTags>OrchardCore;Lombiq;AspNetCore</PackageTags> | ||
<RepositoryUrl>https://github.com/Lombiq/Orchard-Login-as-Anybody</RepositoryUrl> | ||
<PackageProjectUrl>https://github.com/Lombiq/Orchard-Login-as-Anybody/tree/dev/Lombiq.LoginAsAnybody.Tests.UI</PackageProjectUrl> | ||
<PackageLicenseFile>License.md</PackageLicenseFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(NuGetBuild)' != 'true'"> | ||
<ProjectReference Include="..\..\..\..\test\Lombiq.UITestingToolbox\Lombiq.Tests.UI\Lombiq.Tests.UI.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(NuGetBuild)' == 'true'"> | ||
<PackageReference Include="Lombiq.Tests.UI" Version="8.1.0-alpha.1.osoe-638" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="License.md" Pack="true" PackagePath="" /> | ||
<None Include="NuGetIcon.png" Pack="true" PackagePath="" /> | ||
<None Include="Readme.md" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,7 @@ | ||
# Lombiq Login as Anybody for Orchard Core - UI Test Extensions | ||
|
||
## About | ||
|
||
Extension methods that test various features in Lombiq Login as Anybody for Orchard Core, with the help of [Lombiq UI Testing Toolbox for Orchard Core](https://github.com/Lombiq/UI-Testing-Toolbox). | ||
|
||
Call these from a UI test project to verify the module's basic features; as seen in [Open-Source Orchard Core Extensions](https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions). |
Oops, something went wrong.