Skip to content

Commit

Permalink
Merge pull request #3470 from kristinalim/fix/3426-intermittent_spec_…
Browse files Browse the repository at this point in the history
…failures

3426 [Flaky Spec] Address timing issues in enterprise users feature specs
  • Loading branch information
sauloperez authored Feb 15, 2019
2 parents d4589cc + af95e38 commit 0a39178
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions spec/features/admin/enterprise_roles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
before do
click_link 'Enterprises'
click_link 'Test Enterprise'
within('.side_menu') { click_link 'Users' }
navigate_to_enterprise_users
expect(page).to have_selector "table.managers"
end

Expand Down Expand Up @@ -131,7 +131,8 @@
it "shows changes to enterprise contact or owner" do
select2_select user2.email, from: 'receives_notifications_dropdown'
within('#save-bar') { click_button 'Update' }
within('.side_menu') { click_link 'Users' }
navigate_to_enterprise_users
expect(page).to have_selector "table.managers"

within 'table.managers' do
within "tr#manager-#{user1.id}" do
Expand All @@ -156,6 +157,9 @@
click_button I18n.t('js.admin.modals.close')
end

expect(page).not_to have_selector "#invite-manager-modal"
expect(page).to have_selector "table.managers"

new_user = Spree::User.find_by_email_and_confirmed_at(new_email, nil)
expect(Enterprise.managed_by(new_user)).to include enterprise

Expand All @@ -170,9 +174,14 @@
end
end


private

def navigate_to_enterprise_users
within ".side_menu" do
click_link "Users"
end
end

def have_relationship(user, enterprise)
have_table_row [user.email, 'manages', enterprise.name, '']
end
Expand Down

0 comments on commit 0a39178

Please sign in to comment.