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: Enable Regression tests on Bitrise #7645

Merged
merged 44 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2e1f45d
set smoke by default
cortisiko Oct 27, 2023
e986c53
set default to smoke
cortisiko Oct 27, 2023
4e9b169
test conditional statement
cortisiko Oct 28, 2023
bfaefcd
test config conditional
cortisiko Oct 28, 2023
70d4aa8
fix spacing
cortisiko Oct 28, 2023
6bb92b7
test smoke output
cortisiko Oct 28, 2023
c3f2552
fix echo
cortisiko Oct 28, 2023
27d6c09
create regression pipeline
cortisiko Oct 28, 2023
40c75c5
enable detox yarn script
cortisiko Oct 28, 2023
c830ee8
disable approve custom ERC20 test
cortisiko Oct 28, 2023
4d2b83c
temporarily add push trigger for regression
cortisiko Oct 28, 2023
2ea157b
changing to smoke to investigate cmake issue
cortisiko Oct 28, 2023
81e5da9
order of operations
cortisiko Oct 28, 2023
acfa1eb
hard coding test suite for now
cortisiko Oct 29, 2023
54f353f
Revert "hard coding test suite for now"
cortisiko Oct 29, 2023
974542d
temporarily changing condition statement
cortisiko Oct 29, 2023
f61bd5d
Revert "temporarily changing condition statement"
cortisiko Oct 29, 2023
d40c0f2
add script to install missing dependencies
cortisiko Oct 29, 2023
79d4161
script for dependency
cortisiko Oct 29, 2023
81d0256
script for updating the SDK manager.
cortisiko Oct 29, 2023
00a7000
revert
cortisiko Oct 29, 2023
495a51f
temporarily removing cmake check
cortisiko Oct 29, 2023
3dd270a
Revert "temporarily removing cmake check"
cortisiko Oct 29, 2023
d4950e0
fix meta tag for build machine
cortisiko Oct 29, 2023
8cb0e46
Revert "fix meta tag for build machine"
cortisiko Oct 29, 2023
69723b2
set machine for regression workflow
cortisiko Oct 30, 2023
e7be2aa
temporarily moving type-sign tests from regression tag to monitor ove…
cortisiko Oct 30, 2023
f799c63
wait for toast to disappear before continuing test
cortisiko Oct 30, 2023
b85a10d
temporarily disable ios runs. Stress testing android runs.
cortisiko Oct 30, 2023
3965b45
Revert "temporarily moving type-sign tests from regression tag to mon…
cortisiko Oct 31, 2023
56adb52
temporarily disable swaps tests
cortisiko Oct 31, 2023
56c790f
Revert "temporarily disable ios runs. Stress testing android runs."
cortisiko Oct 31, 2023
5c09ca7
Revert "Revert "temporarily disable ios runs. Stress testing android …
cortisiko Oct 31, 2023
174e947
enable regression runs on ios and remove WETH<>ETH
cortisiko Oct 31, 2023
8631b56
disable regression run on release pipeline.
cortisiko Nov 1, 2023
c750a48
disable swaps tests from regression tag. Creating a quarantine folder…
cortisiko Nov 1, 2023
94d64a9
Merge branch 'main' into detox-add-regreesion
cortisiko Nov 1, 2023
0948694
remove push trigger
cortisiko Nov 1, 2023
35a8c9c
Merge branch 'detox-add-regreesion' of https://github.com/MetaMask/me…
cortisiko Nov 1, 2023
1b2a70e
fix lint
cortisiko Nov 1, 2023
f30e026
temporarily enable push trigger to run regression
cortisiko Nov 1, 2023
ecf9cd2
Revert "temporarily enable push trigger to run regression"
cortisiko Nov 1, 2023
c2c8921
Merge branch 'main' into detox-add-regreesion
cortisiko Nov 1, 2023
0ae30d9
fix linting
cortisiko Nov 1, 2023
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
46 changes: 43 additions & 3 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,20 @@ pipelines:
release_e2e_pipeline:
stages:
- run_e2e_ios_android_stage: {}
# - run_regression_e2e_ios_android_stage: {} Enable whenever regression tests are running successfully.
- notify: {}
#PR_e2e_verfication (build ios & android), run iOS (smoke), emulator Android
pr_smoke_e2e_pipeline:
stages:
- run_smoke_e2e_ios_android_stage: {}
- notify: {}

