Skip to content

Commit 1b513ca

Browse files
committed
fix(e2e): Fix flaky EditArticle test by waiting for Update button visibility
The test was failing intermittently because it checked button enabled state before the article data finished loading. In some cases, the form still showed "Publish Article" (new mode) instead of "Update Article" (edit mode). Fix: Wait for "Update Article" button to be VISIBLE before modifying the title. This confirms the slug is loaded and we're in edit mode. Then wait for ENABLED state after form modifications. Fixes timeout in EditArticle_AuthorCanModify E2E test.
1 parent cfbd2d5 commit 1b513ca

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Abies.Conduit.E2E/ArticleTests.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,17 @@ public async Task EditArticle_AuthorCanModify()
8585
// Wait for the title input to have the original title (meaning article data loaded)
8686
await Expect(titleInput).ToHaveValueAsync(originalTitle, new() { Timeout = 10000 });
8787

88+
// Wait for the button to show "Update Article" (not "Publish Article")
89+
// This confirms the slug is loaded and we're in edit mode
90+
var updateButton = Page.GetByRole(AriaRole.Button, new() { Name = "Update Article" });
91+
await Expect(updateButton).ToBeVisibleAsync(new() { Timeout = 10000 });
92+
8893
// Modify the title
8994
var newTitle = $"Updated Title {Guid.NewGuid():N}";
9095
await titleInput.FillAsync(newTitle);
9196

92-
// When editing (Slug is set), the button says "Update Article"
93-
var updateButton = Page.GetByRole(AriaRole.Button, new() { Name = "Update Article" });
94-
await Expect(updateButton).ToBeVisibleAsync(new() { Timeout = 5000 });
97+
// Wait for the button to be enabled (form validation must pass)
98+
await Expect(updateButton).ToBeEnabledAsync(new() { Timeout = 5000 });
9599
await updateButton.ClickAsync();
96100

97101
// Should redirect back to article page with new title

0 commit comments

Comments
 (0)