From 20b2b3d22d73219c0564f5a31798431463666737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 23 Aug 2024 16:13:33 +0200 Subject: [PATCH] revert --- .../Extensions/TestCaseUITestContextExtensions.cs | 13 ++----------- Lombiq.Walkthroughs/Assets/Scripts/walkthroughs.js | 11 ----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/Lombiq.Walkthroughs.Test.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.Walkthroughs.Test.UI/Extensions/TestCaseUITestContextExtensions.cs index 46affc9..d11d097 100644 --- a/Lombiq.Walkthroughs.Test.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.Walkthroughs.Test.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -47,13 +47,6 @@ 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. @@ -293,8 +286,7 @@ await AssertStepAndClickNextAsync( await ClickOnNextButtonAsync(); await AssertStepAndClickNextAsync("Taxonomies", "And you can set a permalink for it"); await AssertStepAndClickShepherdTargetAsync("Taxonomies", "Let's publish the new category! "); - AssertStep("Taxonomies", "Your category is now published."); - await ClickShepherdTargetWithScriptAsync(); + await AssertStepAndClickShepherdTargetAsync("Taxonomies", "Your category is now published."); }); // Media management @@ -398,8 +390,7 @@ 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."); - AssertStep("Content type editor", "The text field is now saved. You will also"); - await ClickShepherdTargetWithScriptAsync(); + await AssertStepAndClickShepherdTargetAsync("Content type editor", "The text field is now saved. You will also"); await AssertStepAndClickNextAsync( "Content type editor", "Congratulations, you just tinkered", assertShepherdTargetIsNotBody: false); }); diff --git a/Lombiq.Walkthroughs/Assets/Scripts/walkthroughs.js b/Lombiq.Walkthroughs/Assets/Scripts/walkthroughs.js index 1f7568c..5759aad 100644 --- a/Lombiq.Walkthroughs/Assets/Scripts/walkthroughs.js +++ b/Lombiq.Walkthroughs/Assets/Scripts/walkthroughs.js @@ -1,9 +1,5 @@ jQuery(($) => { (function LoadShepherd(Shepherd) { - function delay(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - function getCookieValue(cookieName) { const name = cookieName + '='; const cookieArray = document.cookie.split(';').map((cookie) => cookie.trim()); @@ -1925,13 +1921,6 @@ jQuery(($) => { element: '.widget-editor-btn-toggle.widget-editor-btn-expand', on: 'top', }, - beforeShowPromise: async () => { - // Wait up to 2 seconds for the element to appear. - for (let i = 0; i < 10; i++) { - if (document.querySelector('.widget-editor-btn-toggle.widget-editor-btn-expand')) return; - await delay(200); - } - }, buttons: [ backButton, ],