Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.woocommerce.android.e2e.tests.screenshot

import androidx.activity.ComponentActivity
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.ActivityTestRule
import com.woocommerce.android.BuildConfig
import com.woocommerce.android.e2e.helpers.InitializationRule
Expand All @@ -22,30 +23,48 @@ import org.junit.Rule
import org.junit.Test
import tools.fastlane.screengrab.Screengrab
import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy
import tools.fastlane.screengrab.locale.LocaleTestRule

@HiltAndroidTest
class WooPosScreenshotTest : TestBase(failOnUnmatchedWireMockRequests = false) {
@get:Rule(order = 0)
val rule = HiltAndroidRule(this)

@get:Rule(order = 1)
val composeTestRule = createAndroidComposeRule<ComponentActivity>()
val initRule = InitializationRule()

@get:Rule(order = 2)
val initRule = InitializationRule()
val composeTestRule = createAndroidComposeRule<ComponentActivity>()

@get:Rule(order = 3)
var activityRule = ActivityTestRule(LoginActivity::class.java)
val localeTestRule = LocaleTestRule()

@get:Rule(order = 4)
var activityRule = ActivityTestRule(LoginActivity::class.java)

@get:Rule(order = 5)
var retryTestRule = RetryTestRule()

@Before
fun setUp() {
cleanStatusBar()
lockLandscapeOrientation()
rule.inject()
}

private fun lockLandscapeOrientation() {
InstrumentationRegistry
.getInstrumentation()
.uiAutomation
.executeShellCommand("settings put system user_rotation 2")
.close()
InstrumentationRegistry
.getInstrumentation()
.uiAutomation
.executeShellCommand("settings put system accelerometer_rotation 0")
.close()
}

@Test
fun posScreenshots() {
Screengrab.setDefaultScreenshotStrategy(UiAutomatorScreenshotStrategy())
Expand Down
49 changes: 49 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,55 @@ platform :android do
)
end

#####################################################################################
# take_pos_screenshots
# -----------------------------------------------------------------------------------
# fastlane take_pos_screenshots
#####################################################################################
desc 'Create raw POS screenshots for tablets'
lane :take_pos_screenshots do |options|
locales = if options[:locales]
options[:locales].split(',')
else
SUPPORTED_LOCALES
.map { |locale| locale[:google_play] }
.append('en-US')
end

UI.message('Clearing previous POS screenshots...')
sh('rm -f ../fastlane/screenshots/raw/*-pos-*')

UI.message('Building APKs...')
gradle(task: 'assembleVanillaDebug assembleVanillaDebugAndroidTest')

UI.message("Attempting POS screenshots for locales: #{locales}")

screenshot_options = {
output_directory: RAW_SCREENSHOTS_DIR,
app_package_name: APP_PACKAGE_NAME,
app_apk_path: 'WooCommerce/build/outputs/apk/vanilla/debug/WooCommerce-vanilla-debug.apk',
tests_apk_path: 'WooCommerce/build/outputs/apk/androidTest/vanilla/debug/WooCommerce-vanilla-debug-androidTest.apk',
use_tests_in_classes: "#{APP_PACKAGE_NAME}.e2e.tests.screenshot.WooPosScreenshotTest",
reinstall_app: false,
clear_previous_screenshots: false,
use_adb_root: true,
locales: locales,
use_timestamp_suffix: false,
test_instrumentation_runner: "#{APP_PACKAGE_NAME}.WooCommerceTestRunner",
skip_open_summary: true
}

UI.message('Setting light theme...')
begin
adb(command: 'shell cmd uimode night no')
rescue StandardError => e
UI.error(e)
end

UI.message('Taking POS screenshots for light theme on Pixel Tablet...')
screengrab(screenshot_options)
end

# This lane downloads the translated promo strings from the translation system.
#
lane :download_promo_strings do
Expand Down
5 changes: 4 additions & 1 deletion fastlane/metadata/android/en-US/full_description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ Create orders on the fly
Once you have some products created, it’s simple. Choose items from your catalog, add shipping, and then fill in customer details to quickly create an order that syncs with your inventory.

Take payments in person
Collect physical payments using WooCommerce In-Person Payments and a card reader. Start a new order - or find an existing one that’s pending payment - and collect payment using the card reader or a digital wallet, such as Google Pay.
Collect physical payments using WooCommerce In-Person Payments and a card reader (available in the US, UK, and Canada), Tap to Pay, or a digital wallet, such as Apple Pay. Start a new order — or find an existing one that's pending payment – then seamlessly accept payment.

Go from clicks to bricks
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamgabrielma I added a new section to the description right after the IPP section. Is this what you meant?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's right, thanks!

Turn any tablet into a powerful point of sale with WooCommerce POS. Search products, scan barcodes, apply coupons, and send email receipts, with all of your online and physical sales synced in real time. Available in the US and UK.

Get notified of every sale
Now that you’re actively selling, never miss an order or a review. Keep yourself in the loop by enabling real-time alerts – and listen for that addictive “cha-ching” sound that comes with each new sale!
Expand Down
2 changes: 1 addition & 1 deletion fastlane/metadata/android/en-US/short_description.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Manage orders, get sales notifications, and view key metrics — wherever you are.
Manage orders, get notifications, view metrics, and accept in-person payments.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamgabrielma there is also "short description" on android which I updated like that. Wdyt?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! I'm fine with it, but could you ping Adam Maid (I don't see a github handler) in the P2 to confirm the copy? We might miss something as non-natives.

2 changes: 1 addition & 1 deletion fastlane/metadata/android/en-US/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
WooCommerce
WooCommerce: Store Management & POS