summaryrefslogtreecommitdiff
path: root/qa/qa/vendor/jenkins/page/login.rb
blob: 7b3558b25e203d40d075f27f848af9fd0e1bd436 (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
# frozen_string_literal: true

require 'capybara/dsl'

module QA
  module Vendor
    module Jenkins
      module Page
        class Login < Page::Base
          def initialize
            @path = 'login'
          end

          def visit!
            super

            QA::Support::Retrier.retry_until(sleep_interval: 3, reload_page: page, max_attempts: 20, exit_on_failure: true) do
              page.has_text? 'Welcome to Jenkins!'
            end
          end

          def login
            fill_in 'j_username', with: 'admin'
            fill_in 'j_password', with: 'password'
            click_on 'Sign in'
          end
        end
      end
    end
  end
end