Browse Source

Added notify_close() to closed notify messages.

Martin Edenhofer 8 years ago
parent
commit
dca608aa06
2 changed files with 27 additions and 0 deletions
  1. 1 0
      test/browser/translation_test.rb
  2. 26 0
      test/browser_test_helper.rb

+ 1 - 0
test/browser/translation_test.rb

@@ -49,6 +49,7 @@ class TranslationTest < TestCase
     click(css: 'a[href="#manage"]')
     click(css: 'a[href="#system/translation"]')
 
+    notify_close(optional: true) # to be not in click area
     set(
       css: '#content input.js-Item[data-source="Translations"]',
       value: 'Übersetzung2',

+ 26 - 0
test/browser_test_helper.rb

@@ -293,6 +293,32 @@ class TestCase < Test::Unit::TestCase
     sleep 1
   end
 
+=begin
+
+  notify_close(
+    browser: browser1,
+    optional: true,
+  )
+
+=end
+
+  def notify_close(params = {})
+    switch_window_focus(params)
+    log('notify_close', params)
+
+    instance = params[:browser] || @browser
+
+    notify = instance.find_elements(css: '.noty_inline_layout_container.i-am-new')[0]
+    if !params[:optional] && !notify
+      screenshot(browser: instance, comment: 'no_notify')
+      raise 'Unable to closes notify, no notify found!'
+    end
+    return if !notify
+    notify.click
+    assert(true, 'notify closed')
+    sleep 1
+  end
+
 =begin
 
   location(