#PR_e2e_verfication (build ios & android), run iOS (regression), emulator Android
pr_regression_e2e_pipeline:
stages:
- run_regression_e2e_ios_android_stage: {}
- notify: {}

#Stages refrence workflows. Those workflows cannot but utility "_this-is-a-utility"
stages:
create_build_release:
Expand Down Expand Up @@ -88,6 +95,10 @@ stages:
workflows:
- ios_e2e_test: {}
- android_e2e_test: {}
run_regression_e2e_ios_android_stage:
workflows:
- ios_run_regression_tests: {}
- android_run_regression_tests: {}
run_e2e_ios_android_stage:
workflows:
- ios_e2e_test: {}
Expand Down Expand Up @@ -273,6 +284,24 @@ workflows:
title: All Tests Passed
is_always_run: false
# E2E Steps

### This workflow uses a flag (TEST_SUITE) that defines the specific set of tests to be run.
## in this instance Regression. In future iterations we can rename to ios_test_suite_selection & android_test_suite_selection
ios_run_regression_tests:
envs:
- TEST_SUITE: 'regression'
after_run:
- ios_e2e_test
android_run_regression_tests:
meta:
bitrise.io:
stack: linux-docker-android-20.04
machine_type_id: elite-xl
envs:
- TEST_SUITE: 'regression'
after_run:
- android_e2e_test

e2e_setup:
steps:
- yarn@:
Expand Down Expand Up @@ -311,8 +340,13 @@ workflows:
inputs:
- content: |-
#!/usr/bin/env bash
if [ "$TEST_SUITE" = "regression" ]; then
TEST_SUITE="regression"
else
TEST_SUITE="smoke"
fi
node -v
IGNORE_BOXLOGS_DEVELOPMENT="true" FORCE_BUNDLING=true yarn test:e2e:android:bitrise:debug --testNamePattern='Smoke'
IGNORE_BOXLOGS_DEVELOPMENT="true" FORCE_BUNDLING=true yarn test:e2e:android:bitrise:debug --testNamePattern="$TEST_SUITE"
title: Detox Build & Test
is_always_run: false
- custom-test-results-export@1:
Expand Down Expand Up @@ -344,7 +378,6 @@ workflows:
- deploy_path: $BITRISE_DEPLOY_DIR
- is_compress: true
- zip_name: 'E2E_Android_Failure_Screenshots'

meta:
bitrise.io:
stack: linux-docker-android-20.04
Expand Down Expand Up @@ -375,8 +408,13 @@ workflows:
inputs:
- content: |-
#!/usr/bin/env bash
if [ "$TEST_SUITE" = "regression" ]; then
TEST_SUITE="regression"
else
TEST_SUITE="smoke"
fi
node -v
IGNORE_BOXLOGS_DEVELOPMENT="true" FORCE_BUNDLING=true yarn test:e2e:ios:debug --testNamePattern='Smoke'
IGNORE_BOXLOGS_DEVELOPMENT="true" FORCE_BUNDLING=true yarn test:e2e:ios:debug --testNamePattern="$TEST_SUITE"
title: Detox Build & Test
is_always_run: false
- custom-test-results-export@1:
Expand Down Expand Up @@ -813,6 +851,7 @@ app:
- opts:
is_expand: false
IOS_APP_LINK: ''

meta:
bitrise.io:
stack: osx-xcode-15.0.x
Expand All @@ -828,3 +867,4 @@ trigger_map:
pipeline: create_qa_builds_pipeline
- tag: 'dev-e2e-*'
pipeline: pr_smoke_e2e_pipeline

4 changes: 4 additions & 0 deletions e2e/pages/WalletView.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ export default class WalletView {
await TestHelpers.checkIfExists(NOTIFICATION_TITLE);
}

static async toastNotificationNotVisible() {
await TestHelpers.checkIfNotVisible(NOTIFICATION_TITLE);
}

