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

4239 Do one thing at a time in feature spec for product cloning #4522

Conversation

kristinalim
Copy link
Member

@kristinalim kristinalim commented Nov 28, 2019

What? Why?

In the spec, we clone a product, and then update the original product's name to test that the form is still usable after cloning. We don't wait for the table to be re-rendered before attempting to edit the name of the product.

The failure seems to be because the Angular binding is not finished yet when "Save Changes" is clicked.

This PR makes the spec wait for the table to be re-rendered before proceeding to set the product name. This makes the spec pass in 30 runs on my computer. Before the PR, it failed 3 out of 30 runs but with a different failure. (See below.) It's possible that the issue before was that binding is interrupted when the table is re-rendered.

  1)
  As an Administrator
  I want to be able to manage products in bulk
 updating a product after cloning a product
     Failure/Error: expect(page.find("#status-message")).to have_content "Changes saved."
       expected to find text "Changes saved." in "Changes to one product remain unsaved."
     # ./spec/features/admin/bulk_product_update_spec.rb:426:in `block (3 levels) in <top (required)>'

What should we test?

This only affects specs. The build should pass, but no manual tests needed.

Release notes

Make automated feature test for product cloning more reliable.

Changelog Category: Fixed

@kristinalim kristinalim self-assigned this Nov 28, 2019
Copy link
Contributor

@luisramos0 luisramos0 left a comment

Choose a reason for hiding this comment

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

nice one @kristinalim 👍

@sauloperez sauloperez merged commit fb28826 into openfoodfoundation:master Nov 29, 2019
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.

[Flaky Spec] spec/features/admin/bulk_product_update_spec.rb:410
3 participants