lib/scoutui/eyes/eye_scout.rb in scoutui-2.0.3.24.pre vs lib/scoutui/eyes/eye_scout.rb in scoutui-2.0.3.25.pre

- old
+ new

@@ -50,45 +50,13 @@ # _s=/sessions\/(?<accountid>\d+)/.match(url)[1] accountid.is_a?(Array) ? accountid[0] : accountid end - def Legacyget_diff_urls(session_id, view_key) - Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "=== get_diffs_url(#{session_id} ===" - info = "https://eyes.applitools.com/api/sessions/#{session_id}/?ApiKey=#{view_key}&format=json" - diff_template = "https://eyes.applitools.com/api/sessions/#{session_id}/steps/%s/diff?ApiKey=#{view_key}" - diff_urls = Hash.new - Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " info => #{info}" - response = HTTParty.get(info) - - Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " RESP => #{response.to_s}" - - begin - data = JSON.parse(response.body) - index = 1 - data['actualOutput'].each do |elem| - if !elem.nil? && (elem['isMatching'] == false) - #diff_urls[index] = diff_template % [index] - Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " #{index.to_s} :#{elem['tag'].to_s}" - #diff_urls[index] = diff_template % [index] - diff_urls[index] = { :tag => elem['tag'].to_s, :url => diff_template % [index] } - index+=1 - end - end - - diff_urls - - rescue JSON::ParserError - ; - end - - end - - def get_diff_urls(session_id, account_id, view_key) Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == get_diffs_url(#{session_id} ==" info = "https://eyes.applitools.com/api/sessions/#{session_id}?ApiKey=#{view_key}&format=json" @@ -152,31 +120,12 @@ file.write HTTParty.get(elem[:url]) end end end - def Legacy_saveDiffs(_eyes, results, outdir, view_key) - Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " saveDiffs(#{outdir.to_s})" - Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | eyesResults => #{results.to_s}" - Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " | steps : #{results.steps.to_s}" - session_id = get_session_id(results.url) - Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " session => #{session_id}" - diffs = Legacyget_diff_urls(session_id, view_key) - - Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " diffs => #{diffs}" - if diffs.is_a?(Array) - diffs.each do |d| - Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " #{d.to_s}" - end - - download_images(diffs, outdir) - end - - end - def saveDiffs(_eyes, results, outdir, view_key) Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " saveDiffs(#{outdir.to_s})" Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " results => #{results.to_s}" Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " | steps : #{results.steps.to_s}" @@ -213,10 +162,11 @@ eyes().viewport_size.to_hash.each_pair do |k, v| Scoutui::Logger::LogMgr.instance.debug " o " + k.to_s + " : " + v.to_s end + Testmgr::TestReport.instance.getReq("EYES").testcase('Images').add(@testResults.steps.to_i > 0, "Verify at least 1 shot taken (#{@testResults.steps.to_s} shots)") Testmgr::TestReport.instance.getReq("EYES").testcase('Images').add(@testResults.missing.to_i==0, "Verify Eyes did not miss any screens (#{@testResults.missing.to_s} screens)") # 5150 _diffdir=Scoutui::Utils::TestUtils.instance.getDiffDir() @@ -231,11 +181,10 @@ else Scoutui::Logger::LogMgr.instance.info " Unable to download diff images - APPLITOOLS_VIEW_KEY not defined" end - eyes().abort_if_not_closed if !eyes().nil? end def check_window(tag, region=nil) Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " check_window(#{tag.to_s}, #{region})" if Scoutui::Utils::TestUtils.instance.isDebug? @@ -274,10 +223,12 @@ Scoutui::Logger::LogMgr.instance.info " Eyes.TestResults.Mismatches : #{@testResults.mismatches.to_s}" Scoutui::Logger::LogMgr.instance.info " Eyes.TestResults.Passed : #{@testResults.passed?.to_s}" Scoutui::Logger::LogMgr.instance.info " Eyes.TestResults.Steps : #{@testResults.steps.to_s}" end + Testmgr::TestReport.instance.getReq("Execution").testcase('Status').add(!Scoutui::Utils::TestUtils.instance.abort?, "Verify execution did not abort.") + Scoutui::Logger::LogMgr.instance.info " TestReport.Tap => #{@testResults.to_json}" Testmgr::TestReport.instance.report() # Testmgr::TestReport.instance.generateReport() @@ -310,9 +261,12 @@ Testmgr::TestReport.instance.setBrowserUnderTest(browserType) Testmgr::TestReport.instance.addRequirement('UI') Testmgr::TestReport.instance.getReq('UI').add(Testmgr::TestCase.new('visible_when', "visible_when")) Testmgr::TestReport.instance.addRequirement('Command') Testmgr::TestReport.instance.getReq('Command').add(Testmgr::TestCase.new('isValid', "isValid")) + + Testmgr::TestReport.instance.addRequirement('Execution') + Testmgr::TestReport.instance.getReq('Execution').add(Testmgr::TestCase.new('Status', "Status")) Testmgr::TestReport.instance.getReq('UI').add(Testmgr::TestCase.new('expectJsAlert', 'expectJsAlert')) if Scoutui::Utils::TestUtils.instance.isDebug? Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " setup() : #{browserType}" \ No newline at end of file