testcentricity 3.0.2 → 3.0.5
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 +26 -0
- data/README.md +1 -0
- data/lib/testcentricity/app_core/appium_connect_helper.rb +1 -0
- data/lib/testcentricity/app_core/screen_section.rb +0 -1
- data/lib/testcentricity/app_elements/alert.rb +64 -0
- data/lib/testcentricity/app_elements/app_element_helper.rb +56 -13
- data/lib/testcentricity/version.rb +1 -1
- metadata +7 -165
- 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 -145
- data/config/locales/en-US.yml +0 -56
- data/config/test_data/LOCAL_data.yml +0 -11
- data/config/test_data/data.yml +0 -10
- data/features/deep_links.feature +0 -26
- data/features/login.feature +0 -30
- data/features/navigation.feature +0 -31
- data/features/step_definitions/generic_steps.rb +0 -72
- data/features/support/android/screens/about_screen.rb +0 -11
- data/features/support/android/screens/base_app_screen.rb +0 -29
- 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/login_screen.rb +0 -18
- data/features/support/android/screens/products_screen.rb +0 -13
- 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/nav_widgets/nav_menu.rb +0 -39
- data/features/support/env.rb +0 -61
- 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 -19
- 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/login_screen.rb +0 -18
- data/features/support/ios/screens/products_screen.rb +0 -13
- 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_cell_item.rb +0 -13
- data/features/support/ios/sections/modals/base_modal.rb +0 -23
- data/features/support/ios/sections/modals/logout_modal.rb +0 -6
- data/features/support/ios/sections/modals/reset_app_state_modal.rb +0 -6
- 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 -31
- 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 -12
- data/features/support/world_pages.rb +0 -26
- 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 -50
@@ -1,12 +0,0 @@
|
|
1
|
-
module WorldData
|
2
|
-
#
|
3
|
-
# data_objects method returns a hash table of your web app's data objects and associated data object classes to be instantiated
|
4
|
-
# by the TestCentricity™ DataManager. Data Object class definitions are contained in the features/support/data folder.
|
5
|
-
#
|
6
|
-
def data_objects
|
7
|
-
{}
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
World(WorldData)
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module WorldPages
|
2
|
-
|
3
|
-
#
|
4
|
-
# The page_objects method returns a hash table of your web or native mobile app's page objects and associated page
|
5
|
-
# classes to be instantiated by the TestCentricity PageManager.
|
6
|
-
#
|
7
|
-
# Web Page Object class definitions are contained in the features/support/web/pages folder.
|
8
|
-
# iOS Screen Object class definitions are contained in the features/support/ios/screens folder.
|
9
|
-
# Android Screen Object class definitions are contained in the features/support/android/screens folder.
|
10
|
-
#
|
11
|
-
def page_objects
|
12
|
-
{
|
13
|
-
base_app_screen: BaseAppScreen,
|
14
|
-
about_screen: AboutScreen,
|
15
|
-
login_screen: LoginScreen,
|
16
|
-
webview_screen: WebViewScreen,
|
17
|
-
products_screen: ProductsScreen,
|
18
|
-
checkout_address_screen: CheckoutAddressScreen,
|
19
|
-
checkout_payment_screen: CheckoutPaymentScreen,
|
20
|
-
saucebot_video_screen: SauceBotScreen
|
21
|
-
}
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
World(WorldPages)
|
data/reports/.keep
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Placeholder file to allow the reports folder to be saved to repository. This folder is required for Jenkins test jobs using the Cucumber Reporting plug-in.
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class TestPage < TestCentricity::PageObject
|
2
|
-
trait(:page_name) { 'Basic Test Page' }
|
3
|
-
trait(:page_url) { '/basic_test_page.html' }
|
4
|
-
trait(:page_locator) { 'form#HTMLFormElements' }
|
5
|
-
|
6
|
-
elements element1: 'div#element1'
|
7
|
-
buttons button1: 'button#button1'
|
8
|
-
textfields field1: 'input#field1'
|
9
|
-
links link1: 'a#link1'
|
10
|
-
ranges range1: 'input#range1'
|
11
|
-
images image1: 'img#image1'
|
12
|
-
radios radio1: 'input#radio1'
|
13
|
-
checkboxes check1: 'input#check1'
|
14
|
-
filefields file1: 'input#file1'
|
15
|
-
labels label1: 'label#label1'
|
16
|
-
tables table1: 'table#table1'
|
17
|
-
selectlists select1: 'select#select1'
|
18
|
-
lists list1: 'ul#list1'
|
19
|
-
videos video1: 'video#video1'
|
20
|
-
audios audio1: 'audio#audio1'
|
21
|
-
sections section1: TestPageSection
|
22
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class TestPageSection < TestCentricity::PageSection
|
2
|
-
trait(:section_locator) { 'div#section' }
|
3
|
-
trait(:section_name) { 'Basic Test Section' }
|
4
|
-
|
5
|
-
elements element1: 'div#element1'
|
6
|
-
buttons button1: 'button#button1'
|
7
|
-
textfields field1: 'input#field1'
|
8
|
-
links link1: 'a#link1'
|
9
|
-
ranges range1: 'input#range1'
|
10
|
-
images image1: 'img#image1'
|
11
|
-
radios radio1: 'input#radio1'
|
12
|
-
checkboxes check1: 'input#check1'
|
13
|
-
filefields file1: 'input#file1'
|
14
|
-
labels label1: 'label#label1'
|
15
|
-
tables table1: 'table#table1'
|
16
|
-
selectlists select1: 'select#select1'
|
17
|
-
lists list1: 'ul#list1'
|
18
|
-
videos video1: 'video#video1'
|
19
|
-
audios audio1: 'audio#audio1'
|
20
|
-
sections section2: TestPageSection
|
21
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class TestScreen < TestCentricity::ScreenObject
|
2
|
-
trait(:page_name) { 'Basic Test Screen' }
|
3
|
-
trait(:page_locator) { { accessibility_id: 'test screen' } }
|
4
|
-
|
5
|
-
elements element1: { accessibility_id: 'element 1' }
|
6
|
-
buttons button1: { accessibility_id: 'button 1' }
|
7
|
-
textfields field1: { accessibility_id: 'text input 1' }
|
8
|
-
checkboxes check1: { accessibility_id: 'checkbox 1' }
|
9
|
-
labels label1: { accessibility_id: 'label 1' }
|
10
|
-
images image1: { accessibility_id: 'image 1' }
|
11
|
-
switches switch1: { accessibility_id: 'switch 1' }
|
12
|
-
lists list1: { accessibility_id: 'list 1' }
|
13
|
-
selectlists selectlist1: { accessibility_id: 'selectlist 1' }
|
14
|
-
alerts alert1: { accessibility_id: 'alert 1' }
|
15
|
-
sections section1: TestScreenSection
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class TestScreenSection < TestCentricity::ScreenSection
|
2
|
-
trait(:section_locator) { { accessibility_id: 'test section' } }
|
3
|
-
trait(:section_name) { 'Basic Test Section' }
|
4
|
-
|
5
|
-
elements element1: { accessibility_id: 'element 1' }
|
6
|
-
buttons button1: { accessibility_id: 'button 1' }
|
7
|
-
textfields field1: { accessibility_id: 'text input 1' }
|
8
|
-
checkboxes check1: { accessibility_id: 'checkbox 1' }
|
9
|
-
labels label1: { accessibility_id: 'label 1' }
|
10
|
-
images image1: { accessibility_id: 'image 1' }
|
11
|
-
switches switch1: { accessibility_id: 'switch 1' }
|
12
|
-
lists list1: { accessibility_id: 'list 1' }
|
13
|
-
selectlists selectlist1: { accessibility_id: 'selectlist 1' }
|
14
|
-
alert :alert1, { accessibility_id: 'alert 1' }
|
15
|
-
sections section2: TestScreenSection
|
16
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'capybara/rspec'
|
4
|
-
require 'require_all'
|
5
|
-
require 'simplecov'
|
6
|
-
require 'testcentricity'
|
7
|
-
require 'testcentricity_web'
|
8
|
-
|
9
|
-
require_rel 'fixtures'
|
10
|
-
|
11
|
-
include TestCentricity
|
12
|
-
|
13
|
-
SimpleCov.command_name("RSpec-#{Time.now.strftime('%Y%m%d%H%M%S')}")
|
14
|
-
|
15
|
-
$LOAD_PATH << './lib'
|
16
|
-
|
17
|
-
# set the default locale and auto load all translations from config/locales/*.rb,yml.
|
18
|
-
ENV['LOCALE'] = 'en-US' unless ENV['LOCALE']
|
19
|
-
I18n.load_path += Dir['config/locales/*.{rb,yml}']
|
20
|
-
I18n.default_locale = 'en-US'
|
21
|
-
I18n.locale = ENV['LOCALE']
|
22
|
-
Faker::Config.locale = ENV['LOCALE']
|
23
|
-
|
24
|
-
# prevent Test::Unit's AutoRunner from executing during RSpec's rake task
|
25
|
-
Test::Unit.run = true if defined?(Test::Unit) && Test::Unit.respond_to?(:run=)
|
26
|
-
|
27
|
-
RSpec.configure do |config|
|
28
|
-
config.mock_with :rspec do |mocks|
|
29
|
-
mocks.allow_message_expectations_on_nil = true
|
30
|
-
mocks.verify_doubled_constant_names = true
|
31
|
-
mocks.verify_partial_doubles = true
|
32
|
-
end
|
33
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe TestCentricity::AppButton, required: true do
|
4
|
-
subject(:test_button) { described_class.new(:test_button, self, { accessibility_id: 'button 1' }, :page) }
|
5
|
-
|
6
|
-
it 'returns class' do
|
7
|
-
expect(test_button.class).to eql TestCentricity::AppButton
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'registers with type button' do
|
11
|
-
expect(test_button.get_object_type).to eql :button
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should click the button' do
|
15
|
-
expect(test_button).to receive(:click)
|
16
|
-
test_button.click
|
17
|
-
end
|
18
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe TestCentricity::AppCheckBox, required: true do
|
4
|
-
subject(:test_check) { described_class.new(:test_check, self, { accessibility_id: 'check 1' }, :page) }
|
5
|
-
|
6
|
-
it 'returns class' do
|
7
|
-
expect(test_check.class).to eql TestCentricity::AppCheckBox
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'registers with type checkbox' do
|
11
|
-
expect(test_check.get_object_type).to eql :checkbox
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should check the checkbox' do
|
15
|
-
expect(test_check).to receive(:check)
|
16
|
-
test_check.check
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should uncheck the checkbox' do
|
20
|
-
expect(test_check).to receive(:uncheck)
|
21
|
-
test_check.uncheck
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should know if checkbox is checked' do
|
25
|
-
allow(test_check).to receive(:checked?).and_return(true)
|
26
|
-
expect(test_check.checked?).to eq(true)
|
27
|
-
end
|
28
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe TestCentricity::AppImage, required: true do
|
4
|
-
subject(:test_image) { described_class.new(:test_image, self, { accessibility_id: 'image 1' }, :page) }
|
5
|
-
|
6
|
-
it 'returns class' do
|
7
|
-
expect(test_image.class).to eql TestCentricity::AppImage
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'registers with type image' do
|
11
|
-
expect(test_image.get_object_type).to eql :image
|
12
|
-
end
|
13
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe TestCentricity::AppLabel, required: true do
|
4
|
-
subject(:test_label) { described_class.new(:test_label, self, { accessibility_id: 'label 1' }, :page) }
|
5
|
-
|
6
|
-
it 'returns class' do
|
7
|
-
expect(test_label.class).to eql TestCentricity::AppLabel
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'registers with type label' do
|
11
|
-
expect(test_label.get_object_type).to eql :label
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'returns caption' do
|
15
|
-
allow(test_label).to receive(:caption).and_return('caption')
|
16
|
-
expect(test_label.caption).to eql 'caption'
|
17
|
-
end
|
18
|
-
end
|
@@ -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
|