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

feat: Create a performance E2E test for warm starts #6865

Merged
merged 6 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion wdio/config/android.config.browserstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ config.waitforTimeout = 10000;
config.connectionRetryTimeout = 90000;
config.connectionRetryCount = 3;
config.cucumberOpts.tagExpression =
process.env.BROWSERSTACK_TAG_EXPRESSION || '@smoke'; // pass tag to run tests specific to android
process.env.BROWSERSTACK_TAG_EXPRESSION || '@performance'; // pass tag to run tests specific to android

config.onPrepare = function (config, capabilities) {
removeSync('./wdio/reports');
Expand Down
20 changes: 20 additions & 0 deletions wdio/features/Performance/WarmStartPerformance.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@androidApp
@performance
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 am on the wallet view
When I navigate to the browser
And I navigate to "https://app.sushi.com/swap"
Then the connect modal should be displayed
And I connect my active wallet to the dapp
When I background the app for 30 seconds
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
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 "8" seconds
2 changes: 1 addition & 1 deletion wdio/screen-objects/BrowserObject/AddressBarScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AddressBarScreen {
}

get urlModalInput() {
return Selectors.getElementByPlatform(URL_INPUT_BOX_ID);
return Selectors.getXpathElementByResourceId(URL_INPUT_BOX_ID);
}

get uniswapSuggestionsButton() {
Expand Down
4 changes: 2 additions & 2 deletions wdio/screen-objects/BrowserObject/BrowserScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import {

class BrowserScreen {
get container() {
return Selectors.getElementByPlatform(BROWSER_SCREEN_ID);
return Selectors.getXpathElementByResourceId(BROWSER_SCREEN_ID);
}

get urlBarTitle() {
return Selectors.getElementByPlatform(NAVBAR_TITLE_NETWORK);
return Selectors.getXpathElementByResourceId(NAVBAR_TITLE_NETWORK);
}

get accountIconButton() {
Expand Down
2 changes: 1 addition & 1 deletion wdio/screen-objects/Modals/AccountApprovalModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Gestures from '../../helpers/Gestures';

class AccountApprovalModal {
get modalContainer() {
return Selectors.getElementByPlatform(ACCOUNT_APROVAL_MODAL_CONTAINER_ID);
return Selectors.getXpathElementByResourceId(ACCOUNT_APROVAL_MODAL_CONTAINER_ID);
}

get connectButton() {
Expand Down
2 changes: 1 addition & 1 deletion wdio/screen-objects/Modals/TabBarModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TabBarModal {
}

get browserButton() {
return Selectors.getElementByPlatform(TAB_BAR_BROWSER_BUTTON);
return Selectors.getXpathElementByResourceId(TAB_BAR_BROWSER_BUTTON);
}

get actionButton() {
Expand Down
9 changes: 8 additions & 1 deletion wdio/screen-objects/Onboarding/ImportFromSeedScreen.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD,
IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD_CHECK_ICON_ID,
IMPORT_FROM_SEED_SCREEN_PASSWORD_STRENGTH_ID,
IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
Expand Down Expand Up @@ -56,6 +57,12 @@ class ImportFromSeed {
);
}

get confirmPasswordText() {
return Selectors.getXpathElementByText(
IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD
);
}

async isScreenTitleVisible() {
await expect(this.screenTitle).toBeDisplayed();
}
Expand All @@ -78,7 +85,7 @@ class ImportFromSeed {
}

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

async isPasswordStrengthTextCorrect(text) {
Expand Down
1 change: 1 addition & 0 deletions wdio/screen-objects/Onboarding/MetaMetricsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MetaMetricsScreen {
const element = await this.iAgreeButton;
await element.waitForDisplayed();
await this.swipeUp();
await this.swipeUp();
await element.waitForEnabled();
await Gestures.waitAndTap(this.iAgreeButton);
}
Expand Down
3 changes: 1 addition & 2 deletions wdio/screen-objects/WalletMainScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ class WalletMainScreen {
}

async isVisible() {
const element = await this.WalletScreenContainer;
await element.waitForDisplayed();
expect(this.WalletScreenContainer).toBeDisplayed();
}

async isNetworkNameCorrect(network) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export const IMPORT_FROM_SEED_SCREEN_PASSWORD_STRENGTH_ID =
'import-from-seed-screen-seed-password-strength-id';
export const IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD_CHECK_ICON_ID =
'import-from-seed-screen-seed-password-match-icon-id';
export const IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD = 'Confirm password';
9 changes: 9 additions & 0 deletions wdio/step-definitions/app-launch-times.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ Given(/^the app is launched$/, async () => {
When(/^the timer starts running$/, async () => {
startTimer = new Date().getTime();
});

When(/^I background the app for (\d+) seconds$/, async (time) => {
await driver.background(time);
});

When(/^the app is move to the foreground$/, function () {
// Action performed automatically by Appium
// Step added to enhance clarity and ease of understanding
});
4 changes: 2 additions & 2 deletions wdio/step-definitions/common-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Then(

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

When(/^I kill the app$/, async () => {
Expand Down Expand Up @@ -249,4 +249,4 @@ When(/^I tap on the Settings tab option$/, async () => {

When(/^I tap on the Activity tab option$/, async () => {
await TabBarModal.tapActivityButton();
});
});
Loading