diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-08 21:07:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-08 21:07:52 +0000 |
commit | 6cb5b3a92d526e8b675aba2d1455e7e00b8656f5 (patch) | |
tree | 74533f94c28cab59705346299132cd362bbc6a99 /spec/support/helpers | |
parent | 9885b7e33ece32ac3bfbf077bb2dc53c459dbc0e (diff) | |
download | gitlab-ce-6cb5b3a92d526e8b675aba2d1455e7e00b8656f5.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/helpers')
-rw-r--r-- | spec/support/helpers/features/two_factor_helpers.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/support/helpers/features/two_factor_helpers.rb b/spec/support/helpers/features/two_factor_helpers.rb index 824ecddc392..d5f069a40ea 100644 --- a/spec/support/helpers/features/two_factor_helpers.rb +++ b/spec/support/helpers/features/two_factor_helpers.rb @@ -14,6 +14,17 @@ module Spec module Helpers module Features module TwoFactorHelpers + def copy_recovery_codes + click_on _('Copy codes') + click_on _('Proceed') + end + + def enable_two_factor_authentication + click_on _('Enable two-factor authentication') + expect(page).to have_content(_('Set up new device')) + wait_for_requests + end + def manage_two_factor_authentication click_on 'Manage two-factor authentication' expect(page).to have_content("Set up new device") @@ -21,6 +32,7 @@ module Spec end # Registers webauthn device via UI + # Remove after `webauthn_without_totp` feature flag is deleted. def register_webauthn_device(webauthn_device = nil, name: 'My device') webauthn_device ||= FakeWebauthnDevice.new(page, name) webauthn_device.respond_to_webauthn_registration @@ -31,6 +43,25 @@ module Spec webauthn_device end + def webauthn_device_registration(webauthn_device: nil, name: 'My device', password: 'fake') + webauthn_device ||= FakeWebauthnDevice.new(page, name) + webauthn_device.respond_to_webauthn_registration + click_on _('Set up new device') + webauthn_fill_form_and_submit(name: name, password: password) + webauthn_device + end + + def webauthn_fill_form_and_submit(name: 'My device', password: 'fake') + expect(page).to have_content( + _('Your device was successfully set up! Give it a name and register it with the GitLab server.') + ) + within '[data-testid="create-webauthn"]' do + fill_in _('Device name'), with: name + fill_in _('Current password'), with: password + click_on _('Register device') + end + end + # Adds webauthn device directly via database def add_webauthn_device(app_id, user, fake_device = nil, name: 'My device') fake_device ||= WebAuthn::FakeClient.new(app_id) |