app_prism 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 592b0847efe68ed50816e27f22b095c627830dbba7321a85a9d88bc14a29cba7
4
- data.tar.gz: 264173d456563fad75ed58c72be58973a4561ba1ade9d5445de3697a7ad159e3
3
+ metadata.gz: bbc07056fa8b243c870129b1ca1a2dd71d0553164201109da9516e09557be520
4
+ data.tar.gz: d8ea6545b6e013187cd24d9cc3e043a228699521f600efb959b963736732b627
5
5
  SHA512:
6
- metadata.gz: 885cf6ef92a6428a4f437b820a0c8b1095eab689bd1f174f51ad9ce6cde5832d9f4a5d496f31be340fc7b634fda2422d84c04e1d2baa3ec0f6647ebff0340208
7
- data.tar.gz: 06bbe90c27cc77726bdceaf30ed147830368e82a7fc2b3ac8ccc4c0d1853c9c9ef2c0b3cbb6973a666fec27a1777faa5218d390f3ac12baca1a99e306524eb30
6
+ metadata.gz: f4842cff7e7f6cb99ba0499b28fb825200e1b58e4bdafdc167bcaf8b1c7baa8a22f54629e73bdf7eb095001f058a4008a7742c31731b14f288362af7be8589b9
7
+ data.tar.gz: f26422d4596c7698148fa95bcae0fca214c2104b53fd218a93f856420e1a7496ca763dcb1873124ff694ebdd86963e18f669f1f137c98656c0604da1672f1e07
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.1
1
+ 2.6.3
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # AppPrsim
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/app_prism`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![CircleCI](https://circleci.com/gh/bazarnyi/app_prism.svg?style=svg&circle-token=0a76b7197e2a4894e8958548cb5203077a117e38)](https://circleci.com/gh/bazarnyi/app_prism)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ _A Multi-platform Page Object Model DSL for Appium_
6
6
 
7
7
  ## Installation
8
8
 
@@ -14,7 +14,7 @@ gem 'app_prism'
14
14
 
15
15
  And then execute:
16
16
 
17
- $ bundle
17
+ $ bundle install
18
18
 
19
19
  Or install it yourself as:
20
20
 
@@ -22,17 +22,73 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ Here's an overview of how SitePrism is designed to be used:
26
26
 
27
- ## Development
27
+ ```ruby
28
+ # define your app screens
29
+
30
+ class BaseScreen
31
+ include AppPrism
32
+
33
+ element :app_icon, android: { id: 'ViewActivityIntro_AppLogo' },
34
+ ios: { xpath: '//XCUIElementTypeIcon[@name="some name here"]' }
35
+
36
+ element :notification, android: { accessibility_id: 'NotificationShortLookView' },
37
+ ios: { accessibility_id: 'NotificationShortLookView' }
38
+
39
+ element :toolbar_done, android: { xpath: '//android.widget.LinearLayout[@content-desc="ViewActivityIntro_Toolbar"]/android.widget.TextView' },
40
+ ios: { xpath: '//XCUIElementTypeToolbar[@name="Toolbar"]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeButton[@name="DONE" or @name="Done"]' }
41
+
42
+ def wheelpicker
43
+ @driver.find_elements(:class_name, 'XCUIElementTypePickerWheel').first
44
+ end
45
+ end
46
+
47
+ class LogInScreen < BaseScreen
48
+ element :log_in_button, android: { id: 'ButtonRoundCorner_CustomImageView_Icon' },
49
+ ios: { accessibility_id: 'LOG IN' }
50
+ end
28
51
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
52
+ # define sections used on multiple screens or multiple times on one screen
30
53
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
54
+ class ScreenDialog < AppPrism::Sections::ScreenSection
55
+ element :title, android: { id: 'title' },
56
+ ios: { xpath: '//XCUIElementTypeStaticText[@name="Skip account"]' }
57
+
58
+ element :yes, android: { id: 'FragmentTwoButtonAlertDialog_Button_Positive' },
59
+ ios: { accessibility_id: 'Yes' }
60
+
61
+ element :no, android: { id: 'FragmentTwoButtonAlertDialog_Button_Negative' },
62
+ ios: { accessibility_id: 'No' }
63
+ end
64
+
65
+ # Basic usage in tests are very similar to usage of Site Prism gem for Web UI test automation
66
+ # the only difference is that page factory approach is used to better manage screens interractions
67
+
68
+ Given(/^I launch the app$/) do
69
+ if ios?
70
+ accept_ios_notification
71
+ else
72
+ wait_while_app_is_loading
73
+ end
74
+ end
75
+
76
+ Given(/^I swipe demo screens to the Sign in form$/) do
77
+ wait_for_activity_to_load 'IntroductionActivity' if android?
78
+ wait_for_element 'view pager', 'welcome'
79
+ 6.times do
80
+ swipe 'left'
81
+ end
82
+ end
83
+
84
+ Then(/^I see relevant skip sign in notification dialog$/) do
85
+ expect(on(WelcomeScreen).screen_dialog.title_element.text).to include 'some text'
86
+ end
87
+ ```
32
88
 
33
89
  ## Contributing
34
90
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/app_prism. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
91
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bazarnyi/app_prism. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
92
 
37
93
  ## License
38
94
 
@@ -1,6 +1,6 @@
1
1
  module AppPrism
2
2
  module ScreenFactory
3
- def on_page(page_class, _args)
3
+ def on_page(page_class, args = 0)
4
4
  page_class = class_from_string(page_class) if page_class.is_a? String
5
5
  @current_screen = page_class.new(@browser)
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module AppPrism
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_prism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denys Bazarnyi, Dmitriy Konovalov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-06 00:00:00.000000000 Z
11
+ date: 2021-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubygems_version: 3.0.1
168
+ rubygems_version: 3.0.3
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: Write a short summary, because RubyGems requires one.