appom 1.4.0 β†’ 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9a6de43f053bda132bbb8858033c9321366faf11ecc1a2f00f4182cb84c49ee
4
- data.tar.gz: ebd235ad562a8277b0bf5b6875da253e5f6f5ba804265f102115c0bf55b9c304
3
+ metadata.gz: 956c68b448dee7fd7611256fe182aa80a75a8b9f28c30a09c9b83dee021c53dd
4
+ data.tar.gz: 979e09f836332c000a83804062f9df27599df7539e10e11b615de5647b44ac47
5
5
  SHA512:
6
- metadata.gz: a82fc453c96e887cecca965b5a470aef664ef10cb005d89b50d29dda56be3bd30a1c8b133473086c4bdd71a46834c5324aa6846fa1b010f2509d622f71b7e320
7
- data.tar.gz: 5c20db78987ad7edf20eeccf52c5361ff0ba23cd9f57d038cab7e70161304887503a85de391a0fefd1b6e2dc9a1cac01ec5c470526d01dcf2984c6c4dce1511e
6
+ metadata.gz: f7ab4bd8d0501a5022ef64261dd02422b9f73ab3c56195188c83fe14b847071fc201155474063442e5369c96b2e95c498b972d2c911ac5e1009174717645016d
7
+ data.tar.gz: 98d760be575c99b151d2b730d01d5c862d8b8238af4fb3204e7ded4e6b6c850e01e181a2f4e59f3cab106bc011f89d7df8ad92a1ee2d70c37823b327517c8250
data/README.md CHANGED
@@ -1,81 +1,209 @@
1
- # Appom
1
+ <div align="center">
2
+
3
+ # πŸ“± Appom
4
+
5
+ **The Modern Page Object Model Framework for Mobile Test Automation**
6
+
2
7
  [![Gem Version](https://badge.fury.io/rb/appom.svg)](http://badge.fury.io/rb/appom)
8
+ [![Build Status](https://github.com/hoangtaiki/appom/workflows/CI/badge.svg)](https://github.com/hoangtaiki/appom/actions)
9
+ [![Coverage](https://codecov.io/gh/hoangtaiki/appom/branch/master/graph/badge.svg)](https://codecov.io/gh/hoangtaiki/appom)
10
+ [![Ruby Version](https://img.shields.io/badge/Ruby-3.2.2-red)](https://www.ruby-lang.org/)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
+ [![Downloads](https://img.shields.io/gem/dt/appom.svg)](https://rubygems.org/gems/appom)
13
+
14
+ *Write mobile tests that are maintainable, readable, and reliable*
3
15
 
4
- A Page Object Model for Appium
16
+ [Quick Start](#-quick-start) β€’ [Documentation](Documentation.md) β€’ [Examples](#-examples) β€’ [Contributing](#-contributing)
5
17
 
6
- Appom gives you a simple, clean and semantic for describing your application. Appom implements the Page Object Model pattern on top of Appium.
18
+ </div>
7
19
 
8
- ## Idea
9
- If you have used the [Page Object Model](https://medium.com/tech-tajawal/page-object-model-pom-design-pattern-f9588630800b) (POM) with Appium you will probably know about [Capybara](https://github.com/teamcapybara/capybara) and [SitePrism](https://github.com/natritmeyer/site_prism). But CapyBara and SitePrism are designed for the web rather than the mobile.
20
+ ---
10
21
 
11
- Using POM with SitePrism and CapyBara makes interacting with Appium really not that direct. And Appium is not confirmed to work well with these two libraries.
22
+ ## ✨ Why Appom?
12
23
 
13
- Wishing to use the Page Object Model in the simplest way we created Appom. The idea created for Appom is taken from CapyBara and SitePrism.
24
+ Tired of flaky mobile tests that break every release? **Appom** transforms mobile test automation with:
14
25
 
15
- ## Installation
26
+ ```ruby
27
+ # Traditional approach 😒
28
+ driver.find_element(:id, 'login_btn').click
29
+ sleep(2) # Hope the page loads...
30
+ driver.find_element(:xpath, '//input[@type="email"]').send_keys('user@test.com')
31
+
32
+ # Appom way πŸŽ‰
33
+ login_page.login('user@test.com', 'password')
34
+ expect(home_page).to have_dashboard
35
+ ```
36
+
37
+ ## πŸš€ Key Features
38
+
39
+ <table>
40
+ <tr>
41
+ <td>🎯 <strong>Smart Page Objects</strong></td>
42
+ <td>Semantic DSL that reads like natural language</td>
43
+ </tr>
44
+ <tr>
45
+ <td>πŸ”„ <strong>Intelligent Retry</strong></td>
46
+ <td>Auto-retry with exponential backoff for flaky elements</td>
47
+ </tr>
48
+ <tr>
49
+ <td>πŸ“Š <strong>Performance Monitoring</strong></td>
50
+ <td>Track test performance and identify bottlenecks</td>
51
+ </tr>
52
+ <tr>
53
+ <td>🎨 <strong>Visual Testing</strong></td>
54
+ <td>Automated visual regression testing built-in</td>
55
+ </tr>
56
+ <tr>
57
+ <td>πŸ›‘οΈ <strong>Robust Error Handling</strong></td>
58
+ <td>Detailed diagnostics with screenshots and context</td>
59
+ </tr>
60
+ <tr>
61
+ <td>πŸ“± <strong>Cross-Platform</strong></td>
62
+ <td>Single codebase for iOS and Android</td>
63
+ </tr>
64
+ </table>
65
+
66
+ ## πŸ“¦ Installation
67
+
68
+ ```bash
69
+ gem install appom
70
+ ```
16
71
 
17
- Add this line to your application's Gemfile:
72
+ Or add to your `Gemfile`:
18
73
 
19
74
  ```ruby
20
75
  gem 'appom'
21
76
  ```
22
77
 
23
- And then execute:
78
+ ## ⚑ Quick Start
24
79
 
25
- $ bundle
80
+ ### 1. Initialize Appom
26
81
 
27
- Or install it yourself as:
82
+ ```ruby
83
+ require 'appom'
28
84
 
29
- $ gem install appom
85
+ Appom.register_driver do
86
+ Appium::Driver.new({
87
+ caps: {
88
+ platformName: 'iOS',
89
+ deviceName: 'iPhone 15',
90
+ app: '/path/to/your/app.ipa'
91
+ },
92
+ appium_lib: { server_url: 'http://localhost:4723/wd/hub' }
93
+ })
94
+ end
95
+ ```
30
96
 
31
- ## Usage
97
+ ### 2. Create Page Objects
98
+
99
+ ```ruby
100
+ class LoginPage < Appom::Page
101
+ element :email, :accessibility_id, 'email_field'
102
+ element :password, :accessibility_id, 'password_field'
103
+ element :login_btn, :accessibility_id, 'login_button'
104
+
105
+ def login(email, password)
106
+ self.email.set(email)
107
+ self.password.set(password)
108
+ login_btn.tap
109
+ end
110
+ end
111
+ ```
32
112
 
33
- Here's an overview of how Appom is designed to be used:
113
+ ### 3. Write Tests
34
114
 
35
- ### Register Appium Driver
36
- Appium use appium directly to find elements. So that to use Appom you must register Appium Driver for Appom
37
115
  ```ruby
38
- Appom.register_driver do
39
- options = {
40
- appium_lib: appium_lib_options,
41
- caps: caps
42
- }
43
- Appium::Driver.new(options, false)
116
+ RSpec.describe 'Login Flow' do
117
+ it 'logs user in successfully' do
118
+ login_page = LoginPage.new
119
+ login_page.login('test@example.com', 'password')
120
+
121
+ expect(HomePage.new).to have_welcome_message
122
+ end
44
123
  end
45
124
  ```
46
- `appium_lib_options` and `caps` are options to initiate a appium driver. You can follow [Appium Ruby Client](https://github.com/appium/ruby_lib)
47
125
 
48
- ### Change default max wait time
126
+ **That's it!** No more `sleep()`, no more flaky selectors, no more mysterious failures.
127
+
128
+ ## 🎯 Examples
129
+
130
+ <details>
131
+ <summary><strong>Advanced Page Object with Sections</strong></summary>
132
+
49
133
  ```ruby
50
- Appom.configure do |config|
51
- config.max_wait_time = 30
134
+ class ShoppingPage < Appom::Page
135
+ section :header, HeaderSection, :id, 'header'
136
+ sections :products, ProductSection, :class, 'product-card'
137
+
138
+ def add_product_to_cart(product_name)
139
+ product = products.find { |p| p.name.text == product_name }
140
+ product.add_to_cart
141
+ wait_for_cart_update
142
+ end
143
+ end
144
+
145
+ class ProductSection < Appom::Section
146
+ element :name, :class, 'product-name'
147
+ element :price, :class, 'product-price'
148
+ element :add_btn, :class, 'add-to-cart-btn'
149
+
150
+ def add_to_cart
151
+ scroll_to_and_tap(:add_btn)
152
+ end
52
153
  end
53
154
  ```
54
155
 
55
- ### Define a page
156
+ </details>
157
+
158
+ <details>
159
+ <summary><strong>Smart Waiting & Retry Logic</strong></summary>
160
+
56
161
  ```ruby
57
- class LoginPage < Appom::Page
58
- element :email, :accessibility_id, 'email_text_field'
59
- element :password, :accessibility_id, 'password_text_field'
60
- element :sign_in_button, :accessibility_id, 'sign_in_button'
162
+ class PaymentPage < Appom::Page
163
+ element :card_field, :id, 'card_number'
164
+ element :submit_btn, :id, 'submit_payment'
165
+
166
+ def process_payment(card_number)
167
+ # Auto-retry for flaky elements
168
+ interact_with_retry(:card_field, :send_keys, text: card_number)
169
+
170
+ # Wait for specific conditions
171
+ tap_and_wait(:submit_btn)
172
+ wait_for_any(:success_message, :error_message, timeout: 30)
173
+ end
61
174
  end
62
175
  ```
63
176
 
64
- The Appom Wiki has lots of additional information about Appom. Please browse the Wiki after finishing this README:
65
- https://github.com/hoangtaiki/appom/wiki
177
+ </details>
178
+
179
+ <details>
180
+ <summary><strong>Visual Testing Integration</strong></summary>
66
181
 
67
- ## Example
68
- [authentication-appom-appium](https://github.com/hoangtaiki/authentication-appom-appium) is an example about using Appom with Appium.
182
+ ```ruby
183
+ class ProductPage < Appom::Page
184
+ def verify_product_display
185
+ # Automatic visual regression testing
186
+ take_visual_snapshot('product_page')
187
+ compare_visual_baseline('product_page', threshold: 0.95)
188
+ end
189
+ end
190
+ ```
69
191
 
192
+ </details>
70
193
 
71
- ## Contributing
194
+ ## πŸ“š Documentation
72
195
 
73
- Bug reports and pull requests are welcome on GitHub at [Appom](https://github.com/hoangtaiki/appom). 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.
196
+ - **[Complete Documentation](Documentation.md)** - Comprehensive guide with advanced features
197
+ - **[API Reference](https://rubydoc.info/gems/appom)** - Detailed API documentation
198
+ - **[Best Practices](Documentation.md#best-practices)** - Testing patterns and conventions
199
+ - **[Troubleshooting](Documentation.md#troubleshooting)** - Common issues and solutions
74
200
 
75
- ## License
201
+ ---
76
202
 
77
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
203
+ <div align="center">
204
+
205
+ **Made with ❀️ by the mobile testing community**
78
206
 
79
- ## Code of Conduct
207
+ [⬆ Back to top](#-appom)
80
208
 
81
- Everyone interacting in the Appom project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hoangtaiki/appom/blob/master/CODE_OF_CONDUCT.md).
209
+ </div>