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

fix feature specs #910

Merged
merged 2 commits into from
Apr 8, 2024
Merged

Conversation

jparr
Copy link
Collaborator

@jparr jparr commented Apr 5, 2024

This change to database cleaner config fixed a failing testing in features/action_pages/call_action_spec for me.

We should consider removing it as DatabaseCleaner is not usually necessary in new rails versions.

@jparr jparr requested a review from esoterik April 5, 2024 15:25
@jparr jparr changed the title fix call action spec fix feature specs Apr 5, 2024
@@ -31,6 +31,7 @@
Capybara.server = :puma
Capybara.javascript_driver = :selenium_chrome_headless
Capybara.enable_aria_label = true
Capybara.disable_animation = true
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should make the weird timing problems in admin/action_creation_spec go away. I didnt remove everything in there but it should remove the need for sleeps.

end

def next_section
click_on "Next"
sleep 0.05
end

def skip_banner_selection
expect(page).to have_selector("#images", visible: true, wait: 5)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing an expect like this is a better way to make sure a page is settled before calling actions that will error if an element isnt visible. Even though I'm waiting for potentially 5 seconds it will automatically continue as soon as it resolves true. You also know that the element isnt available which is a more useful error than what shows if it cant fill in an input.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, that's a great pattern!!

end

def next_section
click_on "Next"
sleep 0.05
end

def skip_banner_selection
expect(page).to have_selector("#images", visible: true, wait: 5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, that's a great pattern!!

@esoterik esoterik merged commit b739c67 into 2024-upgrades-main Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants