Skip to content

Commit 7d2cadf

Browse files
authored
[POS as a tab i1] Fix issues from raw & promo screenshots generation (#15805)
2 parents 9ae6596 + faeca37 commit 7d2cadf

File tree

8 files changed

+84
-37
lines changed

8 files changed

+84
-37
lines changed

Gemfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ gem 'fastlane-plugin-sentry', '~> 1.0'
1515
# This comment avoids typing to switch to a development version for testing.
1616
#
1717
# gem 'fastlane-plugin-wpmreleasetoolkit', git: '[email protected]:wordpress-mobile/release-toolkit', branch: ''
18-
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 13.0'
18+
#
19+
# The '>= 13.3.1' aftre '~> 13.3' ensures that we resolve to any version compatible with 13.3 starting from 13.3.1
20+
# Using '~> 13.3.1' would constrain us to 13.3.2, 13.3.3, etc. without ever going up to 13.4
21+
# We need 13.3.1 because of a fix in screenshots generation we depend upon.
22+
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 13.3', '>= 13.3.1'
1923
gem 'rake', '~> 12.3'
2024
gem 'rubocop', '~> 1.65'
2125
gem 'rubocop-rake', '~> 0.6'

Gemfile.lock

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GEM
55
base64
66
nkf
77
rexml
8-
activesupport (7.2.2.1)
8+
activesupport (8.0.2)
99
base64
1010
benchmark (>= 0.3)
1111
bigdecimal
@@ -17,6 +17,7 @@ GEM
1717
minitest (>= 5.1)
1818
securerandom (>= 0.3)
1919
tzinfo (~> 2.0, >= 2.0.5)
20+
uri (>= 0.13.1)
2021
addressable (2.8.7)
2122
public_suffix (>= 2.0.2, < 7.0)
2223
artifactory (3.0.17)
@@ -40,8 +41,8 @@ GEM
4041
aws-eventstream (~> 1, >= 1.0.2)
4142
babosa (1.0.4)
4243
base64 (0.2.0)
43-
benchmark (0.4.0)
44-
bigdecimal (3.1.9)
44+
benchmark (0.4.1)
45+
bigdecimal (3.2.2)
4546
buildkit (1.6.1)
4647
sawyer (>= 0.6)
4748
chroma (0.2.0)
@@ -54,8 +55,8 @@ GEM
5455
colored2 (3.1.2)
5556
commander (4.6.0)
5657
highline (~> 2.0.0)
57-
concurrent-ruby (1.3.4)
58-
connection_pool (2.4.1)
58+
concurrent-ruby (1.3.5)
59+
connection_pool (2.5.3)
5960
cork (0.3.0)
6061
colored2 (~> 3.1)
6162
danger (9.5.1)
@@ -83,12 +84,12 @@ GEM
8384
danger
8485
rubocop (~> 1.0)
8586
declarative (0.0.20)
86-
diffy (3.4.3)
87+
diffy (3.4.4)
8788
digest-crc (0.6.5)
8889
rake (>= 12.0.0, < 14.0.0)
8990
domain_name (0.6.20240107)
9091
dotenv (2.8.1)
91-
drb (2.2.1)
92+
drb (2.2.3)
9293
emoji_regex (3.2.3)
9394
excon (0.112.0)
9495
faraday (1.10.4)
@@ -169,7 +170,7 @@ GEM
169170
google-apis-firebaseappdistribution_v1alpha (~> 0.2.0)
170171
fastlane-plugin-sentry (1.25.1)
171172
os (~> 1.1, >= 1.1.4)
172-
fastlane-plugin-wpmreleasetoolkit (13.0.0)
173+
fastlane-plugin-wpmreleasetoolkit (13.3.1)
173174
activesupport (>= 6.1.7.1)
174175
buildkit (~> 1.5)
175176
chroma (= 0.2.0)
@@ -236,7 +237,7 @@ GEM
236237
http-cookie (1.0.8)
237238
domain_name (~> 0.5)
238239
httpclient (2.8.3)
239-
i18n (1.14.6)
240+
i18n (1.14.7)
240241
concurrent-ruby (~> 1.0)
241242
java-properties (0.3.0)
242243
jmespath (1.6.2)
@@ -248,21 +249,21 @@ GEM
248249
kramdown-parser-gfm (1.1.0)
249250
kramdown (~> 2.0)
250251
language_server-protocol (3.17.0.3)
251-
logger (1.6.4)
252+
logger (1.7.0)
252253
mini_magick (4.13.2)
253254
mini_mime (1.1.5)
254-
mini_portile2 (2.8.8)
255-
minitest (5.25.4)
255+
mini_portile2 (2.8.9)
256+
minitest (5.25.5)
256257
multi_json (1.15.0)
257258
multipart-post (2.4.1)
258259
nanaimo (0.4.0)
259260
nap (1.1.0)
260261
naturally (2.2.1)
261262
nkf (0.2.0)
262-
nokogiri (1.18.3)
263+
nokogiri (1.18.8)
263264
mini_portile2 (~> 2.8.2)
264265
racc (~> 1.4)
265-
nokogiri (1.18.3-x86_64-darwin)
266+
nokogiri (1.18.8-x86_64-darwin)
266267
racc (~> 1.4)
267268
octokit (6.1.1)
268269
faraday (>= 1, < 3)
@@ -284,7 +285,7 @@ GEM
284285
racc (1.8.1)
285286
rainbow (3.1.1)
286287
rake (12.3.3)
287-
rake-compiler (1.2.9)
288+
rake-compiler (1.3.0)
288289
rake
289290
rchardet (1.8.0)
290291
regexp_parser (2.9.2)
@@ -339,6 +340,7 @@ GEM
339340
concurrent-ruby (~> 1.0)
340341
uber (0.1.0)
341342
unicode-display_width (2.6.0)
343+
uri (1.0.3)
342344
word_wrap (1.0.0)
343345
xcode-install (2.8.1)
344346
claide (>= 0.9.1)
@@ -367,7 +369,7 @@ DEPENDENCIES
367369
fastlane (~> 2.217)
368370
fastlane-plugin-firebase_app_distribution (~> 0.10)
369371
fastlane-plugin-sentry (~> 1.0)
370-
fastlane-plugin-wpmreleasetoolkit (~> 13.0)
372+
fastlane-plugin-wpmreleasetoolkit (~> 13.3, >= 13.3.1)
371373
rake (~> 12.3)
372374
rmagick (~> 4.1)
373375
rubocop (~> 1.65)

Modules/Sources/Yosemite/Model/Mocks/ActionHandlers/MockSettingActionHandler.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ struct MockSettingActionHandler: MockActionHandler {
2525
synchronizeGeneralSiteSettings(siteID: siteID, onCompletion: onCompletion)
2626
case .retrieveTaxBasedOnSetting(_, let onCompletion):
2727
onCompletion(.success(objectGraph.taxBasedOnSetting))
28+
case .isFeatureEnabled(_, let feature, let onCompletion):
29+
switch feature {
30+
case .pointOfSale:
31+
// Only enables POS feature for eligible locales (US and UK variants).
32+
let locale = Locale.current
33+
let localeIdentifier = locale.identifier
34+
let isEligibleCountry = localeIdentifier.hasPrefix("en_US") ||
35+
localeIdentifier.hasPrefix("en_GB") ||
36+
localeIdentifier == "en-US" ||
37+
localeIdentifier == "en-GB"
38+
onCompletion(.success(isEligibleCountry))
39+
}
2840
default: unimplementedAction(action: action)
2941
}
3042
}

Modules/Sources/Yosemite/Model/Mocks/ActionHandlers/MockSystemStatusActionHandler.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@ struct MockSystemStatusActionHandler: MockActionHandler {
1414
synchronizeSystemPlugins(siteID: siteID) { result in
1515
onCompletion(result.map { SystemInformation(systemPlugins: $0) })
1616
}
17+
case .fetchSystemPlugin(let siteID, let systemPluginName, let onCompletion):
18+
let systemPlugins = objectGraph.systemPlugins(for: siteID)
19+
let filteredSystemPlugin = systemPlugins.first { $0.name == systemPluginName }
20+
let matchingPlugin = systemPlugins.first { $0.name == systemPluginName && $0.active } ?? filteredSystemPlugin
21+
onCompletion(matchingPlugin)
1722
case .fetchSystemPluginListWithNameList(let siteID, let systemPluginNameList, let onCompletion):
1823
let systemPlugins = objectGraph.systemPlugins(for: siteID)
1924
let filteredSystemPlugins = systemPlugins.first { systemPluginNameList.contains($0.name) }
2025
onCompletion(filteredSystemPlugins)
21-
default:
22-
break
26+
case .fetchSystemPluginWithPath(let siteID, let pluginPath, let onCompletion):
27+
let systemPlugins = objectGraph.systemPlugins(for: siteID)
28+
let matchingPlugin = systemPlugins.first { $0.plugin == pluginPath }
29+
onCompletion(matchingPlugin)
30+
case .fetchSystemStatusReport(_, let onCompletion):
31+
// For now, returns a failure since this mock doesn't implement system status report fetching.
32+
onCompletion(.failure(NSError(domain: "MockSystemStatusActionHandler", code: 1, userInfo: [:])))
2333
}
2434
}
2535

