Commit 77998d3e authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak Committed by Natalia Tepluhina

Enable snowplow for group saml qa test

parent 74c27d7c
- expanded = integration_expanded?('snowplow_') - expanded = integration_expanded?('snowplow_')
%section.settings.as-snowplow.no-animate#js-snowplow-settings{ class: ('expanded' if expanded) } %section.settings.as-snowplow.no-animate#js-snowplow-settings{ class: ('expanded' if expanded), data: { qa_selector: 'snowplow_settings_content' } }
.settings-header .settings-header
%h4 %h4
= _('Snowplow') = _('Snowplow')
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
%fieldset %fieldset
.form-group .form-group
.form-check .form-check
= f.check_box :snowplow_enabled, class: 'form-check-input' = f.check_box :snowplow_enabled, class: 'form-check-input', data: { qa_selector: 'snowplow_enabled_checkbox' }
= f.label :snowplow_enabled, _('Enable Snowplow tracking'), class: 'form-check-label' = f.label :snowplow_enabled, _('Enable Snowplow tracking'), class: 'form-check-label'
.form-group .form-group
= f.label :snowplow_collector_hostname, _('Collector hostname'), class: 'label-light' = f.label :snowplow_collector_hostname, _('Collector hostname'), class: 'label-light'
...@@ -33,4 +33,4 @@ ...@@ -33,4 +33,4 @@
.form-text.text-muted .form-text.text-muted
= _('The Snowplow cookie domain.') = _('The Snowplow cookie domain.')
= f.submit _('Save changes'), class: 'gl-button btn btn-confirm' = f.submit _('Save changes'), class: 'gl-button btn btn-confirm', data: { qa_selector: 'save_changes_button' }
# frozen_string_literal: true
module QA
module Flow
module Settings
module_function
def disable_snowplow
Flow::Login.while_signed_in_as_admin do
QA::Page::Main::Menu.perform(&:go_to_admin_area)
QA::Page::Admin::Menu.perform(&:go_to_general_settings)
QA::Page::Admin::Settings::Component::Snowplow.perform(&:disable_snowplow_tracking)
end
end
def enable_snowplow
Flow::Login.while_signed_in_as_admin do
QA::Page::Main::Menu.perform(&:go_to_admin_area)
QA::Page::Admin::Menu.perform(&:go_to_general_settings)
QA::Page::Admin::Settings::Component::Snowplow.perform(&:enable_snowplow_tracking)
end
end
end
end
end
# frozen_string_literal: true
module QA
module Page
module Admin
module Settings
module Component
class Snowplow < Page::Base
include QA::Page::Settings::Common
view 'app/views/admin/application_settings/_snowplow.html.haml' do
element :snowplow_settings_content
element :snowplow_enabled_checkbox
element :save_changes_button
end
def enable_snowplow_tracking
expand_content(:snowplow_settings_content) do
check_snowplow_enabled_checkbox
click_save_changes_button
end
end
def disable_snowplow_tracking
expand_content(:snowplow_settings_content) do
uncheck_snowplow_enabled_checkbox
click_save_changes_button
end
end
private
def check_snowplow_enabled_checkbox
check_element(:snowplow_enabled_checkbox)
end
def uncheck_snowplow_enabled_checkbox
uncheck_element(:snowplow_enabled_checkbox)
end
def click_save_changes_button
click_element :save_changes_button
end
end
end
end
end
end
end
...@@ -33,56 +33,78 @@ module QA ...@@ -33,56 +33,78 @@ module QA
Flow::Saml.logout_from_idp(saml_idp_service) Flow::Saml.logout_from_idp(saml_idp_service)
end end
it 'creates a new account automatically and allows to leave group and join again', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1845' do shared_examples 'group membership actions' do
# When the user signs in via IDP for the first time it 'creates a new account automatically and allows to leave group and join again', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1845' do
# When the user signs in via IDP for the first time
visit_group_sso_url visit_group_sso_url
EE::Page::Group::SamlSSOSignIn.perform(&:click_sign_in) EE::Page::Group::SamlSSOSignIn.perform(&:click_sign_in)
Flow::Saml.login_to_idp_if_required(idp_user.username, idp_user.password) Flow::Saml.login_to_idp_if_required(idp_user.username, idp_user.password)
expect(page).to have_text("Please confirm your email address") expect(page).to have_text("Please confirm your email address")
QA::Flow::User.confirm_user(user) QA::Flow::User.confirm_user(user)
visit_group_sso_url visit_group_sso_url
EE::Page::Group::SamlSSOSignIn.perform(&:click_sign_in) EE::Page::Group::SamlSSOSignIn.perform(&:click_sign_in)
expect(page).to have_text("Signed in with SAML") expect(page).to have_text("Signed in with SAML")
Page::Group::Show.perform(&:leave_group) Page::Group::Show.perform(&:leave_group)
expect(page).to have_text("You left") expect(page).to have_text("You left")
Page::Main::Menu.perform(&:sign_out) Page::Main::Menu.perform(&:sign_out)
Flow::Saml.logout_from_idp(saml_idp_service) Flow::Saml.logout_from_idp(saml_idp_service)
# When the user exists with a linked identity # When the user exists with a linked identity
visit_group_sso_url visit_group_sso_url
EE::Page::Group::SamlSSOSignIn.perform(&:click_sign_in) EE::Page::Group::SamlSSOSignIn.perform(&:click_sign_in)
Flow::Saml.login_to_idp_if_required(idp_user.username, idp_user.password) Flow::Saml.login_to_idp_if_required(idp_user.username, idp_user.password)
expect(page).to have_text("Login to a GitLab account to link with your SAML identity") expect(page).to have_text("Login to a GitLab account to link with your SAML identity")
Flow::Saml.logout_from_idp(saml_idp_service) Flow::Saml.logout_from_idp(saml_idp_service)
# When the user is removed and so their linked identity is also removed # When the user is removed and so their linked identity is also removed
user.remove_via_api! user.remove_via_api!
visit_group_sso_url
EE::Page::Group::SamlSSOSignIn.perform(&:click_sign_in)
Flow::Saml.login_to_idp_if_required(idp_user.username, idp_user.password)
expect(page).to have_text("Please confirm your email address")
end
end
visit_group_sso_url context 'with Snowplow tracking enabled' do
before do
Flow::Settings.enable_snowplow
end
EE::Page::Group::SamlSSOSignIn.perform(&:click_sign_in) it_behaves_like 'group membership actions'
Flow::Saml.login_to_idp_if_required(idp_user.username, idp_user.password) after do
Flow::Settings.disable_snowplow
end
end
context 'with Snowplow tracking disabled' do
before do
Flow::Settings.disable_snowplow
end
expect(page).to have_text("Please confirm your email address") it_behaves_like 'group membership actions'
end end
after do after do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment