Skip to content

Commit

Permalink
Fixed some search spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Sep 19, 2017
1 parent 149fa50 commit 3515d69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions spec/searchbar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ def enter_fachinfo_search
end

{ '125Dihydroxycholecalciferol 1000' => '1,25-Dihydroxycholecalciferol',
'125' => '125',
'125' => '1,25-Dihydroxycholecalciferol',
'125Dihydroxycholecalciferol' => '1,25-Dihydroxycholecalciferol',
'125' => 'CA 125',
}.each {
|searchterm, searchtext|
it "should be possible to find #{searchtext} when searching via #{searchterm} in analysen" do
Expand All @@ -89,6 +88,7 @@ def enter_fachinfo_search
@browser.button(:name => 'search').click; small_delay

expect(@browser.text).not_to match LeeresResult
binding.pry unless /#{searchtext}/.match(@browser.text)
expect(@browser.text).to match /#{searchtext}/
end
} unless ['just-medical'].index(Flavor)
Expand Down Expand Up @@ -337,6 +337,8 @@ def enter_fachinfo_search
end unless ['just-medical'].index(Flavor)

it "should show no drugs for Fortex via unwanted effects search" do
# Fortext should not show up, as it was never registered in Switzerland
# However we have not yet had the time to fix this problem
@browser.link(:name, 'drugs').click; small_delay

@browser.select_list(:name, "search_type").select("Unerwünschte Wirkung")
Expand Down Expand Up @@ -417,4 +419,4 @@ def enter_fachinfo_search
after :all do
@browser.close
end
end
end
5 changes: 3 additions & 2 deletions spec/smoketest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def check_nutriflex_56091(text)
it "should find redirect an iphone to the mobile flavor" do
begin
iphone_ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1"
new_options = @default_chrome_options.clone
new_options = @browser_options.clone
new_options.args << "--user-agent=#{iphone_ua}"
iphone_browser = Watir::Browser.new :chrome, options: new_options
iphone_browser.goto 'http://www.useragentstring.com/'
Expand Down Expand Up @@ -347,6 +347,7 @@ def check_nutriflex_56091(text)
filesBeforeDownload = Dir.glob(GlobAllDownloads)
@browser.text_field(:name, "search_query").set(test_medi)
@browser.button(:name, "search").click; small_delay
@browser.scroll.to :top
@browser.link(:text, "Beispiel-Download").click; small_delay
@browser.button(:value,"Resultat als CSV Downloaden").click; small_delay
filesAfterDownload = Dir.glob(GlobAllDownloads)
Expand Down Expand Up @@ -526,7 +527,7 @@ def check_search_with_type
@browser.goto(@user_pref_url)
expect(@browser.checkbox(:id => limitation.to_s).set?).to be true
select_product_by_trademark(drug_name)
binding.pry unless @browser.span(:class => 'breadcrumb-1').exist? # >Liste für "Methotrexat" (18)</span>'
# binding.pry unless @browser.span(:class => 'breadcrumb-1').exist? # >Liste für "Methotrexat" (18)</span>'
list_title = @browser.span(:class => 'breadcrumb-1').text
nr_items = /\((\d+)\)/.match(list_title)[1].to_i
categories = @browser.elements(:id => /ikscat_\d+$/).collect{|x| x.text}
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def small_delay
end

def createScreenshot(browser, added=nil)
return
small_delay
if browser.url.index('?')
name = File.join(ImageDest, File.basename(browser.url.split('?')[0]).gsub(/\W/, '_'))
Expand Down

0 comments on commit 3515d69

Please sign in to comment.