Modules/Sources/Yosemite/Model/Mocks/Graphs/ScreenshotsObjectGraph.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Foundation
22
import Storage
3+
import enum WooFoundation.CurrencyCode
34

45
struct Defaults {
56
struct Account {
@@ -72,13 +73,22 @@ struct ScreenshotObjectGraph: MockObjectGraph {
7273
label: "Country and State",
7374
settingDescription: "The country and state or province, if any, in which your business is located.",
7475
value: "US:CA",
76+
settingGroupKey: "general"),
77+
createSiteSetting(settingID: "woocommerce_currency",
78+
label: "Currency",
79+
settingDescription: "This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.",
80+
value: CurrencyCode.USD.rawValue,
7581
settingGroupKey: "general")
7682
]
7783

7884
var systemPlugins: [SystemPlugin] = [
7985
createSystemPlugin(plugin: "woocommerce-payments",
8086
name: "WooCommerce Payments",
81-
version: "3.2.1")
87+
version: "3.2.1"),
88+
// One of the requirements for the POS tab to show up.
89+
createSystemPlugin(plugin: "woocommerce",
90+
name: "WooCommerce",
91+
version: "10.0.0")
8292
]
8393

8494
var paymentGatewayAccounts: [PaymentGatewayAccount] = [

Modules/Sources/Yosemite/Model/Mocks/MockStoresManager.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ public class MockStoresManager: StoresManager {
162162
shippingMethodActionHandler.handle(action: action)
163163
case let action as CouponAction:
164164
couponActionHandler.handle(action: action)
165+
case let action as FeatureFlagAction:
166+
switch action {
167+
case let .isRemoteFeatureFlagEnabled(_, _, completion):
168+
completion(true)
169+
}
165170
default:
166171
fatalError("Unable to handle action: \(action.identifier) \(String(describing: action))")
167172
}

WooCommerce/WooCommerceScreenshots/WooCommerceScreenshots.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class WooCommerceScreenshots: XCTestCase {
4242
return false
4343
}
4444

45+
// Triggers any pending system dialogs (like push notification permissions).
46+
// The interruption monitor above only activates when the app receives user interaction.
47+
app.tap()
48+
4549
// My Store
4650
try TabNavComponent()
4751
.goToMyStoreScreen()

fastlane/screenshots.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"device_frame_offset": [161, 595]
1818
},
1919
{
20-
"name": "iPad Pro 12.9 (3rd Generation)",
20+
"name": "iPad Pro 13-inch (M4)",
2121
"canvas_size": [2048,2732],
2222
"text_size": [1848, 559],
2323
"text_offset": [100, 0],
@@ -74,45 +74,45 @@
7474
},
7575

