-
-
Notifications
You must be signed in to change notification settings - Fork 724
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
[BUU] Activate admin_style_v3 for most system specs #11645
Merged
mkllnk
merged 42 commits into
openfoodfoundation:master
from
filipefurtad0:activate_buu_toggle_by_default_to_run_the_test_suite
Jul 2, 2024
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
500b9ed
Enables admin_style_v3 toggle by default
filipefurtad0 308c559
Fixes case on assertions, on failing specs
filipefurtad0 9aecf9f
Brings the tests back to green, after rebasing
filipefurtad0 5e4381c
Fixes case on failing test
filipefurtad0 1c580c4
Adds assertions on products page, when no products are found
filipefurtad0 b9bb4a4
displays a list of products
filipefurtad0 8a19870
Fixes case on reports_spec.rb
filipefurtad0 5271361
Fixes case on products_spec.rb
filipefurtad0 8897e99
Clicks OC warning modal away so other buttons are reachable
filipefurtad0 4871e00
Deals with overlapping elements
filipefurtad0 50c7392
Deals with overlapping elements
filipefurtad0 7303c40
Introduces helper to deal with overlapping elements
filipefurtad0 c789489
Deals with overlapping elements
filipefurtad0 2937bdc
Deals with overlapping elements
filipefurtad0 e09fa3e
Updates v3 products page
filipefurtad0 3af5330
Updates product category test
filipefurtad0 d88db13
Updates specs to accomodate changes on warnings/banners
filipefurtad0 289414a
Adds tests around product creation
filipefurtad0 5af5eb7
Replaces all with find, within tom_select helper method
filipefurtad0 c4b2748
Adds pending test case on creating variants
filipefurtad0 8b036e5
Removes search block - covered already a few lines below
filipefurtad0 2c37783
Updates selector
filipefurtad0 0fa272a
Changes helper for dropdown selection
filipefurtad0 0a4c2a1
Updates tom_select_helper.rb with the recent changes from master
filipefurtad0 4e24af2
Applies helper changes
filipefurtad0 03a9f68
Fixes rubocop inconsistency
filipefurtad0 bcbc7c7
Fixes rubocop inconsistency
filipefurtad0 5824516
Fixes case
filipefurtad0 9f98dc2
Adds assertions on table header
filipefurtad0 80e8177
Mouse hovering displays the text
filipefurtad0 c226b10
Updates case on orders_spec.rb
filipefurtad0 ba355fd
Removes mouse clicks to display variants
filipefurtad0 8028610
Updates spec to create a variant within BUU design
filipefurtad0 9e25893
Sets variant creation scenarios on_hand/on_demand as shared examples
filipefurtad0 6dfef81
Fixes rebase
filipefurtad0 3a8c44d
fixup: Updates spec to create a variant within BUU design
dacook 39cae44
Fix more uppercase tests after rebase
dacook 5f01bb4
Remove unecessary message
dacook 109432d
fixup: feature toggle old screen
dacook b1721d6
todo: make specs work with admin_style_v3
dacook c80199e
Use normal capitalisation for translation
dacook b1aafbf
Remove old migration spec
dacook File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
spec/migrations/20240625024328_activate_admin_style_v3_for_new_users_spec.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
def dismiss_warning | ||
# Click dismiss on distributor warning | ||
click_button 'Dismiss' | ||
end | ||
|
||
def trigger_click(id, text) | ||
# replace node buy the elements node, for example | ||
page.find(id, text).trigger("click") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# frozen_string_literal: true | ||
|
||
module TomSelectHelper | ||
def tomselect_open(field_name) | ||
page.find("##{field_name}-ts-control").click | ||
end | ||
|
||
def tomselect_multiselect(value, options) | ||
tomselect_wrapper = page.find("[name='#{options[:from]}']").sibling(".ts-wrapper") | ||
tomselect_wrapper.find(".ts-control").click | ||
tomselect_wrapper.find(:css, '.ts-dropdown.multi .ts-dropdown-content .option', | ||
text: value).click | ||
end | ||
|
||
def tomselect_search_and_select(value, options) | ||
tomselect_wrapper = page.find("[name='#{options[:from]}']").sibling(".ts-wrapper") | ||
tomselect_wrapper.find(".ts-control").click | ||
# Use send_keys as setting the value directly doesn't trigger the search | ||
tomselect_wrapper.find(:css, '.ts-dropdown input.dropdown-input').send_keys(value) | ||
tomselect_wrapper.find(:css, '.ts-dropdown .ts-dropdown-content .option', text: value).click | ||
end | ||
|
||
def tomselect_select(value, options) | ||
tomselect_wrapper = page.find("[name='#{options[:from]}']").sibling(".ts-wrapper") | ||
tomselect_wrapper.find(".ts-control").click | ||
|
||
tomselect_wrapper.find(:css, '.ts-dropdown .ts-dropdown-content .option', text: value).click | ||
end | ||
|
||
def select_tom_select(value, from:) | ||
container = find(:id, from) | ||
|
||
within(container) do | ||
find('.ts-control').send_keys(value) | ||
dacook marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
|
||
find('.ts-dropdown .ts-dropdown-content .option', text: /#{Regexp.quote(value)}/i).click | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,14 @@ | |
|
||
RSpec.describe ' | ||
As an Administrator | ||
I want to be able to manage products in bulk | ||
I want to be able to manage products in bulk (with the old Products screen) | ||
' do | ||
include AdminHelper | ||
include AuthenticationHelper | ||
include WebHelper | ||
|
||
before { Flipper.disable(:admin_style_v3) } | ||
|
||
describe "listing products" do | ||
before do | ||
login_as_admin | ||
|
@@ -18,19 +20,12 @@ | |
it "displays a list of products" do | ||
p1 = FactoryBot.create(:product) | ||
p2 = FactoryBot.create(:product) | ||
|
||
visit spree.admin_products_path | ||
|
||
expect(page).to have_field "product_name", with: p1.name | ||
expect(page).to have_field "product_name", with: p2.name | ||
end | ||
|
||
it "displays a message when number of products is zero" do | ||
visit spree.admin_products_path | ||
|
||
expect(page).to have_text "No products yet. Why don't you add some?" | ||
end | ||
|
||
Comment on lines
-28
to
-33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main commit message doesn't reflect the commit content. |
||
it "displays a select box for suppliers, with the appropriate supplier selected" do | ||
s1 = FactoryBot.create(:supplier_enterprise) | ||
s2 = FactoryBot.create(:supplier_enterprise) | ||
|
@@ -202,7 +197,7 @@ | |
visit spree.admin_products_path | ||
|
||
find("a", text: "NEW PRODUCT").click | ||
expect(page).to have_content 'NEW PRODUCT' | ||
expect(page).to have_content "NEW PRODUCT" | ||
|
||
fill_in 'product_name', with: 'Big Bag Of Apples' | ||
select supplier.name, from: 'product_supplier_id' | ||
|
@@ -311,8 +306,10 @@ | |
end | ||
|
||
it "creating a variant with unit value is: '120g' and 'on_demand' checked" do | ||
scroll_to(:bottom) | ||
|
||
within "tr#v_#{v2.id}" do | ||
page.find(".add-variant").trigger("click") | ||
page.find(".add-variant").click | ||
end | ||
|
||
within "tr#v_-1" do | ||
|
@@ -705,7 +702,7 @@ | |
|
||
toggle_columns /^.{0,1}Producer$/i | ||
|
||
expect(page).not_to have_selector "th", text: "PRODUCER" | ||
expect(page).not_to have_selector "th", text: "Producer" | ||
expect(page).to have_selector "th", text: "NAME" | ||
expect(page).to have_selector "th", text: "PRICE" | ||
expect(page).to have_selector "th", text: "ON HAND" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are already some helper for tom select here :
openfoodnetwork/spec/support/request/web_helper.rb
Line 93 in dd502f0
But like the idea of moving them to their own helper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I was unaware of those existing helpers... I'll move them to this file. The build should actually stay green, as we're calling the new file from
base_spec_helper
...