diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-01-09 13:20:57 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-01-09 13:21:23 +0100 |
commit | dee047aaca8e668a195194163e2b8841bf5dc647 (patch) | |
tree | 6a91ea3a0b194cbebc1afe0ca6859dfe9c0adad4 | |
parent | df774fae4148fcb91380841c48514762d255affb (diff) | |
download | gitlab-ce-dee047aaca8e668a195194163e2b8841bf5dc647.tar.gz |
Add QA login page views / selectors definition
-rw-r--r-- | qa/qa/page/element.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/view.rb | 4 | ||||
-rw-r--r-- | qa/spec/page/view_spec.rb | 10 |
4 files changed, 16 insertions, 14 deletions
diff --git a/qa/qa/page/element.rb b/qa/qa/page/element.rb index 791f92d002d..23e1b10fe33 100644 --- a/qa/qa/page/element.rb +++ b/qa/qa/page/element.rb @@ -19,10 +19,6 @@ module QA def matches?(line) !!(line =~ expression) end - - def to_s - @name - end end end end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index f88325f408b..7b4c1603017 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -2,6 +2,18 @@ module QA module Page module Main class Login < Page::Base + view 'app/views/devise/passwords/edit.html.haml' do + element :password_field, 'password_field :password' + element :password_confirmation, 'password_field :password_confirmation' + element :change_password_button, 'submit "Change your password"' + end + + view 'app/views/devise/sessions/_new_base.html.haml' do + element :login_field, 'text_field :login' + element :passowrd_field, 'password_field :password' + element :sign_in_button, 'submit "Sign in"' + end + def initialize wait('.application', time: 500) end diff --git a/qa/qa/page/view.rb b/qa/qa/page/view.rb index 47658144783..e8fba4dffd2 100644 --- a/qa/qa/page/view.rb +++ b/qa/qa/page/view.rb @@ -23,13 +23,13 @@ module QA # elements' existence. # @missing ||= @elements.dup.tap do |elements| - File.new(pathname.to_s).foreach do |line| + File.foreach(pathname.to_s) do |line| elements.reject! { |element| element.matches?(line) } end end @missing.map do |missing| - "Missing element `#{missing}` in `#{pathname}` view partial!" + "Missing element `#{missing.name}` in `#{pathname}` view partial!" end end diff --git a/qa/spec/page/view_spec.rb b/qa/spec/page/view_spec.rb index dd38b171ad5..aedbc3863a7 100644 --- a/qa/spec/page/view_spec.rb +++ b/qa/spec/page/view_spec.rb @@ -24,12 +24,6 @@ describe QA::Page::View do end describe '#errors' do - let(:file) { spy('file') } - - before do - allow(File).to receive(:new).and_return(file) - end - context 'when view partial is present' do before do allow(subject.pathname).to receive(:readable?) @@ -38,7 +32,7 @@ describe QA::Page::View do context 'when pattern is found' do before do - allow(file).to receive(:foreach) + allow(File).to receive(:foreach) .and_yield('some element').once allow(element).to receive(:matches?) .with('some element').and_return(true) @@ -51,7 +45,7 @@ describe QA::Page::View do context 'when pattern has not been found' do before do - allow(file).to receive(:foreach) + allow(File).to receive(:foreach) .and_yield('some element').once allow(element).to receive(:matches?) .with('some element').and_return(false) |