-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: IPM Launch homepage updates (#1065)
* Add IPM static section to homepage * Add Products to navbar * Update spec expectations for static content * DM-5254: Add Products to homepage search dropdown (#1066) * Add Products to homepage dropdown init state * Dynamically filter products * Truncate results to 2 per type and update spec expectations * Move Product above Tags * Update type assignment for ahoy events * Update more test expectations * Fix up spec expectations * Update data properties for product --------- Co-authored-by: Camille Villa <[email protected]> * Fix code scanning alert no. 344: DOM text reinterpreted as HTML Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Conditionally render Intrapreneur section --------- Co-authored-by: Camille Villa <[email protected]> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
- Loading branch information
1 parent
3caadc3
commit a1762bb
Showing
10 changed files
with
175 additions
and
43 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 |
---|---|---|
|
@@ -15,6 +15,11 @@ | |
@practice_2 = create(:practice, name: 'The Second Best Practice Ever!', initiating_facility_type: 'facility', tagline: 'Test tagline', date_initiated: 'Sun, 06 Feb 1992 00:00:00 UTC +00:00', created_at: 'Sun, 06 Feb 1992 00:00:00 UTC +00:00', summary: 'This is the best practice ever.', overview_problem: 'overview-problem', is_public: true, published: true, approved: true, user: @user) | ||
@practice_3 = create(:practice, name: 'The Third Best Practice Ever!', initiating_facility_type: 'facility', tagline: 'Test tagline', date_initiated: 'Sun, 07 Feb 1992 00:00:00 UTC +00:00', created_at: 'Sun, 07 Feb 1992 00:00:00 UTC +00:00', summary: 'This is the best practice ever.', overview_problem: 'overview-problem', is_public: true, published: true, approved: true, user: @user) | ||
@va_only_practice = create(:practice, name: 'Recent VA-only practice!', initiating_facility_type: 'facility', tagline: 'Test tagline', date_initiated: 'Sun, 08 Feb 1992 00:00:00 UTC +00:00', created_at: 'Sun, 07 Feb 1992 00:00:00 UTC +00:00', summary: 'This is the best practice ever.', overview_problem: 'overview-problem', is_public: false, published: true, approved: true, user: @user) | ||
@product_1 = create(:product, published: true) | ||
@product_2 = create(:product , published: true) | ||
@product_3 = create(:product, published: true) | ||
@ipm = create(:page_group, name: "Intrapreneurial Product Marketplace") | ||
@ipm_homepage = create(:page, page_group: @ipm, slug: "home", title: "Intrapreneurial Product Marketplace" ) | ||
|
||
create(:practice_origin_facility, practice: @practice, facility_type: 0, va_facility_id: 1) | ||
|
||
|
@@ -37,8 +42,20 @@ | |
visit '/' | ||
end | ||
|
||
it 'links to the Shark Tank page' do | ||
expect(page).to have_link(href: '/competitions/shark-tank') | ||
describe 'static content sections' do | ||
it 'invites users to submit innovations' do | ||
within('#main-content') do | ||
expect(page).to have_content('Submit Innovations') | ||
expect(page).to have_link('Nominate', href: nominate_an_innovation_path) | ||
end | ||
end | ||
|
||
it 'features Intrapreneurial Products' do | ||
within('#main-content') do | ||
expect(page).to have_content('Intrapreneurial Products') | ||
expect(page).to have_link('Learn More', href: '/intrapreneurial-product-marketplace') | ||
end | ||
end | ||
end | ||
|
||
describe 'search section' do | ||
|
@@ -54,13 +71,6 @@ | |
end | ||
end | ||
|
||
it 'invites users to submit innovations' do | ||
within('#main-content') do | ||
expect(page).to have_content('Submit Innovations') | ||
expect(page).to have_link('Nominate', href: nominate_an_innovation_path) | ||
end | ||
end | ||
|
||
it 'allows the user to subscribe to the DM newsletter by taking them to the GovDelivery site' do | ||
fill_in('Your email address', with: '[email protected]') | ||
|
||
|
@@ -88,7 +98,6 @@ | |
|
||
it 'lists most recently created innovations' do | ||
within '#practice-list' do | ||
expect(page).to have_content('The Best Practice Ever!') | ||
expect(page).to have_content('The Second Best Practice Ever!') | ||
expect(page).to have_content('The Third Best Practice Ever!') | ||
|
||
|
@@ -103,14 +112,13 @@ | |
find('#dm-homepage-search-field').click | ||
|
||
expect(page).to have_content('Recent VA-only practice!') | ||
expect(page).to have_content('The Second Best Practice Ever!') | ||
expect(page).to have_content('The Third Best Practice Ever!') | ||
end | ||
|
||
it 'lists popular categories' do | ||
within '#category-list' do | ||
expect(page).to have_content('COVID') | ||
expect(page).to have_content('Telehealth') | ||
expect(page).to have_content('Nutrition & Food') | ||
end | ||
end | ||
|
||
|
@@ -150,10 +158,22 @@ | |
expect(page).to have_content("1 Result:") | ||
expect(page).to have_content(@practice_3.name) | ||
end | ||
|
||
it 'temporarily links to IPM pagebuilder page' do | ||
within '#search-dropdown' do | ||
expect(page).to have_link('Browse all Products', href: '/intrapreneurial-product-marketplace') | ||
end | ||
end | ||
|
||
it 'lists most recently created products' do | ||
expect(page).to have_content(@product_3.name) | ||
expect(page).to have_content(@product_2.name) | ||
expect(page).not_to have_content(@product_1.name) | ||
end | ||
end | ||
|
||
it 'lets a user navigate results with arrow keys' do | ||
page.send_keys :down, :down, :down, :down, :down # navigate to first category | ||
7.times { page.send_keys :down} # navigate to first category | ||
page.send_keys :enter # select category | ||
expect(page).to have_current_path('/search?category=COVID') | ||
expect(page).to have_content("2 Results: TAG: COVID") | ||
|
@@ -166,10 +186,10 @@ | |
end | ||
|
||
it 'tracks clicks on practice links' do | ||
event = wait_for_ahoy_js('The Best Practice Ever!') | ||
event = wait_for_ahoy_js(@practice_2.name) | ||
|
||
expect(event.name).to eq("Dropdown Practice Link Clicked") | ||
expect(event.properties["practice_name"]).to eq("The Best Practice Ever!") | ||
expect(event.properties["practice_name"]).to eq(@practice_2.name) | ||
expect(event.properties["from_homepage"]).to be_truthy | ||
end | ||
|
||
|
@@ -209,6 +229,21 @@ | |
expect(event.name).to eq("Dropdown Browse-all Link Clicked") | ||
expect(event.properties["type"]).to eq("community") | ||
end | ||
|
||
it 'tracks clicks on product links' do | ||
event = wait_for_ahoy_js(@product_2.name) | ||
|
||
expect(event.name).to eq("Dropdown Product Link Clicked") | ||
expect(event.properties["product_name"]).to eq(@product_2.name) | ||
expect(event.properties["from_homepage"]).to be_truthy | ||
end | ||
|
||
it 'tracks clicks on "Browse All Products Link' do | ||
event = wait_for_ahoy_js('Browse all Products') | ||
|
||
expect(event.name).to eq("Dropdown Browse-all Link Clicked") | ||
expect(event.properties["type"]).to eq("product") | ||
end | ||
end | ||
|
||
def wait_for_ahoy_js(link_text) | ||
|
Oops, something went wrong.