7676

77-
/// iPad Pro 12.9 (3rd Generation)
77+
/// iPad Pro 13-inch (M4)
7878
// Track sales and bestselling products
7979
{
80-
"device": "iPad Pro 12.9 (3rd Generation)",
81-
"filename": "iPad Pro (12.9-inch) (3rd generation)-01.png",
80+
"device": "iPad Pro 13-inch (M4)",
81+
"filename": "iPad Pro 13-inch (M4)-01.png",
8282
"background": "appstoreres/assets/ipad-background-1.png",
83-
"screenshot": "iPad Pro (12.9-inch) (3rd generation)-1-dark-order-dashboard.png",
83+
"screenshot": "iPad Pro 13-inch (M4)-1-dark-order-dashboard.png",
8484
"text": "metadata/{locale}/app_store_screenshot_1.txt"
8585
},
8686
// Create orders on the fly
8787
{
88-
"device": "iPad Pro 12.9 (3rd Generation)",
89-
"filename": "iPad Pro (12.9-inch) (3rd generation)-02.png",
88+
"device": "iPad Pro 13-inch (M4)",
89+
"filename": "iPad Pro 13-inch (M4)-02.png",
9090
"background": "appstoreres/assets/ipad-background-2.png",
91-
"screenshot": "iPad Pro (12.9-inch) (3rd generation)-2-light-order-creation.png",
91+
"screenshot": "iPad Pro 13-inch (M4)-2-light-order-creation.png",
9292
"text": "metadata/{locale}/app_store_screenshot_2.txt"
9393
},
9494
// Take payments in person
9595
{
96-
"device": "iPad Pro 12.9 (3rd Generation)",
97-
"filename": "iPad Pro (12.9-inch) (3rd generation)-03.png",
96+
"device": "iPad Pro 13-inch (M4)",
97+
"filename": "iPad Pro 13-inch (M4)-03.png",
9898
"background": "appstoreres/assets/ipad-background-1.png",
99-
"screenshot": "iPad Pro (12.9-inch) (3rd generation)-3-dark-order-payment.png",
99+
"screenshot": "iPad Pro 13-inch (M4)-3-dark-order-payment.png",
100100
"text": "metadata/{locale}/app_store_screenshot_3.txt"
101101
},
102102
// Add and edit products with a touch
103103
{
104-
"device": "iPad Pro 12.9 (3rd Generation)",
105-
"filename": "iPad Pro (12.9-inch) (3rd generation)-04.png",
104+
"device": "iPad Pro 13-inch (M4)",
105+
"filename": "iPad Pro 13-inch (M4)-04.png",
106106
"background": "appstoreres/assets/ipad-background-2.png",
107-
"screenshot": "iPad Pro (12.9-inch) (3rd generation)-4-light-product-add.png",
107+
"screenshot": "iPad Pro 13-inch (M4)-4-light-product-add.png",
108108
"text": "metadata/{locale}/app_store_screenshot_4.txt"
109109
},
110110
// Get notified of every sale
111111
{
112-
"device": "iPad Pro 12.9 (3rd Generation)",
113-
"filename": "iPad Pro (12.9-inch) (3rd generation)-05.png",
112+
"device": "iPad Pro 13-inch (M4)",
113+
"filename": "iPad Pro 13-inch (M4)-05.png",
114114
"background": "appstoreres/assets/ipad-background-1.png",
115-
"screenshot": "iPad Pro (12.9-inch) (3rd generation)-5-dark-order-notification.png",
115+
"screenshot": "iPad Pro 13-inch (M4)-5-dark-order-notification.png",
116116
"text": "metadata/{locale}/app_store_screenshot_5.txt"
117117
}
118118
]

0 commit comments

Comments
 (0)