diff options
Diffstat (limited to 'qa/qa/page')
-rw-r--r-- | qa/qa/page/layout/banner.rb | 17 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 19 | ||||
-rw-r--r-- | qa/qa/page/main/sign_up.rb | 27 | ||||
-rw-r--r-- | qa/qa/page/menu/main.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/project/fork/new.rb | 17 | ||||
-rw-r--r-- | qa/qa/page/project/new.rb | 5 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 9 |
7 files changed, 94 insertions, 4 deletions
diff --git a/qa/qa/page/layout/banner.rb b/qa/qa/page/layout/banner.rb new file mode 100644 index 00000000000..e7654bdafc9 --- /dev/null +++ b/qa/qa/page/layout/banner.rb @@ -0,0 +1,17 @@ +module QA + module Page + module Layout + class Banner < Page::Base + view 'app/views/layouts/header/_read_only_banner.html.haml' do + element :flash_notice, ".flash-notice" + end + + def has_notice?(message) + page.within('.flash-notice') do + !!find('span', text: message) + end + end + end + end + end +end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 26c99efc53d..6cdfbd1c125 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -25,19 +25,24 @@ module QA element :standard_tab, "link_to 'Standard'" end + view 'app/views/devise/shared/_tabs_normal.html.haml' do + element :sign_in_tab, /nav-link.*login-pane.*Sign in/ + element :register_tab, /nav-link.*register-pane.*Register/ + end + def initialize # The login page is usually the entry point for all the scenarios so # we need to wait for the instance to start. That said, in some cases # we are already logged-in so we check both cases here. wait(max: 500) do page.has_css?('.login-page') || - Page::Menu::Main.act { has_personal_area? } + Page::Menu::Main.act { has_personal_area?(wait: 0) } end end def sign_in_using_credentials # Don't try to log-in if we're already logged-in - return if Page::Menu::Main.act { has_personal_area? } + return if Page::Menu::Main.act { has_personal_area?(wait: 0) } using_wait_time 0 do set_initial_password_if_present @@ -48,12 +53,22 @@ module QA sign_in_using_gitlab_credentials end end + + Page::Menu::Main.act { has_personal_area? } end def self.path '/users/sign_in' end + def switch_to_sign_in_tab + click_on 'Sign in' + end + + def switch_to_register_tab + click_on 'Register' + end + private def sign_in_using_ldap_credentials diff --git a/qa/qa/page/main/sign_up.rb b/qa/qa/page/main/sign_up.rb new file mode 100644 index 00000000000..9a834e94b81 --- /dev/null +++ b/qa/qa/page/main/sign_up.rb @@ -0,0 +1,27 @@ +module QA + module Page + module Main + class SignUp < Page::Base + view 'app/views/devise/shared/_signup_box.html.haml' do + element :name, 'text_field :name' + element :username, 'text_field :username' + element :email_field, 'email_field :email' + element :email_confirmation, 'email_field :email_confirmation' + element :password, 'password_field :password' + element :register_button, 'submit "Register"' + end + + def sign_up!(name:, username:, email:, password:) + fill_in :new_user_name, with: name + fill_in :new_user_username, with: username + fill_in :new_user_email, with: email + fill_in :new_user_email_confirmation, with: email + fill_in :new_user_password, with: password + click_button 'Register' + + Page::Menu::Main.act { has_personal_area? } + end + end + end + end +end diff --git a/qa/qa/page/menu/main.rb b/qa/qa/page/menu/main.rb index aef5c9f9c82..36e7285f7b7 100644 --- a/qa/qa/page/menu/main.rb +++ b/qa/qa/page/menu/main.rb @@ -60,9 +60,9 @@ module QA end end - def has_personal_area? + def has_personal_area?(wait: Capybara.default_max_wait_time) # No need to wait, either we're logged-in, or not. - using_wait_time(0) { page.has_selector?('.qa-user-avatar') } + using_wait_time(wait) { page.has_selector?('.qa-user-avatar') } end private diff --git a/qa/qa/page/project/fork/new.rb b/qa/qa/page/project/fork/new.rb new file mode 100644 index 00000000000..ed92df956bf --- /dev/null +++ b/qa/qa/page/project/fork/new.rb @@ -0,0 +1,17 @@ +module QA + module Page + module Project + module Fork + class New < Page::Base + view 'app/views/projects/forks/_fork_button.html.haml' do + element :namespace, 'link_to project_forks_path' + end + + def choose_namespace(namespace = Runtime::Namespace.path) + click_on namespace + end + end + end + end + end +end diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 7976e96d43b..9e812fa7c74 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -14,6 +14,7 @@ module QA element :project_path, 'text_field :path' element :project_description, 'text_area :description' element :project_create_button, "submit 'Create project'" + element :visibility_radios, 'visibility_level:' end view 'app/views/projects/_import_project_pane.html.haml' do @@ -42,6 +43,10 @@ module QA click_on 'Create project' end + def set_visibility(visibility) + choose visibility + end + def go_to_github_import click_link 'GitHub' end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 1dcdb59490a..88861d5772d 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -22,6 +22,11 @@ module QA element :branches_dropdown end + view 'app/views/projects/buttons/_fork.html.haml' do + element :fork_label, "%span= s_('GoToYourFork|Fork')" + element :fork_link, "link_to new_project_fork_path(@project)" + end + view 'app/views/projects/_files.html.haml' do element :tree_holder, '.tree-holder' end @@ -61,6 +66,10 @@ module QA click_link 'New issue' end + + def fork_project + click_on 'Fork' + end end end end |