Fix ahoy's tracking spec [skip ci] (#20825)
This commit is contained in:
parent
a0b68a6956
commit
8c71491d6f
1 changed files with 5 additions and 10 deletions
|
|
@ -2,14 +2,9 @@ require "rails_helper"
|
|||
|
||||
RSpec.describe "Tracking 'Clicked on Create Account'", :js do
|
||||
context "when on the homepage" do
|
||||
let(:user) { create(:user) }
|
||||
# rubocop:disable RSpec/LetSetup
|
||||
# this is to ensure that we see "ca_feed_home_page" which appears
|
||||
# in a card after the fifth article
|
||||
let!(:articles) { create_list(:article, 6, user: user) }
|
||||
# rubocop:enable RSpec/LetSetup
|
||||
|
||||
before do
|
||||
user = create(:user)
|
||||
create_list(:article, 6, user: user)
|
||||
visit root_path
|
||||
end
|
||||
|
||||
|
|
@ -21,6 +16,7 @@ RSpec.describe "Tracking 'Clicked on Create Account'", :js do
|
|||
it "has the create account tracking element in the hamburger", :aggregate_failures do
|
||||
Capybara.current_session.driver.resize(425, 694)
|
||||
first(".js-hamburger-trigger").click
|
||||
# expect /message route to receive a request
|
||||
expect(page).to have_css('a[data-tracking-id="ca_hamburger_home_page"]')
|
||||
end
|
||||
|
||||
|
|
@ -37,10 +33,9 @@ RSpec.describe "Tracking 'Clicked on Create Account'", :js do
|
|||
it "adds an ahoy event", :aggregate_failures do
|
||||
article = create(:article, user: create(:user))
|
||||
visit article.path
|
||||
expect(Ahoy::Event.count).to eq(0)
|
||||
find(".follow-action-button").click
|
||||
expect do
|
||||
find(".js-global-signup-modal__create-account").click
|
||||
end.to change(Ahoy::Event, :count).by(1)
|
||||
find(".js-global-signup-modal__create-account").click
|
||||
|
||||
expect(page).to have_current_path("/enter?state=new-user")
|
||||
expect(Ahoy::Event.last.name).to eq("Clicked on Create Account")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue