Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Appium separate and optimize app launch time measurements #11213

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions wdio/config/android.config.browserstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const defaultCapabilities = [
fullReset: false,
maxInstances: 1,
build: 'Android App Launch Times Tests',
device: process.env.BROWSERSTACK_DEVICE || 'Google Pixel 6',
os_version: process.env.BROWSERSTACK_OS_VERSION || '12.0',
device: process.env.BROWSERSTACK_DEVICE || 'Samsung Galaxy S23 Ultra',
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
os_version: process.env.BROWSERSTACK_OS_VERSION || '13.0',
app: process.env.BROWSERSTACK_APP_URL,
'browserstack.debug': true,
'browserstack.local': true,
Expand Down
25 changes: 0 additions & 25 deletions wdio/features/Performance/ColdStartLaunchTimes.feature

This file was deleted.

18 changes: 18 additions & 0 deletions wdio/features/Performance/ColdStartLoginToWalletScreen.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@androidApp
@iosApp
@performance
Feature: Measure Wallet Screen Cold Start
# This feature measures the cold start of the app when:
# The time it takes to get from login view to wallet view.

Scenario: Cold Start after importing a wallet
Given the splash animation disappears
And I have imported my wallet
And I tap No Thanks on the Enable security check screen
And I close all the onboarding modals
And I am on the wallet screen
When I kill the app
And I relaunch the app
And I fill my password in the Login screen
And The timer starts running after I tap the login button
Then The wallet view appears in "8" seconds
10 changes: 10 additions & 0 deletions wdio/features/Performance/ColdStartOnFreshInstall.feature
Cal-L marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@androidApp
@performance
Feature: Measure Fresh Install Cold Start
# This feature measures the cold start of the app when:
# The user installs the app for the very first time

Scenario: Wallet Time To Interact Cold Start on Fresh Install
Given the app is launched
When the Welcome screen is displayed
Then the app should launch within "1" seconds
17 changes: 17 additions & 0 deletions wdio/features/Performance/ColdStartToLoginScreen.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@androidApp
@iosApp
@performance
Feature: Measure Login Screen Cold Start
# This feature measures the cold start of the app when:
# The user imports a wallet and the time it takes to get from launching app to login view

Scenario: Cold Start on Login Screen After Importing a Wallet
Given the splash animation disappears
And I have imported my wallet
And I tap No Thanks on the Enable security check screen
And I close all the onboarding modals
And I am on the wallet screen
When I kill the app
And I relaunch the app
And the timer starts running
Then The Login screen should be visible in "4" seconds
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@androidApp
@performance
Feature: Measure the app launch times for warm starts
Feature: Measure Wallet Screen Warm Start
# This feature measures the warm start of the app when:
# The time it takes to get from login view to wallet view.

Scenario: Measure warm start launch time after importing a wallet
Scenario: Measure Warm Start 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
Expand All @@ -13,7 +15,6 @@ Feature: Measure the app launch times for warm starts
Then I connect my active wallet to the test dapp
When I background the app for 30 seconds
And the app is move to the foreground
Then the timer starts running
And I fill my password in the Login screen
And I log into my wallet
And the app should launch within "12" seconds
And The timer starts running after I tap the login button
Then The wallet view appears in "6" seconds
16 changes: 16 additions & 0 deletions wdio/features/Performance/WarmStartToLoginScreen.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@androidApp
@performance
Feature: Measure Login Screen Warm Start
# This feature measures the warm start of the app when:
# The user imports a wallet and the time it takes to get from launching app to login view

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 close all the onboarding modals
And I am on the wallet view
When I background the app for 30 seconds
And the app is move to the foreground
And the timer starts running
Then The Login screen should be visible in "2" seconds
6 changes: 4 additions & 2 deletions wdio/screen-objects/Onboarding/ImportFromSeedScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ class ImportFromSeed {
await Gestures.waitAndTap(this.importButton);
}

async tapImportFromSeedTextToDismissKeyboard() {
async tapImportScreenTitleToDismissKeyboard() {
await Gestures.waitAndTap(this.screenTitle);
}
async tapConfirmPasswordTextToDismissKeyboard() {
await Gestures.waitAndTap(this.confirmPasswordText);
}

async isPasswordStrengthTextCorrect(text) {
await expect(this.passwordStrengthLabel).toHaveText(text);
}
Expand Down
39 changes: 38 additions & 1 deletion wdio/step-definitions/app-launch-times.steps.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import cucumberJson from 'wdio-cucumberjs-json-reporter';
import { Given, When, Then } from '@wdio/cucumber-framework';
import LoginScreen from '../screen-objects/LoginScreen';
import WalletMainScreen from '../screen-objects/WalletMainScreen.js';

let startTimer;
let stopTimer;

let loginViewTime;
let walletViewToAppearTime;
let total;
Then(/^the app should launch within "([^"]*)?" seconds$/, async (time) => {
stopTimer = new Date().getTime();
const launchTime = stopTimer - startTimer;
Expand All @@ -14,6 +18,39 @@ Then(/^the app should launch within "([^"]*)?" seconds$/, async (time) => {
await driver.pause(100);
});

Then(/^The Login screen should be visible in "([^"]*)?" seconds$/, async (time) => {
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
await LoginScreen.isLoginScreenVisible();

stopTimer = new Date().getTime();
const launchTime = stopTimer - startTimer;
console.log(`The time it takes the login view to appear is: ${loginViewTime}`);
loginViewTime = launchTime
await expect(loginViewTime).toBeLessThan(time * 1000);
cucumberJson.attach(`The time it takes the login view to appear in Milliseconds is: ${loginViewTime}`);
});
Then(/^The timer starts running after I tap the login button$/, async () => {
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
await LoginScreen.tapUnlockButton();
startTimer = new Date().getTime();
});


Then(/^The wallet view appears in "([^"]*)?" seconds$/, async (time) => {
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
await WalletMainScreen.isMainWalletViewVisible();

stopTimer = new Date().getTime();
walletViewToAppearTime = stopTimer - startTimer;
console.log(`The time it takes the wallet view to appear is: ${walletViewToAppearTime}`);

await expect(walletViewToAppearTime).toBeLessThan(time * 1000);
cucumberJson.attach(`The time it takes the login view to appear in Milliseconds is: ${walletViewToAppearTime}`);
});

When(/^The total times are displayed$/, async () => {
total = walletViewToAppearTime + loginViewTime
cucumberJson.attach(`The total time: login view + wallet view in Milliseconds is: ${total}`);

});

Given(/^the app is launched$/, async () => {
startTimer = new Date().getTime();
});
Expand Down
13 changes: 11 additions & 2 deletions wdio/step-definitions/common-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ Given(/^I have imported my wallet$/, async () => {
await ImportFromSeedScreen.isScreenTitleVisible();
await ImportFromSeedScreen.typeSecretRecoveryPhrase(validAccount.seedPhrase);
await ImportFromSeedScreen.typeNewPassword(validAccount.password);
await ImportFromSeedScreen.tapImportFromSeedTextToDismissKeyboard();
await ImportFromSeedScreen.tapImportScreenTitleToDismissKeyboard();
await ImportFromSeedScreen.typeConfirmPassword(validAccount.password);
await ImportFromSeedScreen.tapImportFromSeedTextToDismissKeyboard();
await ImportFromSeedScreen.tapConfirmPasswordTextToDismissKeyboard();
await ImportFromSeedScreen.clickImportButton();
await OnboardingSucessScreen.tapDone()
});
Expand Down Expand Up @@ -348,6 +348,15 @@ Given(/^I close all the onboarding modals$/, async () => {
} catch {
console.log('The marketing consent modal is not visible');
}
try {
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
await OnboardingWizardModal.isVisible();
await OnboardingWizardModal.tapNoThanksButton();
await OnboardingWizardModal.isNotVisible();
} catch {
/* eslint-disable no-console */

console.log('The onboarding modal is not visible');
}
});
Then(/^I use the back button on Android$/, async () => {
await driver.back();
Expand Down
Loading