summaryrefslogtreecommitdiff
path: root/qa/spec/page
diff options
context:
space:
mode:
Diffstat (limited to 'qa/spec/page')
-rw-r--r--qa/spec/page/base_spec.rb30
-rw-r--r--qa/spec/page/logging_spec.rb13
2 files changed, 41 insertions, 2 deletions
diff --git a/qa/spec/page/base_spec.rb b/qa/spec/page/base_spec.rb
index 076a8087db5..32a350f2154 100644
--- a/qa/spec/page/base_spec.rb
+++ b/qa/spec/page/base_spec.rb
@@ -59,4 +59,34 @@ describe QA::Page::Base do
end
end
end
+
+ describe '#wait' do
+ subject { Class.new(described_class).new }
+
+ context 'when the condition is true' do
+ it 'does not refresh' do
+ expect(subject).not_to receive(:refresh)
+
+ subject.wait(max: 0.01) { true }
+ end
+
+ it 'returns true' do
+ expect(subject.wait(max: 0.1) { true }).to be_truthy
+ end
+ end
+
+ context 'when the condition is false' do
+ it 'refreshes' do
+ expect(subject).to receive(:refresh).at_least(:once)
+
+ subject.wait(max: 0.01) { false }
+ end
+
+ it 'returns false' do
+ allow(subject).to receive(:refresh)
+
+ expect(subject.wait(max: 0.01) { false }).to be_falsey
+ end
+ end
+ end
end
diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb
index f289ee3c2bb..a6e9601cee4 100644
--- a/qa/spec/page/logging_spec.rb
+++ b/qa/spec/page/logging_spec.rb
@@ -4,8 +4,6 @@ require 'capybara/dsl'
require 'logger'
describe QA::Support::Page::Logging do
- include Support::StubENV
-
let(:page) { double.as_null_object }
before do
@@ -31,11 +29,22 @@ describe QA::Support::Page::Logging do
it 'logs wait' do
expect { subject.wait(max: 0) {} }
+ .to output(/next wait uses reload: true/).to_stdout_from_any_process
+ expect { subject.wait(max: 0) {} }
.to output(/with wait/).to_stdout_from_any_process
expect { subject.wait(max: 0) {} }
.to output(/ended wait after .* seconds$/).to_stdout_from_any_process
end
+ it 'logs wait with reload false' do
+ expect { subject.wait(max: 0, reload: false) {} }
+ .to output(/next wait uses reload: false/).to_stdout_from_any_process
+ expect { subject.wait(max: 0, reload: false) {} }
+ .to output(/with wait/).to_stdout_from_any_process
+ expect { subject.wait(max: 0, reload: false) {} }
+ .to output(/ended wait after .* seconds$/).to_stdout_from_any_process
+ end
+
it 'logs scroll_to' do
expect { subject.scroll_to(:element) }
.to output(/scrolling to :element/).to_stdout_from_any_process