static async isNotVisible() {
await TestHelpers.checkIfNotVisible(WALLET_CONTAINER_ID);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
import { Regression } from '../../tags';
import TestHelpers from '../../helpers';
import { loginToApp } from '../../viewHelper';
import FixtureBuilder from '../../fixtures/fixture-builder';
Expand All @@ -16,7 +15,7 @@ import ApprovalModal from '../../pages/modals/ApprovalModal';
const HST_CONTRACT = SMART_CONTRACTS.HST;
const WEBVIEW_TEST_DAPP_APPROVE_TOKENS_BUTTON_ID = 'approveTokens';

describe(Regression('ERC20 tokens'), () => {
describe('ERC20 tokens', () => {
beforeAll(async () => {
jest.setTimeout(170000);
if (device.getPlatform() === 'android') {
Expand Down
216 changes: 216 additions & 0 deletions e2e/specs/quarantine/contract-nickname.failing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
'use strict';
import ImportWalletView from '../../pages/Onboarding/ImportWalletView';
import OnboardingView from '../../pages/Onboarding/OnboardingView';
import OnboardingCarouselView from '../../pages/Onboarding/OnboardingCarouselView';

import ContractNickNameView from '../../pages/ContractNickNameView';
import SendView from '../../pages/SendView';

import MetaMetricsOptIn from '../../pages/Onboarding/MetaMetricsOptInView';
import WalletView from '../../pages/WalletView';
import EnableAutomaticSecurityChecksView from '../../pages/EnableAutomaticSecurityChecksView';
import LoginView from '../../pages/LoginView';

import AddContactView from '../../pages/Drawer/Settings/Contacts/AddContactView';
import ContactsView from '../../pages/Drawer/Settings/Contacts/ContactsView';
import SettingsView from '../../pages/Drawer/Settings/SettingsView';

import ApprovalModal from '../../pages/modals/ApprovalModal';
import NetworkListModal from '../../pages/modals/NetworkListModal';
import OnboardingWizardModal from '../../pages/modals/OnboardingWizardModal';
import NetworkEducationModal from '../../pages/modals/NetworkEducationModal';
import WhatsNewModal from '../../pages/modals/WhatsNewModal';
import SecurityAndPrivacy from '../../pages/Drawer/Settings/SecurityAndPrivacy/SecurityAndPrivacyView';

import TestHelpers from '../../helpers';
import { acceptTermOfUse } from '../../viewHelper';
import Accounts from '../../../wdio/helpers/Accounts';
import TabBarComponent from '../../pages/TabBarComponent';
import WalletActionsModal from '../../pages/modals/WalletActionsModal';

describe('Adding Contract Nickname', () => {
const APPROVAL_DEEPLINK_URL =
'https://metamask.app.link/send/0x326C977E6efc84E512bB9C30f76E30c160eD06FB@5/approve?address=0x178e3e6c9f547A00E33150F7104427ea02cfc747&uint256=5e8';
const CONTRACT_NICK_NAME_TEXT = 'Ace RoMaIn';
const GOERLI = 'Goerli Test Network';

//FIXME Deep linking to a contract address does not work on a sim.

let validAccount;

beforeAll(() => {
validAccount = Accounts.getValidAccount();
});

beforeEach(() => {
jest.setTimeout(150000);
});

it('should import via seed phrase and validate in settings', async () => {
await OnboardingCarouselView.isVisible();
await OnboardingCarouselView.tapOnGetStartedButton();

await OnboardingView.isVisible();
await OnboardingView.tapImportWalletFromSeedPhrase();

await MetaMetricsOptIn.isVisible();
await MetaMetricsOptIn.tapAgreeButton();

await acceptTermOfUse();
await ImportWalletView.isVisible();
});

it('should attempt to import wallet with invalid secret recovery phrase', async () => {
await ImportWalletView.enterSecretRecoveryPhrase(validAccount.seedPhrase);
await ImportWalletView.enterPassword(validAccount.password);
await ImportWalletView.reEnterPassword(validAccount.password);
await WalletView.isVisible();
});

it('Should dismiss Automatic Security checks screen', async () => {
await TestHelpers.delay(3500);
await EnableAutomaticSecurityChecksView.isVisible();
await EnableAutomaticSecurityChecksView.tapNoThanks();
});

it('should dismiss the onboarding wizard', async () => {
// dealing with flakiness on bitrise.
await TestHelpers.delay(1000);
try {
await OnboardingWizardModal.isVisible();
await OnboardingWizardModal.tapNoThanksButton();
await OnboardingWizardModal.isNotVisible();
} catch {
//
}
});

it('should tap on "Got it" Button in the whats new modal', async () => {
// dealing with flakiness on bitrise.
await TestHelpers.delay(2500);
try {
await WhatsNewModal.isVisible();
await WhatsNewModal.tapGotItButton();
} catch {
//
}
});

it('should switch to GOERLI', async () => {
await WalletView.tapNetworksButtonOnNavBar();
await NetworkListModal.changeNetwork(GOERLI);

await WalletView.isNetworkNameVisible(GOERLI);
await TestHelpers.delay(1500);
});

it('should dismiss network education modal', async () => {
await NetworkEducationModal.isVisible();
await NetworkEducationModal.tapGotItButton();
await NetworkEducationModal.isNotVisible();
});
it('should go to the Privacy and settings view', async () => {
await TabBarComponent.tapSettings();
await SettingsView.tapSecurityAndPrivacy();

await SecurityAndPrivacy.scrollToTurnOnRememberMe();
TestHelpers.delay(3000);
});

it('should enable remember me', async () => {
await SecurityAndPrivacy.isRememberMeToggleOff();
await SecurityAndPrivacy.tapTurnOnRememberMeToggle();
await SecurityAndPrivacy.isRememberMeToggleOn();

TestHelpers.delay(1500);
});

it('should relaunch the app then enable remember me', async () => {
// Relaunch app
await TestHelpers.relaunchApp();
await LoginView.isVisible();
await LoginView.toggleRememberMe();

await LoginView.enterPassword(validAccount.password);
await WalletView.isVisible();
});
it('should deep link to the approval modal', async () => {
await TestHelpers.openDeepLink(APPROVAL_DEEPLINK_URL);
await TestHelpers.delay(3000);
await ApprovalModal.isVisible();
});

it('should add a nickname to the contract', async () => {
await ApprovalModal.tapAddNickName();

await ContractNickNameView.isVisible();
await ContractNickNameView.typeContractNickName(CONTRACT_NICK_NAME_TEXT);
await ContractNickNameView.isContractNickNameInInputBoxVisible(
CONTRACT_NICK_NAME_TEXT,
);
await ContractNickNameView.tapConfirmButton();

await ApprovalModal.isContractNickNameVisible(CONTRACT_NICK_NAME_TEXT);
});

it('should edit the contract nickname', async () => {
await ApprovalModal.tapEditNickName();

await ContractNickNameView.isContractNickNameInInputBoxVisible(
CONTRACT_NICK_NAME_TEXT,
);
await ContractNickNameView.clearNickName();
await ContractNickNameView.typeContractNickName('Ace');
await ContractNickNameView.tapConfirmButton();

await ApprovalModal.isContractNickNameVisible('Ace');
await ApprovalModal.tapToCopyContractAddress();
await ApprovalModal.tapRejectButton();
});

it('should verify contract does not appear in contacts view', async () => {
// Check that we are on the wallet screen
await WalletView.isVisible();
await TabBarComponent.tapSettings();
await SettingsView.tapContacts();

await ContactsView.isVisible();
await ContactsView.isContactAliasVisible('Ace');
});

it('should return to the send view', async () => {
// Open Drawer
await AddContactView.tapBackButton();
await SettingsView.tapCloseButton();

await TabBarComponent.tapActions();
await WalletActionsModal.tapSendButton();
// Make sure view with my accounts visible
await SendView.isMyAccountsVisisble();
});

it('should verify the contract nickname does not appear in send flow', async () => {
await SendView.isSavedAliasIsNotVisible('Ace');
});

it('should deep link to the approval modal and approve transaction', async () => {
await TestHelpers.openDeepLink(APPROVAL_DEEPLINK_URL);
await TestHelpers.delay(3000);
await ApprovalModal.isVisible();
await ApprovalModal.isContractNickNameVisible('Ace');

await ApprovalModal.tapApproveButton();
await ApprovalModal.isNotVisible();
});

it('should go to the send view again', async () => {
await TabBarComponent.tapActions();
await WalletActionsModal.tapSendButton();
// Make sure view with my accounts visible
await SendView.isMyAccountsVisisble();
});

it('should verify the contract nickname does not appear in recents', async () => {
await SendView.isSavedAliasIsNotVisible('Ace');
});
});
Loading
Loading