Module: Applitools::Selenium::ScriptTemplates

Extended by:
ScriptTemplates
Included in:
ScriptTemplates
Defined in:
lib/applitools/selenium/scripts/templates.rb

Constant Summary collapse

PROCESS_PAGE_AND_POLL_RB =

JS_FILES_PATH = File.join(Applitools::JS_PATH, ‘@applitools’, ‘dom-snapshot’, ‘dist’)

<<"SCRIPT"
module Applitools
  module Selenium
    module Scripts
      PROCESS_PAGE_AND_POLL = <<'END'
#{get_script_by_file_name('processPageAndSerializePoll')}
END
    end
  end
end
SCRIPT

Instance Method Summary collapse

Instance Method Details

#get_script_by_file_name(fname) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/applitools/selenium/scripts/templates.rb', line 5

def get_script_by_file_name(fname)
  script = nil
  begin
    Dir.chdir(Applitools::JS_PATH) do
      script = File.open(File.join('@applitools', 'dom-snapshot', 'dist', "#{fname}.js"), 'r').read
    end
  rescue StandardError => e
    puts e.class
    puts e.message
    script = ''
  end
  script
end