Log In
Log In
Places
All Projects
Status Monitor
Collapse sidebar
obs:server:fedora:2.8
obs-server
obs-server-2.8-0016-webui-Wait-for-flash-messag...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File obs-server-2.8-0016-webui-Wait-for-flash-message-to-appear-in-webui-test.patch of Package obs-server
From f8ed9d0deb17b0c7acab89b7af1cff95161c2674 Mon Sep 17 00:00:00 2001 From: Oleg Girko <ol@infoserver.lv> Date: Tue, 5 Jul 2016 00:34:28 +0100 Subject: [PATCH] [webui] Wait for flash message to appear in webui tests. This change makes flash_message and flash_message_type methods wait for flash message to appear on the page. Also, these methods now raise error when flash message doesn't appear or multiple flash messages appear. Raising error instead of returning nil if there is no flash message does not affect webui tests and even makes them more correct: there is no place in webui tests where return of these methods is checked for nil, and there are many placse that assume that it's non-nil. Methods flash_messages and flash_message_appeared? have been removed. They are not used in webui tests anyway. Signed-off-by: Oleg Girko <ol@infoserver.lv> --- src/api/test/test_helper.rb | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/src/api/test/test_helper.rb b/src/api/test/test_helper.rb index 7cebb43..dc013c1 100644 --- a/src/api/test/test_helper.rb +++ b/src/api/test/test_helper.rb @@ -326,49 +326,21 @@ module Webui end # ============================================================================ - # Checks if a flash message is displayed on screen - # - def flash_message_appeared? - flash_message_type != nil - end - - # ============================================================================ # Returns the text of the flash message currenlty on screen - # @note Doesn't fail if no message is on screen. Returns empty string instead. + # @note Raises error if no message or multiple messages are on screen. # @return [String] # def flash_message - results = all(:css, 'div#flash-messages p') - if results.empty? - return 'none' - end - if results.count > 1 - texts = results.map { |r| r.text } - raise "One flash expected, but we had #{texts.inspect}" - end - results.first.text - end - - # ============================================================================ - # Returns the text of the flash messages currenlty on screen - # @note Doesn't fail if no message is on screen. Returns empty list instead. - # @return [array] - # - def flash_messages - results = all(:css, 'div#flash-messages p') - ret = [] - results.each { |r| ret << r.text } - ret + find(:css, 'div#flash-messages p').text end # ============================================================================ # Returns the type of the flash message currenlty on screen - # @note Does not fail if no message is on screen! Returns nil instead! + # @note Raises error if no message or multiple messages are on screen. # @return [:info, :alert] # def flash_message_type - result = first(:css, 'div#flash-messages span') - return unless result + result = find(:css, 'div#flash-messages span') return :info if result['class'].include? 'info' return :alert if result['class'].include? 'alert' end -- 2.9.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Contact
Support
@OBShq
The Open Build Service is an
openSUSE project
.
Log In
Places
Places
All Projects
Status Monitor