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

Stabilise shopping specs and open them for change #5667

Merged
merged 3 commits into from Jul 2, 2020
Merged

Stabilise shopping specs and open them for change #5667

merged 3 commits into from Jul 2, 2020

Conversation

mkllnk
Copy link
Member

@mkllnk mkllnk commented Jun 25, 2020

What? Why?

Preparing for #4598 and maybe solving #4957.

What should we test?

No test, only specs are affected.

Release notes

Preparations for more mobile friendly shop fronts.

Changelog Category: Changed

@mkllnk mkllnk self-assigned this Jun 25, 2020
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 work Maikel 👏 👏
I leave some comments but they are optional.

#
# The auto-submit on these specific form elements (add to cart) now has a small built-in
# waiting period before submitting the data...
sleep 0.6
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be a method in itself as it was in the shopping_spec, that way the multiline comment becomes a method comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I agree. I'll leave it in this case though because the mobile code will remove it again. It won't be needed.

#
# This is temporary code. The duplication will be removed by the mobile
# product listings feature. This has been backported to avoid merge
# conflicts and to make the current build more stable.
Copy link
Contributor

Choose a reason for hiding this comment

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

This type of comment should never land on the codebase. The fact that is temporary doesn't need to be there. I'd remove this comment from the code and add it as a comment on the PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

My reason for the comment was so that if someone sees the code later that they don't start refactoring it. Somebody may come across the code without seeing the commit. I'll leave it for now. It will be removed soon anyway.

accept_alert 'Insufficient stock available, only 5 remaining' do
fill_in "variants[#{variant.id}]", with: '10'
end
click_add_to_cart variant, 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did the behaviour change? Is there not an alert anymore? why?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, well spotted! That's a mistake. In the new mobile UX it won't be possible to click on the button once the stock limit is reached. But this spec change should happen then, not now. I will change it.

The way we add items to the cart will change. Encapsulating that code in
a common place will make the mobile ux work clearer and avoid merge
conflicts.

The waiting for background requests has also been improved and made more
consistent which should make these specs more reliable.
The spec is not supposed to test the navigation to the shop. Going
directly to the shop reduces the test execution time by 7%.
Copy link
Contributor

@Matt-Yorkley Matt-Yorkley left a comment

Choose a reason for hiding this comment

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

Nice!

@sigmundpetersen
Copy link
Contributor

Merge ready 😊

@luisramos0 luisramos0 merged commit d9ab7a8 into openfoodfoundation:master Jul 2, 2020
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

4 participants