From f6535de93ec492024bd656c7bff7f451b6f95d7a Mon Sep 17 00:00:00 2001 From: Valerie Burton <vburton@gitlab.com> Date: Mon, 11 Sep 2023 14:29:41 -0500 Subject: [PATCH] E2E: New Subscriptions Page data-testid Migration Migrates data-qa-selectors in Gitlab::Page::Subscriptions::New to data-testids --- .../new/components/order_summary.vue | 4 +- .../order_summary/summary_details.vue | 6 +- qa/lib/gitlab/page/subscriptions/new.rb | 4 +- qa/lib/gitlab/page/subscriptions/new.stub.rb | 82 +++++++++++++++++++ 4 files changed, 89 insertions(+), 7 deletions(-) diff --git a/ee/app/assets/javascripts/subscriptions/new/components/order_summary.vue b/ee/app/assets/javascripts/subscriptions/new/components/order_summary.vue index 6cd1948b67af..2d2e31088833 100644 --- a/ee/app/assets/javascripts/subscriptions/new/components/order_summary.vue +++ b/ee/app/assets/javascripts/subscriptions/new/components/order_summary.vue @@ -220,8 +220,8 @@ export default { </template> </summary-details> </div> - <div class="gl-display-none gl-lg-display-block" data-qa-selector="order_summary"> - <h4 class="gl-my-0 gl-font-lg" data-qa-selector="title">{{ titleWithName }}</h4> + <div class="gl-display-none gl-lg-display-block" data-testid="order-summary"> + <h4 class="gl-my-0 gl-font-lg" data-testid="title">{{ titleWithName }}</h4> <summary-details class="gl-mt-6"> <template v-if="isEligibleToUsePromoCode" #promo-code> <promo-code-input diff --git a/ee/app/assets/javascripts/subscriptions/new/components/order_summary/summary_details.vue b/ee/app/assets/javascripts/subscriptions/new/components/order_summary/summary_details.vue index 6130f41d7f07..88451fa0cb87 100644 --- a/ee/app/assets/javascripts/subscriptions/new/components/order_summary/summary_details.vue +++ b/ee/app/assets/javascripts/subscriptions/new/components/order_summary/summary_details.vue @@ -54,14 +54,14 @@ export default { <template> <div> <div class="gl-display-flex gl-justify-content-space-between gl-font-weight-bold gl-mb-3"> - <div data-testid="selected-plan" data-qa-selector="selected_plan"> + <div data-testid="selected-plan"> {{ sprintf($options.i18n.selectedPlanText, { selectedPlanText }) }} <span v-if="usersPresent" data-testid="number-of-users">{{ sprintf($options.i18n.numberOfUsers, { numberOfUsers }) }}</span> </div> <gl-loading-icon v-if="isInvoicePreviewLoading" inline class="gl-my-auto gl-ml-3" /> - <div v-else class="gl-ml-3" data-testid="amount" data-qa-selector="total"> + <div v-else class="gl-ml-3" data-testid="amount"> {{ formatAmount(totalExVat, showAmount) }} </div> </div> @@ -131,7 +131,7 @@ export default { <div class="gl-display-flex gl-justify-content-space-between gl-font-lg gl-font-weight-bold"> <div>{{ $options.i18n.total }}</div> <gl-loading-icon v-if="isInvoicePreviewLoading" inline class="gl-my-auto" /> - <div v-else data-testid="total-amount" data-qa-selector="total_amount"> + <div v-else data-testid="total-amount"> {{ formatAmount(totalAmount, showAmount) }} </div> </div> diff --git a/qa/lib/gitlab/page/subscriptions/new.rb b/qa/lib/gitlab/page/subscriptions/new.rb index 6e3cb45fd29f..95e5028f9853 100644 --- a/qa/lib/gitlab/page/subscriptions/new.rb +++ b/qa/lib/gitlab/page/subscriptions/new.rb @@ -38,8 +38,8 @@ class New < Chemlab::Page button :confirm_purchase, text: /Confirm purchase/ # Order Summary - div :selected_plan, 'data-testid': 'selected-plan' - div :order_total, 'data-testid': 'total-amount' + div :selected_plan + div :total_amount end end end diff --git a/qa/lib/gitlab/page/subscriptions/new.stub.rb b/qa/lib/gitlab/page/subscriptions/new.stub.rb index 93680ab95e03..a7f5d6898389 100644 --- a/qa/lib/gitlab/page/subscriptions/new.stub.rb +++ b/qa/lib/gitlab/page/subscriptions/new.stub.rb @@ -86,6 +86,40 @@ def number_of_users? # This is a stub, used for indexing. The method is dynamically generated. end + # @note Defined as +text_field :quantity+ + # @return [String] The text content or value of +quantity+ + def quantity + # This is a stub, used for indexing. The method is dynamically generated. + end + + # Set the value of quantity + # @example + # Gitlab::Page::Subscriptions::New.perform do |new| + # new.quantity = 'value' + # end + # @param value [String] The value to set. + def quantity=(value) + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Subscriptions::New.perform do |new| + # expect(new.quantity_element).to exist + # end + # @return [Watir::TextField] The raw +TextField+ element + def quantity_element + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Subscriptions::New.perform do |new| + # expect(new).to be_quantity + # end + # @return [Boolean] true if the +quantity+ element is present on the page + def quantity? + # This is a stub, used for indexing. The method is dynamically generated. + end + # @note Defined as +button :continue_to_billing+ # Clicks +continue_to_billing+ def continue_to_billing @@ -539,6 +573,54 @@ def confirm_purchase_element def confirm_purchase? # This is a stub, used for indexing. The method is dynamically generated. end + + # @note Defined as +div :selected_plan+ + # @return [String] The text content or value of +selected_plan+ + def selected_plan + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Subscriptions::New.perform do |new| + # expect(new.selected_plan_element).to exist + # end + # @return [Watir::Div] The raw +Div+ element + def selected_plan_element + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Subscriptions::New.perform do |new| + # expect(new).to be_selected_plan + # end + # @return [Boolean] true if the +selected_plan+ element is present on the page + def selected_plan? + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @note Defined as +div :total_amount+ + # @return [String] The text content or value of +total_amount+ + def total_amount + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Subscriptions::New.perform do |new| + # expect(new.total_amount_element).to exist + # end + # @return [Watir::Div] The raw +Div+ element + def total_amount_element + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Subscriptions::New.perform do |new| + # expect(new).to be_total_amount + # end + # @return [Boolean] true if the +total_amount+ element is present on the page + def total_amount? + # This is a stub, used for indexing. The method is dynamically generated. + end end end end -- GitLab