Commit 9398cc7f authored by ddavison's avatar ddavison

Enable signup before test start

Restore the signup_enabled application setting
in test after
Use Zeitwerk for gitlab page library loader
parent e21c54e1
......@@ -19,4 +19,5 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']
spec.add_runtime_dependency 'chemlab', '~> 0.9'
spec.add_runtime_dependency 'zeitwerk', '~> 2.4'
end
# frozen_string_literal: true
require 'chemlab/library'
require 'zeitwerk'
loader = Zeitwerk::Loader.new
loader.push_dir(__dir__)
loader.ignore("#{__dir__}/gitlab/**/*.stub.rb") # ignore page stubs
loader.setup
# Chemlab Page Libraries for GitLab
module Gitlab
include Chemlab::Library
module Page
module Main
autoload :Login, 'gitlab/page/main/login'
autoload :SignUp, 'gitlab/page/main/sign_up'
end
module Subscriptions
autoload :New, 'gitlab/page/subscriptions/new'
end
module Admin
autoload :Dashboard, 'gitlab/page/admin/dashboard'
autoload :Subscription, 'gitlab/page/admin/subscription'
end
module Group
module Settings
autoload :Billing, 'gitlab/page/group/settings/billing'
autoload :UsageQuotas, 'gitlab/page/group/settings/usage_quotas'
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Page
module Main
class Welcome < Chemlab::Page
path '/users/sign_up/welcome'
button :get_started_button
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Page
module Main
module Welcome
# @note Defined as +button :get_started_button+
# Clicks +get_started_button+
def get_started_button
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Main::Welcome.perform do |welcome|
# expect(welcome.get_started_button_element).to exist
# end
# @return [Watir::Button] The raw +Button+ element
def get_started_button_element
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Main::Welcome.perform do |welcome|
# expect(welcome).to be_get_started_button
# end
# @return [Boolean] true if the +get_started_button+ element is present on the page
def get_started_button?
# This is a stub, used for indexing. The method is dynamically generated.
end
end
end
end
end
# frozen_string_literal: true
module QA
RSpec.describe 'Fulfillment', :requires_admin, :skip_live_env, except: { job: 'review-qa-*' } do
RSpec.describe 'Fulfillment', :requires_admin, :skip_live_env do
describe 'Purchase' do
describe 'User Registration' do
let(:group) do
......@@ -18,14 +18,25 @@ module QA
end
before do
# Enable sign-ups
Runtime::ApplicationSettings.set_application_settings(signup_enabled: true)
# Register the new user through the registration page
Gitlab::Page::Main::SignUp.perform do |sign_up|
sign_up.visit
sign_up.register_user(user)
end
# Click the Get Started button on the welcome page if it presents itself
Gitlab::Page::Main::Welcome.perform do |welcome|
welcome.get_started_button if welcome.get_started_button?
end
end
after do
# Restore what the signup_enabled setting was before this test was run
Runtime::ApplicationSettings.restore_application_settings(:signup_enabled)
user.remove_via_api!
group.remove_via_api!
rescue Resource::ApiFabricator::ResourceNotDeletedError
......@@ -35,7 +46,7 @@ module QA
end
context 'when adding and removing a group member' do
it 'consumes a seat on the license', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2268', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/342675', type: :investigating } do
it 'consumes a seat on the license', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2268' do
Flow::Login.sign_in_as_admin
# Save the number of users as stated by the license
......
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