Welcome to mirror list, hosted at ThFree Co, Russian Federation.

new.rb « subscriptions « page « gitlab « lib « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 739efeed8986eb34d20b27d8c2a8de6ba1b28b26 (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
# frozen_string_literal: true

module Gitlab
  module Page
    module Subscriptions
      class New < Chemlab::Page
        path '/subscriptions/new'

        # Purchase Details
        select :plan_name
        select :group_name
        text_field :number_of_users
        text_field :quantity
        button :continue_to_billing, text: /Continue to billing/

        # Billing address
        select :country
        text_field :street_address_1
        text_field :street_address_2
        text_field :city
        select :state
        text_field :zip_code
        button :continue_to_payment, text: /Continue to payment/

        # Payment method
        # TODO: Revisit when https://gitlab.com/gitlab-org/quality/chemlab/-/issues/6 is closed
        iframe :payment_form, id: 'z_hppm_iframe'

        text_field(:name_on_card) { payment_form_element.text_field(id: 'input-creditCardHolderName') }
        text_field(:card_number) { payment_form_element.text_field(id: 'input-creditCardNumber') }
        select(:expiration_month) { payment_form_element.select(id: 'input-creditCardExpirationMonth') }
        select(:expiration_year) { payment_form_element.select(id: 'input-creditCardExpirationYear') }
        text_field(:cvv) { payment_form_element.text_field(id: 'input-cardSecurityCode') }
        link(:review_your_order) { payment_form_element.link(text: /Review your order/) }
        # ENDTODO

        # Confirmation
        button :confirm_purchase, text: /Confirm purchase/

        # Order Summary
        div :selected_plan
        div :total_amount

        # Alerts
        div :lock_competition_error, text: /Operation failed due to a lock competition, please retry later./

        def purchase
          ::QA::Support::Retrier.retry_until(
            max_duration: 60,
            sleep_interval: 10,
            message: 'Expected no Zuora lock competition error'
          ) do
            confirm_purchase
            ::QA::Support::WaitForRequests.wait_for_requests
            !lock_competition_error?
          end
        end
      end
    end
  end
end