-
Notifications
You must be signed in to change notification settings - Fork 0
/
ad_starter_properties.rb
37 lines (34 loc) · 1.67 KB
/
ad_starter_properties.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true
# The data for the elements below are hard coded for this example.
# Usually they'd be parameters in abstract Excel files or a database.
# -------------------------------------------------
# start with global configuration (JS_DRIVER was chrome)
@browser = :headless_chrome
@log_level = 'debug'
@base_url = @test_url
@js_driver = :cuprite
# TODO: read this data from YAML file qa.yml or production.yml
# with method read_yaml(place)
# TODO: place to qa.yml and to production.yml these site-specific lines:
#
# --------target-sandbox.my.com & target.my.com----
@expected_result = 'Target.my.com' # <-- Change this to BREAK the test
@css_of_sign_in_popup = 'body > div.bubble-ts.bubble-ts_my-com > div > div.bubble-ts__content.js-bubble-content > div > div:nth-child(2)'
@xpath_of_currency = '/html/body/div[1]/div[2]/div[1]/div/div[1]/div[1]/div[2]/div/div[2]'
@xpath_traffic_target = '/html/body/div[1]/div[2]/div[1]/div/div[1]/div[2]/div[2]/div/div[1]/div[2]/div/div[3]/div[2]/div/div[2]/div[1]/div/div'
# TODO: use dotenv gem and create .env.qa .env.production files
# TODO: rewrite the code bellow:
#
# Example.
# How to run script with login and password:
# TARG_ENV=qa [email protected] TARG_PWD=12345678 ruby crawler.rb
@env_type = ENV['TARG_ENV'].to_s || 'error' # Set it before run crawler.rb
@env_login = ENV['TARG_LOGIN'] .to_s || 'error' # Set it before run crawler.rb
@env_password = ENV['TARG_PWD'].to_s || 'error' # Set it before run crawler.rb
@targets_file = 'targets.txt'
case @env_type # environments (production & qa/api)
when 'qa'
@test_url = 'https://target-sandbox.my.com/'
when 'production'
@test_url = 'https://target.my.com/'
end