diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-12-26 18:03:21 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-12-26 18:03:21 +0800 |
commit | 82bf55c8db3d149c27807e5646ff8ff4454a5ea7 (patch) | |
tree | 65e2523a9288ec64421b19ccf27cbce0c371c40c /qa | |
parent | cc06bb2c6ec1facf2b1eb50803dbedc076abe017 (diff) | |
parent | 145079b3540ca832e1d981bbc685cc8c27d47ea0 (diff) | |
download | gitlab-ce-82bf55c8db3d149c27807e5646ff8ff4454a5ea7.tar.gz |
Merge remote-tracking branch 'upstream/master' into 54953-error-500-viewing-merge-request-due-to-nil-commit_email_hostname
* upstream/master: (115 commits)
[CE] Speed up login page usage
Add new line and comments
Fix the seeder 24_forks.rb cannot find public project
Milestones on community contribution issues
Removed Gitlab Upgrader found in /lib/gitlab/upgrader.rb
Fix and move specs into admin_disables_git_access_protocol_spec.rb
Fix HTTP/SSH clone panel for mobile
Add spec for HTTP/SSH clone panel
Fix missing Git clone button when protocol restriction setting enabled
Fix deprecation: Using positional arguments in integration tests
Extend override check to also check arity
Update tm cli version
Bump Gitaly version to v1.12.0
Add @dbalexandre to CODEOWNERS
Update verbiage for clarity
Change group-cluster beta to regular note
Change alpha states to use note instead of warning
Update registry section. Update serverless.yaml formatting
Clarify obtaining application URL
Add @godfat to CODEOWNERS
...
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/base.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/main/menu.rb | 8 | ||||
-rw-r--r-- | qa/qa/support/page/logging.rb | 10 | ||||
-rw-r--r-- | qa/spec/page/logging_spec.rb | 7 |
5 files changed, 34 insertions, 11 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 88ade66f47d..615d17bbcfe 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -108,8 +108,12 @@ module QA element.select value.to_s.capitalize end - def has_element?(name) - has_css?(element_selector_css(name)) + def has_element?(name, wait: Capybara.default_max_wait_time) + has_css?(element_selector_css(name), wait: wait) + end + + def has_no_text?(text) + page.has_no_text? text end def within_element(name) diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 97ffe0e5716..cb83ace20b6 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -35,13 +35,21 @@ module QA element :saml_login_button end + view 'app/views/layouts/devise.html.haml' do + element :login_page + 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. + # Check if we're already logged in first. If we don't then we have to + # wait 10 seconds for the check for the login page to fail every time + # we use this class when we're already logged in (E.g., whenever we + # create a personal access token to use for API access). wait(max: 500) do - has_css?('.login-page') || - Page::Main::Menu.act { has_personal_area?(wait: 0) } + Page::Main::Menu.act { has_personal_area?(wait: 0) } || + has_element?(:login_page) end end diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index cc2724618e9..6804cc8fb20 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -63,15 +63,11 @@ module QA end def has_personal_area?(wait: Capybara.default_max_wait_time) - using_wait_time(wait) do - page.has_selector?(element_selector_css(:user_avatar)) - end + has_element?(:user_avatar, wait: wait) end def has_admin_area_link?(wait: Capybara.default_max_wait_time) - using_wait_time(wait) do - page.has_selector?(element_selector_css(:admin_area_link)) - end + has_element?(:admin_area_link, wait: wait) end private diff --git a/qa/qa/support/page/logging.rb b/qa/qa/support/page/logging.rb index 43bc16d8c9a..df3b794b14b 100644 --- a/qa/qa/support/page/logging.rb +++ b/qa/qa/support/page/logging.rb @@ -77,7 +77,7 @@ module QA super end - def has_element?(name) + def has_element?(name, wait: Capybara.default_max_wait_time) found = super log("has_element? :#{name} returned #{found}") @@ -85,6 +85,14 @@ module QA found end + def has_no_text?(text) + found = super + + log(%Q{has_no_text?('#{text}') returned #{found}}) + + found + end + def within_element(name) log("within element :#{name}") diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb index 9d56353062b..a54ff424f53 100644 --- a/qa/spec/page/logging_spec.rb +++ b/qa/spec/page/logging_spec.rb @@ -65,6 +65,13 @@ describe QA::Support::Page::Logging do .to output(/has_element\? :element returned true/).to_stdout_from_any_process end + it 'logs has_no_text?' do + allow(page).to receive(:has_no_text?).with('foo').and_return(true) + + expect { subject.has_no_text? 'foo' } + .to output(/has_no_text\?\('foo'\) returned true/).to_stdout_from_any_process + end + it 'logs within_element' do expect { subject.within_element(:element) } .to output(/within element :element/).to_stdout_from_any_process |