How to use app_uri method of Howitzer Package

Best Howitzer_ruby code snippet using Howitzer.app_uri

howitzer_spec.rb

Source:howitzer_spec.rb Github

copy

Full Screen

...5 subject { SexySettings.configuration }6 it { expect(subject.path_to_custom_settings).to include('config/custom.yml') }7 it { expect(subject.path_to_default_settings).to include('config/default.yml') }8 end9 describe '.app_uri' do10 before do11 allow(Howitzer).to receive(:app_base_auth_login) { app_base_auth_login_setting }12 allow(Howitzer).to receive(:app_base_auth_pass) { app_base_auth_pass_setting }13 allow(Howitzer).to receive(:app_protocol) { app_protocol_setting }14 allow(Howitzer).to receive(:app_host) { app_host_setting }15 end16 let(:app_protocol_setting) { nil }17 let(:app_host_setting) { 'redmine.strongqa.com' }18 context 'when login and password present' do19 let(:app_base_auth_login_setting) { 'alex' }20 let(:app_base_auth_pass_setting) { 'pa$$w0rd' }21 it { expect(Howitzer.app_uri.site).to eq('http://alex:pa$$w0rd@redmine.strongqa.com') }22 it { expect(Howitzer.app_uri.origin).to eq('http://redmine.strongqa.com') }23 end24 context 'when login and password blank' do25 let(:app_base_auth_login_setting) { nil }26 let(:app_base_auth_pass_setting) { nil }27 it { expect(Howitzer.app_uri.site).to eq('http://redmine.strongqa.com') }28 end29 context 'when custom host exist' do30 before do31 allow(Howitzer).to receive(:test_app_base_auth_login) { app_base_auth_login_setting }32 allow(Howitzer).to receive(:test_app_base_auth_pass) { app_base_auth_pass_setting }33 allow(Howitzer).to receive(:test_app_protocol) { app_protocol_setting }34 allow(Howitzer).to receive(:test_app_host) { app_host_setting }35 end36 let(:app_host_setting) { 'test.strongqa.com' }37 let(:app_protocol_setting) { nil }38 context 'when login and password present' do39 let(:app_base_auth_login_setting) { 'user' }40 let(:app_base_auth_pass_setting) { 'password' }41 it { expect(Howitzer.app_uri(:test).site).to eq('http://user:password@test.strongqa.com') }42 end43 context 'when login and password blank' do44 let(:app_base_auth_login_setting) { nil }45 let(:app_base_auth_pass_setting) { nil }46 it { expect(Howitzer.app_uri(:test).site).to eq('http://test.strongqa.com') }47 end48 end49 context 'when configuration settings are not specified for particular application' do50 it do51 expect { Howitzer.app_uri(:test).site }.to raise_error(52 Howitzer::UndefinedSexySettingError,53 "Undefined 'test_app_base_auth_login' setting. Please add the setting to config/default.yml:\n " \54 "test_app_base_auth_login: some_value\n"55 )56 end57 end58 end59 describe '.mailgun_idle_timeout' do60 subject { Howitzer.mailgun_idle_timeout }61 before do62 expect_any_instance_of(Object).to receive(:puts).with(63 "WARNING! 'mailgun_idle_timeout' setting is deprecated. Please replace with 'mail_wait_time' setting."64 )65 end...

Full Screen

Full Screen

howitzer.rb

Source:howitzer.rb Github

copy

Full Screen

...62 #63 # @param name [Symbol, String] an application name from framework settings64 #65 # @example returns default application url with auth66 # app_uri.site67 # @example returns example application url with auth68 # app_uri(:example).site69 # @example returns default application url without auth70 # app_uri.origin71 def self.app_uri(name = nil)72 prefix = "#{name}_" if name.present?73 ::Addressable::URI.new(74 user: Howitzer.sexy_setting!("#{prefix}app_base_auth_login"),75 password: Howitzer.sexy_setting!("#{prefix}app_base_auth_pass"),76 host: Howitzer.sexy_setting!("#{prefix}app_host"),77 scheme: Howitzer.sexy_setting!("#{prefix}app_protocol") || 'http'78 )79 end80 # @return an setting value or raise error81 #82 # @param name [Symbol, String] an setting name83 # @raise [Howitzer::UndefinedSexySettingError] when the setting is not specified84 def self.sexy_setting!(name)85 return Howitzer.public_send(name) if Howitzer.respond_to?(name)...

Full Screen

Full Screen

app_base_page.rb

Source:app_base_page.rb Github

copy

Full Screen

...9 section :dataset10 element :portal_status, '.portal-status'11 element :loading, '.ui-loading'12 def visit_entity(name)13 visit "#{Howitzer.app_uri}/portal/#{name}/visitor_analytics"14 end15 def visit_entity_control_panel(entity_name)16 visit "#{Howitzer.app_uri}/controlpanel#/#{entity_name}/manage/settings"17 end18 def waiting_on(seconds = 30)19 Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }20 end21 def scroll_to(element)22 script = 'arguments[0].scrollIntoView(true);'23 Capybara.current_session.driver.browser.execute_script(script, element.native)24 end25end...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful