Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-6646 Fix flaky works tests #4672

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions features/step_definitions/web_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ def with_scope(locator)
current_url.should include(url)
end

Then "the url should not include {string}" do |url|
expect(current_url).not_to include(url)
end

Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
query = URI.parse(current_url).query
actual_params = query ? CGI.parse(query) : {}
Expand Down
3 changes: 3 additions & 0 deletions features/step_definitions/work_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,9 @@

When "the cache for the work {string} is cleared" do |title|
work = Work.find_by(title: title)

# Delay to force the updated_at that gets set by .touch to be new
step "it is currently 1 second from now"
# Touch the work to actually expire the cache
work.touch
end
Expand Down
7 changes: 6 additions & 1 deletion features/works/work_browse.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ Scenario: If works in a listing exceed the maximum search result count,
And 2 items are displayed per page
And I am logged in
And I post the work "Whatever 1" with fandom "Aggressive Retsuko"
# Ensure stable work order
And it is currently 1 second from now
And I post the work "Whatever 2" with fandom "Aggressive Retsuko"
And it is currently 1 second from now
And I post the work "Whatever 3" with fandom "Aggressive Retsuko"
And it is currently 1 second from now
And I post the work "Whatever 4" with fandom "Aggressive Retsuko"

When I browse the "Aggressive Retsuko" works with page parameter "2"
Then I should see "3 - 4 of 4 Works"
And I should not see "Please use the filters"

When I post the work "Whatever 5" with fandom "Aggressive Retsuko"
When it is currently 1 second from now
And I post the work "Whatever 5" with fandom "Aggressive Retsuko"
And I browse the "Aggressive Retsuko" works
Then I should see "1 - 2 of 5 Works"
And I should not see "Please use the filters"
Expand Down
2 changes: 2 additions & 0 deletions features/works/work_edit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Feature: Edit Works
And I follow "Edit"
And I select "testy" from "work_author_attributes_ids"
And I unselect "testuser" from "work_author_attributes_ids"
# Expire byline cache
And it is currently 1 second from now
And I press "Post"
Then I should see "testy"
And I should not see "testuser,"
Expand Down
1 change: 1 addition & 0 deletions features/works/work_edit_multiple.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Feature: Edit Multiple Works
And I should see "Edit Multiple Works"
When I select "Glorious" for editing
And I select "Excellent" for editing
And it is currently 1 second from now
And I press "Delete"
Then I should see "Are you sure you want to delete these works PERMANENTLY?"
And I should see "Glorious"
Expand Down
4 changes: 3 additions & 1 deletion features/works/work_share.feature
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ Feature: Share Works
And I fill in "User name or email:" with "maduser"
And I fill in "Password:" with "password"
And I press "Log In"
Then I should be on the "Blabla" work page
Then the url should not include "share"
# Shown when the share url is accessed directly
And I should not see "Sorry, you need to have JavaScript enabled for this."
Loading