Skip to content

Commit

Permalink
Merge pull request #22 from Lombiq/issue/OSOE-818
Browse files Browse the repository at this point in the history
OSOE-818: Upgrade to Orchard Core 2.0
  • Loading branch information
sarahelsaig authored Sep 25, 2024
2 parents 621fa19 + 34b431e commit f3a88d9
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Lombiq.Tests.UI.Services;
using OpenQA.Selenium;
using Shouldly;
using System;
using System.Threading.Tasks;

namespace Lombiq.Walkthroughs.Tests.UI.Extensions;
Expand Down Expand Up @@ -48,6 +47,13 @@ void AssertStep(string header, string text, bool assertShepherdTargetIsNotBody =

Task ClickShepherdTargetAsync() => context.ClickReliablyOnUntilUrlChangeAsync(_byShepherdTarget);

Task ClickShepherdTargetWithScriptAsync() =>
context.RetryIfNotStaleOrFailAsync(() =>
{
context.ExecuteScript($"document.querySelector('.{_shepherdTargetClass}').click()");
return Task.FromResult(context.Exists(_byShepherdTarget.Safely()));
});

Task FillInShepherdTargetWithRetriesAsync(string text) => context.FillInWithRetriesAsync(_byShepherdTarget, text);

// Just a selector on .shepherd-button-primary is not enough to find the button for some reason.
Expand Down Expand Up @@ -292,7 +298,8 @@ await AssertStepAndClickNextAsync(
await ClickOnNextButtonAsync();
await AssertStepAndClickNextAsync("Taxonomies", "And you can set a permalink for it");
await AssertStepAndClickShepherdTargetAsync("Taxonomies", "Let's publish the new category! ");
await AssertStepAndClickShepherdTargetAsync("Taxonomies", "Your category is now published.");
AssertStep("Taxonomies", "Your category is now published.");
await ClickShepherdTargetWithScriptAsync();
});

// Media management
Expand Down Expand Up @@ -364,12 +371,8 @@ await AssertStepAndClickNextAsync(
await AssertStepAndFillInShepherdTargetAndClickNextAsync("Layout widgets", "Give it a title.", "Sample paragraph widget");
await AssertStepAndClickNextAsync("Layout widgets", "Give it some content.");
await AssertStepAndClickShepherdTargetAsync("Layout widgets", "We are ready, let's publish it!");
// In Orchard Core 1.8 this link doesn't open a new tab anymore so these three lines will need to be switched to
// just AssertStepAndClickShepherdTargetAsync() after an Orchard upgrade.
AssertStep(
await AssertStepAndClickShepherdTargetAsync(
"Layout widgets", "Your paragraph widget is now published.", assertShepherdTargetIsNotBody: false);
await context.ClickReliablyOnAsync(_byShepherdTarget);
SwitchToLastWindowAndSetDefaultBrowserSize();
await AssertStepAndClickNextAsync(
"Layout widgets", "You should see your paragraph", assertShepherdTargetIsNotBody: false);
});
Expand Down Expand Up @@ -400,7 +403,8 @@ await AssertStepAndFillInShepherdTargetAndClickNextAsync(
await AssertStepAndClickNextAsync("Content type editor", "You can select the editor type here.");
await AssertStepAndClickNextAsync("Content type editor", "You can also select the display mode here.");
await AssertStepAndClickShepherdTargetAsync("Content type editor", "Okay, now save it.");
await AssertStepAndClickShepherdTargetAsync("Content type editor", "The text field is now saved. You will also");
AssertStep("Content type editor", "The text field is now saved. You will also");
await ClickShepherdTargetWithScriptAsync();
await AssertStepAndClickNextAsync(
"Content type editor", "Congratulations, you just tinkered", assertShepherdTargetIsNotBody: false);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
<PackageReference Include="Lombiq.Tests.UI" Version="10.0.1" />
<PackageReference Include="Lombiq.Tests.UI" Version="11.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit f3a88d9

Please sign in to comment.