lib/element_verification.rb in gridium-1.1.4 vs lib/element_verification.rb in gridium-1.1.6
- old
+ new
@@ -12,22 +12,22 @@
@should_exist = element_should_exist
@fail_test = fail_test
end
def not
- ElementVerification.new(@element, @timeout, @fail_test, element_should_exist: false)
+ ElementVerification.new(@element, @timeout, fail_test: @fail_test, element_should_exist: false)
end
def text(text)
fail_message = nil
pass_message = nil
should_have_text = @should_exist
element_text = @element.text
if @element.present?
$verification_passes += 1
else
- Log.error("Cannot determine element text. Element is not present.")
+ Log.error("[GRIDIUM::ElementVerification] Cannot determine element text. Element is not present.")
end
if should_have_text
fail_message = "Element should contain text (#{text}), but does not."
pass_message = "contains text (#{text})."
@@ -39,15 +39,15 @@
wait = Selenium::WebDriver::Wait.new :timeout => @timeout, :interval => 1
begin
wait.until do
element_contains_text = element_text.eql?(text)
if should_have_text && element_contains_text
- Log.debug("Confirming text (#{text}) is within element...")
+ Log.debug("[GRIDIUM::ElementVerification] Confirming text (#{text}) is within element...")
ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
log_success(pass_message)
elsif !should_have_text && !element_contains_text
- Log.debug("Confirming text (#{text}) is NOT within element...")
+ Log.debug("[GRIDIUM::ElementVerification] Confirming text (#{text}) is NOT within element...")
ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
log_success(pass_message)
else
log_issue("#{fail_message} Element's text is: (#{element_text}).")
end
@@ -76,11 +76,11 @@
if element_is_displayed && should_be_visible
ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
log_success(pass_message)
return @element
elsif !element_is_displayed && !should_be_visible
- Log.debug("Confirming element is NOT visible...")
+ Log.debug("[GRIDIUM::ElementVerification] Confirming element is NOT visible...")
log_success(pass_message)
else
log_issue(fail_message)
end
end
@@ -108,11 +108,11 @@
if element_is_present && should_be_present
ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
log_success(pass_message)
return @element
elsif !element_is_present && !should_be_present
- Log.debug("Confirming element is NOT present...")
+ Log.debug("[GRIDIUM::ElementVerification] Confirming element is NOT present...")
log_success(pass_message)
else
log_issue(fail_message)
end
end
@@ -143,19 +143,19 @@
private
def log_issue(message)
if @fail_test
- Log.error("#{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
+ Log.error("[GRIDIUM::ElementVerification] #{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
$fail_test_instantly = true
Kernel.fail(message)
else
- Log.error("#{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
+ Log.error("[GRIDIUM::ElementVerification] #{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
$fail_test_at_end = true
end
end
def log_success(pass_message)
$verification_passes += 1
- Log.debug("Verified: '#{@element.name}' (By:(#{@element.by} => '#{@element.locator}')) #{pass_message}")
+ Log.debug("[GRIDIUM::ElementVerification] Verified: '#{@element.name}' (By:(#{@element.by} => '#{@element.locator}')) #{pass_message}")
end
end