summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb
blob: 11a6bf6fdfa3706aaef3f7f490f91fe9f7ff5425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# frozen_string_literal: true

module QA
  RSpec.shared_examples 'registration and login' do
    it 'allows the user to registers and login' do
      Runtime::Browser.visit(:gitlab, Page::Main::Login)

      Resource::User.fabricate_via_browser_ui!

      Page::Main::Menu.perform do |menu|
        expect(menu).to have_personal_area
      end
    end
  end

  RSpec.describe 'Manage', :skip_signup_disabled do
    describe 'standard', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/936' do
      it_behaves_like 'registration and login'

      context 'when user account is deleted', :requires_admin do
        let(:user) do
          Resource::User.fabricate_via_api! do |resource|
            resource.api_client = admin_api_client
          end
        end

        before do
          # Use the UI instead of API to delete the account since
          # this is the only test that exercise this UI.
          # Other tests should use the API for this purpose.
          Flow::Login.sign_in(as: user)
          Page::Main::Menu.perform(&:click_settings_link)
          Page::Profile::Menu.perform(&:click_account)
          Page::Profile::Accounts::Show.perform do |show|
            show.delete_account(user.password)
          end
        end

        it 'allows recreating with same credentials', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/937' do
          expect(Page::Main::Menu.perform(&:signed_in?)).to be_falsy

          Flow::Login.sign_in(as: user, skip_page_validation: true)

          expect(page).to have_text("Invalid Login or password")

          @recreated_user = Resource::User.fabricate_via_browser_ui! do |resource|
            resource.name = user.name
            resource.username = user.username
            resource.email = user.email
          end

          expect(Page::Main::Menu.perform(&:signed_in?)).to be_truthy
        end

        after do
          @recreated_user.remove_via_api!
        end

        def admin_api_client
          @admin_api_client ||= Runtime::API::Client.as_admin
        end
      end
    end
  end

  RSpec.describe 'Manage', :orchestrated, :ldap_no_tls, :skip_signup_disabled do
    describe 'while LDAP is enabled', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/935' do
      it_behaves_like 'registration and login'
    end
  end
end