Skip to content

Commit

Permalink
switch CI back to ubuntu-latest & stop using Task.Delay to wait on st…
Browse files Browse the repository at this point in the history
…ate/component changes in tests
  • Loading branch information
DavidVollmers committed Sep 27, 2023
1 parent 0fc3b21 commit 5fda6e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:

jobs:
Test:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
Expand Down
6 changes: 2 additions & 4 deletions tests/Ignis.Tests.Components.HeadlessUI/DialogTests.razor
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,12 @@
var openButton = cut.Find($"#{openButtonId}");
openButton.Click();

await Task.Delay(400);

var closeButton = cut.Find($"#{closeButtonId}");
var closeButton = cut.WaitForElement($"#{closeButtonId}");
Assert.True(outlet.Contains(closeButton));

closeButton.Click();

await Task.Delay(300);
await Task.Delay(400);

outlet = cut.Find($"#{outletId}");
Assert.Empty(outlet.Children);
Expand Down
17 changes: 8 additions & 9 deletions tests/Ignis.Tests.Components.HeadlessUI/ListboxTests.razor
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,26 @@
Services.AddSingleton<IHostContext, TestHostContext>();

JSInterop.Mode = JSRuntimeMode.Loose;

const string openButtonId = "open-button";
const string listboxButtonId = "listbox-button";
const string intOptionId = nameof(Int32);

var cut = Render(@<ListboxInDialogTest></ListboxInDialogTest>);

var openButton = cut.Find($"#{openButtonId}");
openButton.Click();

await Task.Delay(400);

var listboxButton = cut.Find($"#{listboxButtonId}");
var listboxButton = cut.WaitForElement($"#{listboxButtonId}");
listboxButton.Click();

var intOption = cut.Find($"#{intOptionId}");
intOption.Click();

await Task.Delay(200);

var listbox = cut.FindComponent<Listbox<Type>>();
Assert.Equal(typeof(int), listbox.Instance.Value);
cut.WaitForAssertion(() =>
{
var listbox = cut.FindComponent<Listbox<Type>>();
Assert.Equal(typeof(int), listbox.Instance.Value);
});
}
}

0 comments on commit 5fda6e3

Please sign in to comment.