Skip to content

Commit

Permalink
Fix another wrong link for fachinfo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Nov 30, 2015
1 parent 30f4599 commit 50f24ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
23 changes: 18 additions & 5 deletions spec/snapback_spec.rb
Expand Up @@ -33,9 +33,10 @@
FI_url = "de/gcc/fachinfo/reg/#{SNAP_IKSNR}"
FI_Snap = /Sie befinden sich in - ,(Home|Suchresultat),Fachinformation zu #{SNAP_NAME}/
Diff_URL = /\/show\/fachinfo\/#{SNAP_IKSNR}\/diff/

test_1_4 = SnapbackTestStep.new(__LINE__, nil, nil, /\d{2}.\d{2}.\d{4}/, "/show/fachinfo/#{SNAP_IKSNR}/diff", /Home,Fachinformation zu Lubex,Änderungen,\d{2}.\d{2}.\d{4}/, nil)
test_1_3 = SnapbackTestStep.new(__LINE__, nil, nil, "Änderungen anzeigen","/show/fachinfo/#{SNAP_IKSNR}/diff", "Home,Fachinformation zu Lubex,Änderungen", test_1_4)
Date_Regexp = /\d{2}.\d{2}.\d{4}/
diff_url = "/show/fachinfo/#{SNAP_IKSNR}/diff"
test_1_4 = SnapbackTestStep.new(__LINE__, nil, nil, Date_Regexp, diff_url, /Home,Fachinformation zu Lubex,Änderungen,\d{2}.\d{2}.\d{4}/, nil)
test_1_3 = SnapbackTestStep.new(__LINE__, nil, nil, "Änderungen anzeigen",diff_url, "Home,Fachinformation zu Lubex,Änderungen", test_1_4)
test_1_2 = SnapbackTestStep.new(__LINE__, nil, nil, 'FI', FI_url, FI_Snap, test_1_3)
FirstTest = SnapbackTestStep.new(__LINE__,/Swissmedic/, SNAP_IKSNR.to_s, nil, Search_URL, Search_Snap, test_1_2)
FI_Link = /\/fachinfo\/swissmedicnr\/(\d+)$/
Expand Down Expand Up @@ -67,6 +68,20 @@ def search_item(search_type, search_value)
@browser.text_field(:name, "search_query").send_keys :enter
end

it "should have a working link to Änderungen from the diff" do
@browser.goto(OddbUrl + '/de/gcc' + diff_url)
link = @browser.link(:text => Date_Regexp)
expect(link.exist?).to be true
saved_url = @browser.url.to_s.clone
saved_text = @browser.text
link.click
link = @browser.link(:text => /Änderungen/)
expect(link.exist?).to be true
link.click
expect(@browser.url.to_s).to eql saved_url.to_s
expect(@browser.text[0..100]).to eql saved_text[0..100]
expect(@browser.text).to eql saved_text
end
it "should allow going back, then forward" do
current= FirstTest
nr = 1
Expand Down Expand Up @@ -143,7 +158,6 @@ def search_item(search_type, search_value)
if current.link_to_click
link = @browser.link(:text => current.link_to_click)
puts "#{nr}: Clicking link #{current.link_to_click} exist? #{link.exist?}"
binding.pry unless link.exist?
expect(link.exist?).to be true
link.click
elsif current.search_value
Expand Down Expand Up @@ -191,7 +205,6 @@ def check_pointer_steps(expected, line = nil)
steps = @browser.elements.find_all{ |x| x.class_name.eql? 'th-pointersteps'}
text = steps.collect{ |y| y.text }.join(',').clone
puts "#{__LINE__}: #{Time.now} Pointersteps are #{text}\n should #{expected} are #{expected.match(text).inspect}"
binding.pry unless expected.match(text)
expect(text).to match expected
end

Expand Down
11 changes: 4 additions & 7 deletions src/view/drugs/fachinfo_change_logs.rb
Expand Up @@ -69,7 +69,7 @@ def backtracking(model, session=@session)
# /fachinfo/reg/65453
link_changes = HtmlGrid::Link.new(:home, model, @session, self)
link_changes.css_class = class_name
link_changes.href = @lookandfeel._event_url(:home, [:fachinfo, @session.choosen_fachinfo_diff.first.iksnr, :diff])
link_changes.href = @lookandfeel._event_url(:show, [:fachinfo, @session.choosen_fachinfo_diff.first.iksnr, :diff])
link_changes.value = @lookandfeel.lookup(:change_log_backtracking)
fields << link_changes

Expand Down Expand Up @@ -116,12 +116,9 @@ def trademark(model)
link
end
def get_link_href(model)
@lookandfeel._event_url(:show,
[:fachinfo,
@session.choosen_fachinfo_diff.first.iksnr,
:diff,
model.time.strftime('%d.%m.%Y')
] )
@lookandfeel._event_url(:show,[ :fachinfo, @session.choosen_fachinfo_diff.first.iksnr,
:diff, model.time.strftime('%d.%m.%Y')
] )
end
end
class FachinfoDocumentChangelogsComposite < HtmlGrid::Composite
Expand Down

0 comments on commit 50f24ff

Please sign in to comment.