Skip to content

Commit

Permalink
Fix intermittendly failing file browser test
Browse files Browse the repository at this point in the history
The change 47c72c2 tried to address the
intermittendly failing test, but I think made the mistake of
"hardcoding" the file we assume to be removing from the attachment list.

The problem however is, that the list of files we're adding as
attachment varies with the environment. While the `screenshot.png` is
probably the attachment in most cases, it isn't the attachment
in **all** cases. The assertion that the next screen does not show a
file which we never added is always true.

Instead, firstly, this patch asserts that the last filename is actually
listed as an attachment. Secondly, we assert that when the attachment is
removed the last file from before is gone. Furthermore we also check
whether the item count has changed.

Fixes: #327
  • Loading branch information
romanofski committed Aug 2, 2020
1 parent 0320c70 commit 759e4ee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/TestUserAcceptance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1151,10 +1151,12 @@ testAddAttachments = purebredTmuxSession "use file browser to add attachments" $

-- try removing attachments
step "select the attachment"
sendKeys "Down" (Substring "Item 2 of 2")
sendKeys "Down" (Substring "Item 2 of 2") >>= put
assertRegexS (buildAnsiRegex [] ["43"] [] <> "\\sA\\s" <> lastFile)

step "remove the attachment"
sendKeys "D" (Not (Substring "screenshot.png"))
sendKeys "D" (Not (Substring lastFile)) >>= put
assertSubstringS "Item 1 of 1"

step "try to remove the last attachment"
sendKeys "D" (Substring "You may not remove the only attachment")
Expand Down

0 comments on commit 759e4ee

Please sign in to comment.