Skip to content

Commit

Permalink
test: 8735 research appium upgrading app version (#8896)
Browse files Browse the repository at this point in the history
## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**


https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d01b2c5b-7295-4aba-bd80-9abb4c7939ae

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained what problem this PR is solving and how it
is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

---------

Co-authored-by: Cal Leung <[email protected]>
  • Loading branch information
SamuelSalas and Cal-L authored Apr 16, 2024
1 parent 060ff00 commit 66821fd
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 30 deletions.
39 changes: 25 additions & 14 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pipelines:
stages:
- create_build_release: {}
- deploy_build_release: {}
- create_build_qa: {} #Generate QA builds for E2E app upgrade tests
- release_notify: {}
#Releases MetaMask apps and stores ipa into App(TestFlight) Store
release_ios_to_store_pipeline:
Expand Down Expand Up @@ -138,6 +139,7 @@ stages:
- run_tag_smoke_swaps_android: {}
- run_tag_smoke_core_ios: {}
- run_tag_smoke_core_android: {}
- run_tag_upgrade_android: {}
run_e2e_ios_android_stage:
workflows:
- ios_e2e_test: {}
Expand Down Expand Up @@ -416,6 +418,20 @@ workflows:
- TEST_SUITE: 'Regression'
after_run:
- android_e2e_test
run_tag_upgrade_android:
meta:
bitrise.io:
stack: linux-docker-android-20.04
machine_type_id: elite-xl
envs:
- PRODUCTION_APP_URL: 'bs://3f81fdb66cba8140909d1ff0a05bc2ace97b307f' # Last production's QA build
- PRODUCTION_BUILD_VERSION_NAME: 7.20.0
- PRODUCTION_BUILD_VERSION_NUMBER: 1308
- CUCUMBER_TAG_EXPRESSION: '@upgrade and @androidApp'
- PRODUCTION_BUILD_STRING: 'MetaMask-QA v$PRODUCTION_BUILD_VERSION_NAME ($PRODUCTION_BUILD_VERSION_NUMBER)'
- NEW_BUILD_STRING: 'MetaMask-QA v$VERSION_NAME ($VERSION_NUMBER)'
after_run:
- run_android_appium_test

### Seperating workflows so they run concurrently during smoke runs
run_tag_smoke_confirmations_ios:
Expand Down Expand Up @@ -892,6 +908,15 @@ workflows:
bitrise.io:
stack: linux-docker-android-20.04
machine_type_id: elite-xl
run_android_appium_test:
meta:
bitrise.io:
stack: linux-docker-android-20.04
machine_type_id: elite-xl
before_run:
- build_android_qa
after_run:
- wdio_android_e2e_test
build_android_qa:
before_run:
- code_setup
Expand Down Expand Up @@ -987,20 +1012,6 @@ workflows:
inputs:
- deploy_path: browserstack_uploaded_apps.json
title: Bitrise Deploy Browserstack Uploaded Apps
- build-router-start@0:
inputs:
- workflows: |-
wdio_android_e2e_test
- wait_for_builds: 'false'
- abort_on_fail: 'yes'
- access_token: $BITRISE_START_BUILD_ACCESS_TOKEN
- environment_key_list: BROWSERSTACK_APP_URL

BROWSERSTACK_DEVICE

BROWSERSTACK_OS_VERSION

BROWSERSTACK_TAG_EXPRESSION
wdio_android_e2e_test:
before_run:
- code_setup
Expand Down
13 changes: 12 additions & 1 deletion wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,18 @@ export const config = {
// your test setup with almost no effort. Unlike plugins, they don't add new
// commands. Instead, they hook themselves up into the test process.
/** services: ['chromedriver','appium'], ***/
services: ['appium'],
services: [
[
'appium',
{
args: {
address: 'localhost',
port: 4723
},
logPath: './'
}
]
],

// Appium service with custom chrome driver path
/*services: [
Expand Down
5 changes: 3 additions & 2 deletions wdio/config/android.config.browserstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ config.capabilities = [
build: 'Android QA E2E Smoke Tests',
device: process.env.BROWSERSTACK_DEVICE || 'Google Pixel 6',
os_version: process.env.BROWSERSTACK_OS_VERSION || '12.0',
app: process.env.BROWSERSTACK_APP_URL,
app: process.env.PRODUCTION_APP_URL || process.env.BROWSERSTACK_APP_URL,
'browserstack.debug': true,
'browserstack.local': true,
'browserstack.midSessionInstallApps' : [process.env.BROWSERSTACK_APP_URL],
},
];

config.waitforTimeout = 10000;
config.connectionRetryTimeout = 90000;
config.connectionRetryCount = 3;
config.cucumberOpts.tagExpression =
process.env.BROWSERSTACK_TAG_EXPRESSION || '@performance and @androidApp'; // pass tag to run tests specific to android
process.env.CUCUMBER_TAG_EXPRESSION || '@performance and @androidApp'; // pass tag to run tests specific to android

config.onPrepare = function (config, capabilities) {
removeSync('./wdio/reports');
Expand Down
3 changes: 2 additions & 1 deletion wdio/config/android.config.browserstack.local.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ config.capabilities = [
build: 'Android QA E2E Tests',
device: 'Google Pixel 3a',
os_version: '9.0',
app: process.env.BROWSERSTACK_APP_URL, // TODO: Add package ID when upload to BrowserStack
app: process.env.PRODUCTION_APP_URL || process.env.BROWSERSTACK_APP_URL,
'browserstack.debug': true,
'browserstack.local': true,
'browserstack.midSessionInstallApps' : [process.env.BROWSERSTACK_APP_URL],
},
];

Expand Down
25 changes: 25 additions & 0 deletions wdio/features/Performance/UpgradeApp.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@androidApp
@upgrade
@fixturesSkipOnboarding
Feature: Measure the app launch times for warm starts

Scenario: Measure warm start launch time after importing a wallet
Given the app displayed the splash animation
And I have imported my wallet
And I tap No Thanks on the Enable security check screen
And I tap No thanks on the onboarding welcome tutorial
And I close the Whats New modal
And I am on the wallet view
When I tap on the Settings tab option
And I scroll up
And In settings I tap on "About MetaMask"
Then version "PRODUCTION_BUILD_STRING" is displayed for app upgrade step
When I install upgrade the app
And I relaunch the app
And the splash animation completes
And I fill my password in the Login screen
And I log into my wallet
And I tap on the Settings tab option
And In settings I tap on "About MetaMask"
Then version "NEW_BUILD_STRING" is displayed for app upgrade step
And removed test app
2 changes: 1 addition & 1 deletion wdio/helpers/Gestures.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const Actions = {
class Gestures {
static async waitAndTap(element) {
const elem = await element;
await elem.waitForDisplayed();
await elem.waitForDisplayed({timeout: 25000});
(await elem).touchAction(Actions.TAP);
}

Expand Down
1 change: 1 addition & 0 deletions wdio/screen-objects/Modals/TabBarModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class TabBarModal {
}

async tapSettingButton() {
await driver.pause(10000);
await Gestures.waitAndTap(this.settingsButton);
}

Expand Down
6 changes: 6 additions & 0 deletions wdio/screen-objects/Onboarding/OnboardingCarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ class WelcomeScreen {
}
}

async waitForSplashAnimationToComplete() {
const elem = await this.splashScreenMetamaskAnimationId;
await elem.waitForExist();
await elem.waitForExist({ reverse: true });
}

async isScreenDisplayed() {
expect(this.screen).toBeDisplayed();
}
Expand Down
10 changes: 0 additions & 10 deletions wdio/screen-objects/testIDs/Screens/Settings.testIds.js
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
export const GENERAL_SETTINGS = 'general-settings';
export const SECURITY_SETTINGS = 'security-settings';
export const ADVANCED_SETTINGS = 'advanced-settings';
export const CONTACTS_SETTINGS = 'contacts-settings';
export const NETWORKS_SETTINGS = 'networks-settings';
export const ON_RAMP_SETTINGS = 'on-ramp-settings';
export const EXPERIMENTAL_SETTINGS = 'experimental-settings';
export const ABOUT_METAMASK_SETTINGS = 'about-metamask-settings';
export const REQUEST_SETTINGS = 'request-settings';
export const CONTACT_SETTINGS = 'contact-settings';
export const LOCK_SETTINGS = 'lock-settings';
35 changes: 34 additions & 1 deletion wdio/step-definitions/common-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import OnboardingWizardModal from '../screen-objects/Modals/OnboardingWizardModa
import LoginScreen from '../screen-objects/LoginScreen';
import TermOfUseScreen from '../screen-objects/Modals/TermOfUseScreen';
import WhatsNewModal from '../screen-objects/Modals/WhatsNewModal';
import Gestures from "../helpers/Gestures";

Then(/^the Welcome screen is displayed$/, async () => {
await WelcomeScreen.isScreenDisplayed();
Expand Down Expand Up @@ -139,6 +140,13 @@ Then(/^"([^"]*)?" is displayed/, async (text) => {
await CommonScreen.isTextDisplayed(text);
});

Then(/^version "([^"]*)?" is displayed for app upgrade step/, async (text) => {
const appUpgradeText = process.env[text];
const timeout = 1000;
await driver.pause(timeout);
await CommonScreen.isTextDisplayed(appUpgradeText);
});

Then(/^"([^"]*)?" is not displayed/, async (text) => {
const timeout = 1000;
await driver.pause(timeout);
Expand Down Expand Up @@ -168,7 +176,8 @@ Then(

When(/^I log into my wallet$/, async () => {
await LoginScreen.tapUnlockButton();
await WalletMainScreen.isVisible();
await driver.pause(10000);
await WalletMainScreen.isMainWalletViewVisible();
});

When(/^I kill the app$/, async () => {3
Expand Down Expand Up @@ -264,3 +273,27 @@ When(/^I tap on the Settings tab option$/, async () => {
When(/^I tap on the Activity tab option$/, async () => {
await TabBarModal.tapActivityButton();
});

When(/^I install upgrade the app$/, async () => {
await driver.installApp(process.env.BROWSERSTACK_APP_URL)
});

When(/^I scroll up$/, async () => {
await Gestures.swipeUp(0.5);
});

Then(/^removed test app$/, async () => {
const platform = await driver.getPlatform();
// TODO: Use environment variables for bundle IDs
if (platform === 'iOS') {
await driver.removeApp('io.metamask.MetaMask-QA');
}

if (platform === 'Android') {
await driver.removeApp('io.metamask.qa');
}
});

Given(/^the splash animation completes$/, async () => {
await WelcomeScreen.waitForSplashAnimationToComplete();
});

0 comments on commit 66821fd

Please sign in to comment.