testcentricity 3.0.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/README.md +48 -46
- data/lib/testcentricity/app_core/appium_connect_helper.rb +6 -8
- data/lib/testcentricity/app_core/screen_section.rb +0 -1
- data/lib/testcentricity/app_elements/app_element_helper.rb +14 -4
- data/lib/testcentricity/version.rb +1 -1
- metadata +13 -158
- data/.gitignore +0 -40
- data/.rspec +0 -4
- data/.rubocop.yml +0 -38
- data/.ruby-version +0 -1
- data/.simplecov +0 -9
- data/CODE_OF_CONDUCT.md +0 -13
- data/Gemfile +0 -6
- data/Rakefile +0 -63
- data/config/cucumber.yml +0 -146
- data/config/locales/en-US.yml +0 -56
- data/config/test_data/data.yml +0 -76
- data/features/deep_links.feature +0 -38
- data/features/login.feature +0 -30
- data/features/navigation.feature +0 -43
- data/features/step_definitions/generic_steps.rb +0 -67
- data/features/support/android/screens/about_screen.rb +0 -11
- data/features/support/android/screens/base_app_screen.rb +0 -31
- data/features/support/android/screens/biometrics_screen.rb +0 -17
- data/features/support/android/screens/checkout_address_screen.rb +0 -17
- data/features/support/android/screens/checkout_payment_screen.rb +0 -22
- data/features/support/android/screens/geo_location_screen.rb +0 -28
- data/features/support/android/screens/login_screen.rb +0 -18
- data/features/support/android/screens/product_item_screen.rb +0 -39
- data/features/support/android/screens/products_screen.rb +0 -27
- data/features/support/android/screens/qr_code_scanner_screen.rb +0 -15
- data/features/support/android/screens/saucebot_screen.rb +0 -16
- data/features/support/android/screens/webview_screen.rb +0 -13
- data/features/support/android/sections/list_items/product_list_item.rb +0 -13
- data/features/support/android/sections/nav_widgets/nav_menu.rb +0 -39
- data/features/support/data/product_data.rb +0 -27
- data/features/support/data/user_data.rb +0 -17
- data/features/support/env.rb +0 -62
- data/features/support/hooks.rb +0 -135
- data/features/support/ios/screens/about_screen.rb +0 -11
- data/features/support/ios/screens/base_app_screen.rb +0 -20
- data/features/support/ios/screens/biometrics_screen.rb +0 -17
- data/features/support/ios/screens/checkout_address_screen.rb +0 -17
- data/features/support/ios/screens/checkout_payment_screen.rb +0 -22
- data/features/support/ios/screens/geo_location_screen.rb +0 -32
- data/features/support/ios/screens/login_screen.rb +0 -18
- data/features/support/ios/screens/product_item_screen.rb +0 -39
- data/features/support/ios/screens/products_screen.rb +0 -27
- data/features/support/ios/screens/qr_code_scanner_screen.rb +0 -11
- data/features/support/ios/screens/saucebot_screen.rb +0 -16
- data/features/support/ios/screens/webview_screen.rb +0 -13
- data/features/support/ios/sections/list_items/product_list_item.rb +0 -13
- data/features/support/ios/sections/nav_widgets/nav_bar.rb +0 -31
- data/features/support/ios/sections/nav_widgets/nav_menu.rb +0 -41
- data/features/support/shared_components/screens/base_app_screen.rb +0 -35
- data/features/support/shared_components/screens/checkout_address_screen.rb +0 -17
- data/features/support/shared_components/screens/checkout_payment_screen.rb +0 -22
- data/features/support/shared_components/screens/login_screen.rb +0 -39
- data/features/support/shared_components/screens/saucebot_screen.rb +0 -17
- data/features/support/shared_components/screens/webview_screen.rb +0 -12
- data/features/support/shared_components/sections/nav_menu.rb +0 -58
- data/features/support/world_data.rb +0 -15
- data/features/support/world_pages.rb +0 -30
- data/reports/.keep +0 -1
- data/spec/fixtures/page_object.rb +0 -22
- data/spec/fixtures/page_section_object.rb +0 -21
- data/spec/fixtures/screen_object.rb +0 -16
- data/spec/fixtures/screen_section_object.rb +0 -16
- data/spec/spec_helper.rb +0 -33
- data/spec/testcentricity/elements/button_spec.rb +0 -18
- data/spec/testcentricity/elements/checkbox_spec.rb +0 -28
- data/spec/testcentricity/elements/image_spec.rb +0 -13
- data/spec/testcentricity/elements/label_spec.rb +0 -18
- data/spec/testcentricity/elements/list_spec.rb +0 -13
- data/spec/testcentricity/elements/ui_element_spec.rb +0 -72
- data/spec/testcentricity/mobile/appium_connect_spec.rb +0 -117
- data/spec/testcentricity/mobile/screen_object_spec.rb +0 -63
- data/spec/testcentricity/mobile/screen_section_object_spec.rb +0 -56
- data/spec/testcentricity/version_spec.rb +0 -7
- data/spec/testcentricity/web/browser_spec.rb +0 -41
- data/spec/testcentricity/web/local_webdriver_spec.rb +0 -86
- data/spec/testcentricity/web/mobile_webdriver_spec.rb +0 -123
- data/spec/testcentricity/web/page_object_spec.rb +0 -85
- data/spec/testcentricity/web/page_section_object_spec.rb +0 -72
- data/testcentricity.gemspec +0 -48
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::AppList, required: true do
|
|
4
|
-
subject(:test_list) { described_class.new(:test_list, self, { accessibility_id: 'list 1' }, :page) }
|
|
5
|
-
|
|
6
|
-
it 'returns class' do
|
|
7
|
-
expect(test_list.class).to eql TestCentricity::AppList
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'registers with type list' do
|
|
11
|
-
expect(test_list.get_object_type).to eql :list
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::AppUIElement, required: true do
|
|
4
|
-
subject(:test_element) { described_class.new(:test_element, self, { accessibility_id: 'element 1' }, :page) }
|
|
5
|
-
|
|
6
|
-
it 'returns class' do
|
|
7
|
-
expect(test_element.class).to eql described_class
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'returns name' do
|
|
11
|
-
expect(test_element.get_name).to eql :test_element
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'returns locator' do
|
|
15
|
-
expect(test_element.get_locator).to eql({ accessibility_id: 'element 1'})
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'should click the element' do
|
|
19
|
-
allow(test_element).to receive(:click)
|
|
20
|
-
test_element.click
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it 'should tap the element' do
|
|
24
|
-
allow(test_element).to receive(:tap)
|
|
25
|
-
test_element.tap
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'should double tap the element' do
|
|
29
|
-
allow(test_element).to receive(:double_tap)
|
|
30
|
-
test_element.double_tap
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it 'should know if element is visible' do
|
|
34
|
-
allow(test_element).to receive(:visible?).and_return(false)
|
|
35
|
-
expect(test_element.visible?).to eq(false)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'should know if element is hidden' do
|
|
39
|
-
allow(test_element).to receive(:hidden?).and_return(true)
|
|
40
|
-
expect(test_element.hidden?).to eq(true)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it 'should know if element exists' do
|
|
44
|
-
allow(test_element).to receive(:exists?).and_return(true)
|
|
45
|
-
expect(test_element.exists?).to be true
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it 'should know if element is enabled' do
|
|
49
|
-
allow(test_element).to receive(:enabled?).and_return(true)
|
|
50
|
-
expect(test_element.enabled?).to eq(true)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'should know if element is disabled' do
|
|
54
|
-
allow(test_element).to receive(:disabled?).and_return(true)
|
|
55
|
-
expect(test_element.disabled?).to eq(true)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it 'should know if element is selected' do
|
|
59
|
-
allow(test_element).to receive(:selected?).and_return(true)
|
|
60
|
-
expect(test_element.selected?).to eq(true)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it 'returns value' do
|
|
64
|
-
allow(test_element).to receive(:value).and_return('value')
|
|
65
|
-
expect(test_element.value).to eql 'value'
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it 'should send keys' do
|
|
69
|
-
allow(test_element).to receive(:send_keys).with('foo bar')
|
|
70
|
-
test_element.send_keys('foo bar')
|
|
71
|
-
end
|
|
72
|
-
end
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::AppiumConnect, required: true do
|
|
4
|
-
before(:context) do
|
|
5
|
-
# instantiate local test environment
|
|
6
|
-
@environs ||= EnvironData
|
|
7
|
-
@environs.find_environ('LOCAL', :yaml)
|
|
8
|
-
ENV['SELENIUM'] = ''
|
|
9
|
-
ENV['WEB_BROWSER'] = 'appium'
|
|
10
|
-
ENV['DEVICE_TYPE'] = 'phone'
|
|
11
|
-
ENV['LOCALE'] = 'en-US'
|
|
12
|
-
ENV['LANGUAGE'] = 'en'
|
|
13
|
-
# start Appium server
|
|
14
|
-
$server = TestCentricity::AppiumServer.new
|
|
15
|
-
$server.start
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context 'Mobile device simulator' do
|
|
19
|
-
it 'connects to iOS Simulator using environment variables' do
|
|
20
|
-
ENV['AUTOMATION_ENGINE'] = 'XCUITest'
|
|
21
|
-
ENV['APP_PLATFORM_NAME'] = 'ios'
|
|
22
|
-
ENV['APP_VERSION'] = '15.4'
|
|
23
|
-
ENV['APP_DEVICE'] = 'iPhone 13 Pro Max'
|
|
24
|
-
ENV['APP'] = Environ.current.ios_app_path
|
|
25
|
-
AppiumConnect.initialize_appium
|
|
26
|
-
AppiumConnect.start_driver
|
|
27
|
-
expect(Environ.browser).to eq(:appium)
|
|
28
|
-
expect(Environ.platform).to eq(:mobile)
|
|
29
|
-
expect(Environ.driver).to eq(:appium)
|
|
30
|
-
expect(Environ.device).to eq(:simulator)
|
|
31
|
-
expect(Environ.device_name).to eq('iPhone 13 Pro Max')
|
|
32
|
-
expect(Environ.device_os).to eq(:ios)
|
|
33
|
-
expect(Environ.device_type).to eq(:phone)
|
|
34
|
-
expect(Environ.device_os_version).to eq('15.4')
|
|
35
|
-
expect(Environ.is_ios?).to eq(true)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'connects to iOS Simulator using desired_capabilities hash' do
|
|
39
|
-
ENV['APP_PLATFORM_NAME'] = 'ios'
|
|
40
|
-
ENV['APP_VERSION'] = '15.4'
|
|
41
|
-
ENV['APP_DEVICE'] = 'iPhone 13 Pro Max'
|
|
42
|
-
|
|
43
|
-
capabilities = {
|
|
44
|
-
platformName: 'ios',
|
|
45
|
-
platformVersion: '15.4',
|
|
46
|
-
deviceName: 'iPhone 13 Pro Max',
|
|
47
|
-
automationName: 'XCUITest',
|
|
48
|
-
app: Environ.current.ios_app_path
|
|
49
|
-
}
|
|
50
|
-
AppiumConnect.initialize_appium(capabilities)
|
|
51
|
-
AppiumConnect.start_driver
|
|
52
|
-
expect(Environ.browser).to eq(:appium)
|
|
53
|
-
expect(Environ.platform).to eq(:mobile)
|
|
54
|
-
expect(Environ.driver).to eq(:appium)
|
|
55
|
-
expect(Environ.device).to eq(:simulator)
|
|
56
|
-
expect(Environ.device_name).to eq('iPhone 13 Pro Max')
|
|
57
|
-
expect(Environ.device_os).to eq(:ios)
|
|
58
|
-
expect(Environ.device_type).to eq(:phone)
|
|
59
|
-
expect(Environ.device_os_version).to eq('15.4')
|
|
60
|
-
expect(Environ.is_ios?).to eq(true)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it 'connects to Android Simulator using environment variables' do
|
|
64
|
-
ENV['AUTOMATION_ENGINE'] = 'UiAutomator2'
|
|
65
|
-
ENV['APP_PLATFORM_NAME'] = 'Android'
|
|
66
|
-
ENV['APP_VERSION'] = '12.0'
|
|
67
|
-
ENV['APP_DEVICE'] = 'Pixel_5_API_31'
|
|
68
|
-
ENV['APP'] = Environ.current.android_apk_path
|
|
69
|
-
AppiumConnect.initialize_appium
|
|
70
|
-
AppiumConnect.start_driver
|
|
71
|
-
expect(Environ.browser).to eq(:appium)
|
|
72
|
-
expect(Environ.platform).to eq(:mobile)
|
|
73
|
-
expect(Environ.driver).to eq(:appium)
|
|
74
|
-
expect(Environ.device).to eq(:simulator)
|
|
75
|
-
expect(Environ.device_name).to eq('Pixel_5_API_31')
|
|
76
|
-
expect(Environ.device_os).to eq(:android)
|
|
77
|
-
expect(Environ.device_type).to eq(:phone)
|
|
78
|
-
expect(Environ.device_os_version).to eq('12.0')
|
|
79
|
-
expect(Environ.is_android?).to eq(true)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it 'connects to Android Simulator using desired_capabilities hash' do
|
|
83
|
-
ENV['APP_PLATFORM_NAME'] = 'Android'
|
|
84
|
-
ENV['APP_VERSION'] = '12.0'
|
|
85
|
-
ENV['APP_DEVICE'] = 'Pixel_5_API_31'
|
|
86
|
-
|
|
87
|
-
capabilities = {
|
|
88
|
-
platformName: 'Android',
|
|
89
|
-
platformVersion: '12.0',
|
|
90
|
-
deviceName: 'Pixel_5_API_31',
|
|
91
|
-
automationName: 'UiAutomator2',
|
|
92
|
-
avd: 'Pixel_5_API_31',
|
|
93
|
-
app: Environ.current.android_apk_path
|
|
94
|
-
}
|
|
95
|
-
AppiumConnect.initialize_appium(capabilities)
|
|
96
|
-
AppiumConnect.start_driver
|
|
97
|
-
expect(Environ.browser).to eq(:appium)
|
|
98
|
-
expect(Environ.platform).to eq(:mobile)
|
|
99
|
-
expect(Environ.driver).to eq(:appium)
|
|
100
|
-
expect(Environ.device).to eq(:simulator)
|
|
101
|
-
expect(Environ.device_name).to eq('Pixel_5_API_31')
|
|
102
|
-
expect(Environ.device_os).to eq(:android)
|
|
103
|
-
expect(Environ.device_type).to eq(:phone)
|
|
104
|
-
expect(Environ.device_os_version).to eq('12.0')
|
|
105
|
-
expect(Environ.is_android?).to eq(true)
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
after(:each) do
|
|
110
|
-
AppiumConnect.quit_driver
|
|
111
|
-
Environ.session_state = :quit
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
after(:context) do
|
|
115
|
-
$server.stop if Environ.driver == :appium && $server.running?
|
|
116
|
-
end
|
|
117
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::ScreenObject, required: true do
|
|
4
|
-
before :context do
|
|
5
|
-
@test_screen = TestScreen.new
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
context 'screen object traits' do
|
|
9
|
-
it 'returns page name' do
|
|
10
|
-
expect(@test_screen.page_name).to eq('Basic Test Screen')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it 'returns page locator' do
|
|
14
|
-
expect(@test_screen.page_locator).to eq({ accessibility_id: 'test screen' })
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'responds to open_portal' do
|
|
18
|
-
expect(@test_screen).to respond_to(:open_portal)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'responds to load_page' do
|
|
22
|
-
expect(@test_screen).to respond_to(:load_page)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'responds to verify_page_exists' do
|
|
26
|
-
expect(@test_screen).to respond_to(:verify_page_exists)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it 'responds to exists?' do
|
|
30
|
-
expect(@test_screen).to respond_to(:exists?)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context 'page object with UI elements' do
|
|
35
|
-
it 'responds to element' do
|
|
36
|
-
expect(@test_screen).to respond_to(:element1)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it 'responds to button' do
|
|
40
|
-
expect(@test_screen).to respond_to(:button1)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it 'responds to textfield' do
|
|
44
|
-
expect(@test_screen).to respond_to(:field1)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it 'responds to image' do
|
|
48
|
-
expect(@test_screen).to respond_to(:image1)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
it 'responds to switch' do
|
|
52
|
-
expect(@test_screen).to respond_to(:switch1)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
it 'responds to checkbox' do
|
|
56
|
-
expect(@test_screen).to respond_to(:check1)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it 'responds to section' do
|
|
60
|
-
expect(@test_screen).to respond_to(:section1)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::ScreenSection, required: true do
|
|
4
|
-
before :context do
|
|
5
|
-
@test_page = TestScreen.new
|
|
6
|
-
@test_section = @test_page.section1
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
context 'section object traits' do
|
|
10
|
-
it 'returns section name' do
|
|
11
|
-
expect(@test_section.section_name).to eq('Basic Test Section')
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'returns section locator' do
|
|
15
|
-
expect(@test_section.get_locator).to eq([{ accessibility_id: 'test section' }])
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'returns class' do
|
|
19
|
-
expect(@test_section.class).to eql TestScreenSection
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'registers with type section' do
|
|
23
|
-
expect(@test_section.get_object_type).to eql :section
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
context 'section object with UI elements' do
|
|
28
|
-
it 'responds to element' do
|
|
29
|
-
expect(@test_section).to respond_to(:element1)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'responds to button' do
|
|
33
|
-
expect(@test_section).to respond_to(:button1)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it 'responds to textfield' do
|
|
37
|
-
expect(@test_section).to respond_to(:field1)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'responds to image' do
|
|
41
|
-
expect(@test_section).to respond_to(:image1)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it 'responds to switch' do
|
|
45
|
-
expect(@test_section).to respond_to(:switch1)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it 'responds to checkbox' do
|
|
49
|
-
expect(@test_section).to respond_to(:check1)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'responds to section' do
|
|
53
|
-
expect(@test_section).to respond_to(:section2)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::Browsers, web: true do
|
|
4
|
-
before(:context) do
|
|
5
|
-
# instantiate local test environment
|
|
6
|
-
@environs ||= EnvironData
|
|
7
|
-
@environs.find_environ('LOCAL', :yaml)
|
|
8
|
-
ENV['WEB_BROWSER'] = 'chrome_headless'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
context 'web browser with multiple tabs/windows' do
|
|
12
|
-
it 'returns number of browser windows/tabs' do
|
|
13
|
-
WebDriverConnect.initialize_web_driver
|
|
14
|
-
Capybara.current_session.open_new_window
|
|
15
|
-
Capybara.current_session.open_new_window
|
|
16
|
-
expect(Browsers.num_browser_instances).to eql 3
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it 'closes original browser instance' do
|
|
20
|
-
WebDriverConnect.initialize_web_driver
|
|
21
|
-
Capybara.current_session.open_new_window
|
|
22
|
-
Browsers.close_old_browser_instance
|
|
23
|
-
expect(Browsers.num_browser_instances).to eql 1
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it 'closes current browser instance' do
|
|
27
|
-
WebDriverConnect.initialize_web_driver
|
|
28
|
-
Capybara.current_session.open_new_window
|
|
29
|
-
Browsers.switch_to_new_browser_instance
|
|
30
|
-
Capybara.current_session.open_new_window
|
|
31
|
-
Browsers.close_current_browser_instance
|
|
32
|
-
expect(Browsers.num_browser_instances).to eql 2
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
after(:each) do
|
|
37
|
-
Browsers.close_all_browser_instances
|
|
38
|
-
Capybara.current_session.quit
|
|
39
|
-
Environ.session_state = :quit
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::WebDriverConnect, web: true do
|
|
4
|
-
before(:context) do
|
|
5
|
-
# instantiate local test environment
|
|
6
|
-
@environs ||= EnvironData
|
|
7
|
-
@environs.find_environ('LOCAL', :yaml)
|
|
8
|
-
ENV['SELENIUM'] = ''
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
context 'local web browser instances' do
|
|
12
|
-
it 'connects to a local Firefox browser' do
|
|
13
|
-
ENV['WEB_BROWSER'] = 'firefox'
|
|
14
|
-
WebDriverConnect.initialize_web_driver
|
|
15
|
-
verify_local_browser(browser = :firefox, platform = :desktop, headless = false)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'connects to a local Safari browser' do
|
|
19
|
-
ENV['WEB_BROWSER'] = 'safari'
|
|
20
|
-
WebDriverConnect.initialize_web_driver
|
|
21
|
-
verify_local_browser(browser = :safari, platform = :desktop, headless = false)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it 'connects to a local Chrome browser' do
|
|
25
|
-
ENV['WEB_BROWSER'] = 'chrome'
|
|
26
|
-
WebDriverConnect.initialize_web_driver
|
|
27
|
-
Browsers.suppress_js_leave_page_modal
|
|
28
|
-
verify_local_browser(browser = :chrome, platform = :desktop, headless = false)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'connects to a local Edge browser' do
|
|
32
|
-
ENV['WEB_BROWSER'] = 'edge'
|
|
33
|
-
WebDriverConnect.initialize_web_driver
|
|
34
|
-
Browsers.suppress_js_alerts
|
|
35
|
-
verify_local_browser(browser = :edge, platform = :desktop, headless = false)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'connects to a local emulated mobile web browser' do
|
|
39
|
-
ENV['WEB_BROWSER'] = 'ipad_pro_12_9'
|
|
40
|
-
ENV['HOST_BROWSER'] = 'chrome'
|
|
41
|
-
ENV['ORIENTATION'] = 'portrait'
|
|
42
|
-
WebDriverConnect.initialize_web_driver
|
|
43
|
-
Browsers.set_device_orientation('landscape')
|
|
44
|
-
verify_local_browser(browser = :ipad_pro_12_9, platform = :mobile, headless = false)
|
|
45
|
-
expect(Environ.browser_size).to eq([1366, 1024])
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
context 'local headless browser instances' do
|
|
50
|
-
it 'connects to a local headless Chrome browser' do
|
|
51
|
-
ENV['WEB_BROWSER'] = 'chrome_headless'
|
|
52
|
-
WebDriverConnect.initialize_web_driver
|
|
53
|
-
Browsers.maximize_browser
|
|
54
|
-
verify_local_browser(browser = :chrome_headless, platform = :desktop, headless = true)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it 'connects to a local headless Edge browser' do
|
|
58
|
-
ENV['WEB_BROWSER'] = 'edge_headless'
|
|
59
|
-
WebDriverConnect.initialize_web_driver
|
|
60
|
-
Browsers.refresh_browser
|
|
61
|
-
verify_local_browser(browser = :edge_headless, platform = :desktop, headless = true)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it 'connects to a local headless Firefox browser' do
|
|
65
|
-
ENV['WEB_BROWSER'] = 'firefox_headless'
|
|
66
|
-
WebDriverConnect.initialize_web_driver
|
|
67
|
-
Browsers.delete_all_cookies
|
|
68
|
-
verify_local_browser(browser = :firefox_headless, platform = :desktop, headless = true)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
after(:each) do
|
|
73
|
-
Capybara.current_session.quit
|
|
74
|
-
Environ.session_state = :quit
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def verify_local_browser(browser, platform, headless)
|
|
78
|
-
expect(Environ.browser).to eq(browser)
|
|
79
|
-
expect(Environ.platform).to eq(platform)
|
|
80
|
-
expect(Environ.headless).to eq(headless)
|
|
81
|
-
expect(Environ.session_state).to eq(:running)
|
|
82
|
-
expect(Environ.driver).to eq(:webdriver)
|
|
83
|
-
expect(Environ.device).to eq(:web)
|
|
84
|
-
expect(Environ.is_web?).to eq(true)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::WebDriverConnect, web: true do
|
|
4
|
-
before(:context) do
|
|
5
|
-
# instantiate local test environment
|
|
6
|
-
@environs ||= EnvironData
|
|
7
|
-
@environs.find_environ('LOCAL', :yaml)
|
|
8
|
-
ENV['SELENIUM'] = ''
|
|
9
|
-
ENV['WEB_BROWSER'] = 'appium'
|
|
10
|
-
ENV['DEVICE_TYPE'] = 'tablet'
|
|
11
|
-
# start Appium server
|
|
12
|
-
$server = TestCentricity::AppiumServer.new
|
|
13
|
-
$server.start
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context 'Mobile device simulator' do
|
|
17
|
-
it 'connects to iOS Simulator - environment variables' do
|
|
18
|
-
ENV['AUTOMATION_ENGINE'] = 'XCUITest'
|
|
19
|
-
ENV['APP_PLATFORM_NAME'] = 'ios'
|
|
20
|
-
ENV['APP_BROWSER'] = 'Safari'
|
|
21
|
-
ENV['APP_VERSION'] = '15.4'
|
|
22
|
-
ENV['APP_DEVICE'] = 'iPad Pro (12.9-inch) (5th generation)'
|
|
23
|
-
WebDriverConnect.initialize_web_driver
|
|
24
|
-
expect(Environ.browser).to eq(:appium)
|
|
25
|
-
expect(Environ.platform).to eq(:mobile)
|
|
26
|
-
expect(Environ.headless).to eq(false)
|
|
27
|
-
expect(Environ.session_state).to eq(:running)
|
|
28
|
-
expect(Environ.driver).to eq(:appium)
|
|
29
|
-
expect(Environ.device).to eq(:simulator)
|
|
30
|
-
expect(Environ.device_name).to eq('iPad Pro (12.9-inch) (5th generation)')
|
|
31
|
-
expect(Environ.device_os).to eq(:ios)
|
|
32
|
-
expect(Environ.device_type).to eq(:tablet)
|
|
33
|
-
expect(Environ.device_os_version).to eq('15.4')
|
|
34
|
-
expect(Environ.is_ios?).to eq(true)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it 'connects to iOS Simulator - desired_capabilities hash' do
|
|
38
|
-
ENV['APP_PLATFORM_NAME'] = 'ios'
|
|
39
|
-
ENV['APP_BROWSER'] = 'Safari'
|
|
40
|
-
ENV['APP_VERSION'] = '15.4'
|
|
41
|
-
ENV['APP_DEVICE'] = 'iPad Pro (12.9-inch) (5th generation)'
|
|
42
|
-
|
|
43
|
-
caps = {
|
|
44
|
-
desired_capabilities: {
|
|
45
|
-
platformName: 'ios',
|
|
46
|
-
platformVersion: '15.4',
|
|
47
|
-
browserName: 'Safari',
|
|
48
|
-
deviceName: 'iPad Pro (12.9-inch) (5th generation)',
|
|
49
|
-
automationName: 'XCUITest'
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
WebDriverConnect.initialize_web_driver(caps)
|
|
53
|
-
expect(Environ.browser).to eq(:appium)
|
|
54
|
-
expect(Environ.platform).to eq(:mobile)
|
|
55
|
-
expect(Environ.headless).to eq(false)
|
|
56
|
-
expect(Environ.session_state).to eq(:running)
|
|
57
|
-
expect(Environ.driver).to eq(:appium)
|
|
58
|
-
expect(Environ.device).to eq(:simulator)
|
|
59
|
-
expect(Environ.device_name).to eq('iPad Pro (12.9-inch) (5th generation)')
|
|
60
|
-
expect(Environ.device_os).to eq(:ios)
|
|
61
|
-
expect(Environ.device_type).to eq(:tablet)
|
|
62
|
-
expect(Environ.device_os_version).to eq('15.4')
|
|
63
|
-
expect(Environ.is_ios?).to eq(true)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it 'connects to Android Simulator - environment variables' do
|
|
67
|
-
ENV['APP_PLATFORM_NAME'] = 'Android'
|
|
68
|
-
ENV['APP_BROWSER'] = 'Chrome'
|
|
69
|
-
ENV['APP_VERSION'] = '12.0'
|
|
70
|
-
ENV['APP_DEVICE'] = 'Pixel_C_API_31'
|
|
71
|
-
WebDriverConnect.initialize_web_driver
|
|
72
|
-
expect(Environ.browser).to eq(:appium)
|
|
73
|
-
expect(Environ.platform).to eq(:mobile)
|
|
74
|
-
expect(Environ.headless).to eq(false)
|
|
75
|
-
expect(Environ.session_state).to eq(:running)
|
|
76
|
-
expect(Environ.driver).to eq(:appium)
|
|
77
|
-
expect(Environ.device).to eq(:simulator)
|
|
78
|
-
expect(Environ.device_name).to eq('Pixel_C_API_31')
|
|
79
|
-
expect(Environ.device_os).to eq(:android)
|
|
80
|
-
expect(Environ.device_type).to eq(:tablet)
|
|
81
|
-
expect(Environ.device_os_version).to eq('12.0')
|
|
82
|
-
expect(Environ.is_android?).to eq(true)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it 'connects to Android Simulator - desired_capabilities hash' do
|
|
86
|
-
ENV['APP_PLATFORM_NAME'] = 'Android'
|
|
87
|
-
ENV['APP_BROWSER'] = 'Chrome'
|
|
88
|
-
ENV['APP_VERSION'] = '12.0'
|
|
89
|
-
ENV['APP_DEVICE'] = 'Pixel_C_API_31'
|
|
90
|
-
|
|
91
|
-
caps = {
|
|
92
|
-
desired_capabilities: {
|
|
93
|
-
platformName: 'Android',
|
|
94
|
-
platformVersion: '12.0',
|
|
95
|
-
browserName: 'Chrome',
|
|
96
|
-
deviceName: 'Pixel_C_API_31',
|
|
97
|
-
automationName: 'Android'
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
WebDriverConnect.initialize_web_driver(caps)
|
|
101
|
-
expect(Environ.browser).to eq(:appium)
|
|
102
|
-
expect(Environ.platform).to eq(:mobile)
|
|
103
|
-
expect(Environ.headless).to eq(false)
|
|
104
|
-
expect(Environ.session_state).to eq(:running)
|
|
105
|
-
expect(Environ.driver).to eq(:appium)
|
|
106
|
-
expect(Environ.device).to eq(:simulator)
|
|
107
|
-
expect(Environ.device_name).to eq('Pixel_C_API_31')
|
|
108
|
-
expect(Environ.device_os).to eq(:android)
|
|
109
|
-
expect(Environ.device_type).to eq(:tablet)
|
|
110
|
-
expect(Environ.device_os_version).to eq('12.0')
|
|
111
|
-
expect(Environ.is_android?).to eq(true)
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
after(:each) do
|
|
116
|
-
Capybara.current_session.quit
|
|
117
|
-
Environ.session_state = :quit
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
after(:context) do
|
|
121
|
-
$server.stop if Environ.driver == :appium && $server.running?
|
|
122
|
-
end
|
|
123
|
-
end
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe TestCentricity::PageObject, web: true do
|
|
4
|
-
before :context do
|
|
5
|
-
@test_page = TestPage.new
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
context 'page object traits' do
|
|
9
|
-
it 'returns page name' do
|
|
10
|
-
expect(@test_page.page_name).to eq('Basic Test Page')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it 'returns page url' do
|
|
14
|
-
expect(@test_page.page_url).to eq('/basic_test_page.html')
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'returns page locator' do
|
|
18
|
-
expect(@test_page.page_locator).to eq('form#HTMLFormElements')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'determines if page is secure' do
|
|
22
|
-
allow(@test_page).to receive(:secure?).and_return(false)
|
|
23
|
-
expect(@test_page.secure?).to eq(false)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it 'should display the title of the page' do
|
|
27
|
-
allow(@test_page).to receive(:title).and_return('I am the title of a page')
|
|
28
|
-
expect(@test_page.title).to eql 'I am the title of a page'
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'responds to open_portal' do
|
|
32
|
-
expect(@test_page).to respond_to(:open_portal)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'responds to load_page' do
|
|
36
|
-
expect(@test_page).to respond_to(:load_page)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it 'responds to verify_page_exists' do
|
|
40
|
-
expect(@test_page).to respond_to(:verify_page_exists)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it 'responds to exists?' do
|
|
44
|
-
expect(@test_page).to respond_to(:exists?)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
context 'page object with UI elements' do
|
|
49
|
-
it 'responds to element' do
|
|
50
|
-
expect(@test_page).to respond_to(:element1)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'responds to button' do
|
|
54
|
-
expect(@test_page).to respond_to(:button1)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it 'responds to textfield' do
|
|
58
|
-
expect(@test_page).to respond_to(:field1)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it 'responds to link' do
|
|
62
|
-
expect(@test_page).to respond_to(:link1)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it 'responds to range' do
|
|
66
|
-
expect(@test_page).to respond_to(:range1)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
it 'responds to image' do
|
|
70
|
-
expect(@test_page).to respond_to(:image1)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it 'responds to radio' do
|
|
74
|
-
expect(@test_page).to respond_to(:radio1)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it 'responds to checkbox' do
|
|
78
|
-
expect(@test_page).to respond_to(:check1)
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
it 'responds to section' do
|
|
82
|
-
expect(@test_page).to respond_to(:section1)
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|