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

chore(runway): cherry-pick fix: Update steps of the methods that are no longer valid #11423

Merged
merged 1 commit into from
Sep 25, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ import TabBarComponent from '../../pages/TabBarComponent';
import ToastModal from '../../pages/modals/ToastModal';
import ConnectedAccountsModal from '../../pages/modals/ConnectedAccountsModal';
import NetworkListModal from '../../pages/modals/NetworkListModal';
import AddAccountModal from '../../pages/modals/AddAccountModal';
import { loginToApp } from '../../viewHelper';
import FixtureBuilder from '../../fixtures/fixture-builder';
import { withFixtures } from '../../fixtures/fixture-helper';
import Assertions from '../../utils/Assertions';
import { Regression } from '../../tags';

describe('Connecting to multiple dapps and revoking permission on one but staying connected to the other', () => {
const AccountTwoText = 'Account 2';

describe(Regression('Connecting to multiple dapps and revoking permission on one but staying connected to the other'), () => {
beforeAll(async () => {
jest.setTimeout(150000);
await TestHelpers.reverseServerPort();
Expand Down Expand Up @@ -42,10 +46,12 @@ describe('Connecting to multiple dapps and revoking permission on one but stayin
await Assertions.checkIfNotVisible(ToastModal.notificationTitle);
await ConnectedAccountsModal.tapConnectMoreAccountsButton();
await AccountListView.tapAddAccountButton();
await AccountListView.tapCreateAccountButton();
await AccountListView.isAccount2VisibleAtIndex(0);
await AddAccountModal.tapCreateAccount();
if (device.getPlatform() === 'android') {
await Assertions.checkIfTextIsDisplayed(AccountTwoText);
}
await AccountListView.tapAccountIndex(0);
await AccountListView.connectAccountsButton();
await AccountListView.tapConnectAccountsButton();

// should revoke accounts
await Browser.tapNetworkAvatarButtonOnBrowser();
Expand Down
25 changes: 14 additions & 11 deletions e2e/specs/swaps/swap-token-chart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import ActivitiesView from '../../pages/ActivitiesView';
import DetailsModal from '../../pages/modals/DetailsModal';

const fixtureServer = new FixtureServer();
const sourceTokenSymbol = 'USDT';
const destTokenSymbol = 'DAI';

describe(Regression('Swap from Token view'), () => {
const swapOnboarded = true; // TODO: Set it to false once we show the onboarding page again.
Expand All @@ -47,7 +49,7 @@ describe(Regression('Swap from Token view'), () => {
jest.setTimeout(150000);
});

it('should complete a USDC to DAI swap from the token chart', async () => {
it('should complete a USDT to ETH swap from the token chart', async () => {
await TabBarComponent.tapWallet();
await Assertions.checkIfVisible(WalletView.container);
await WalletView.tapOnToken('Ethereum');
Expand All @@ -58,15 +60,15 @@ describe(Regression('Swap from Token view'), () => {
await Assertions.checkIfVisible(QuoteView.getQuotes);
await QuoteView.tapOnSelectSourceToken();
await QuoteView.tapSearchToken();
await QuoteView.typeSearchToken('LINK');
await QuoteView.typeSearchToken(sourceTokenSymbol);
await TestHelpers.delay(1000);
await QuoteView.selectToken('LINK');
await QuoteView.enterSwapAmount('5');
await QuoteView.selectToken(sourceTokenSymbol);
await QuoteView.enterSwapAmount('10');
await QuoteView.tapOnSelectDestToken();
await QuoteView.tapSearchToken();
await QuoteView.typeSearchToken('DAI');
await QuoteView.typeSearchToken(destTokenSymbol);
await TestHelpers.delay(1000);
await QuoteView.selectToken('DAI');
await QuoteView.selectToken(destTokenSymbol);
await QuoteView.tapOnGetQuotes();
await Assertions.checkIfVisible(SwapView.fetchingQuotes);
await Assertions.checkIfVisible(SwapView.quoteSummary);
Expand All @@ -75,7 +77,7 @@ describe(Regression('Swap from Token view'), () => {
await SwapView.swipeToSwap();
try {
await Assertions.checkIfVisible(
SwapView.swapCompleteLabel('LINK', 'DAI'),
SwapView.swapCompleteLabel(sourceTokenSymbol, destTokenSymbol),
100000,
);
} catch (e) {
Expand All @@ -84,22 +86,23 @@ describe(Regression('Swap from Token view'), () => {
}
await device.enableSynchronization();
await TestHelpers.delay(5000);
await TokenOverview.tapBackButton();
await TabBarComponent.tapActivity();
await Assertions.checkIfVisible(ActivitiesView.title);
await Assertions.checkIfVisible(ActivitiesView.swapActivity('LINK', 'DAI'));
await ActivitiesView.tapOnSwapActivity('LINK', 'DAI');
await Assertions.checkIfVisible(ActivitiesView.swapActivity(sourceTokenSymbol, destTokenSymbol));
await ActivitiesView.tapOnSwapActivity(sourceTokenSymbol, destTokenSymbol);

try {
await Assertions.checkIfVisible(DetailsModal.title);
} catch (e) {
await ActivitiesView.tapOnSwapActivity('LINK', 'DAI');
await ActivitiesView.tapOnSwapActivity(sourceTokenSymbol, destTokenSymbol);
await Assertions.checkIfVisible(DetailsModal.title);
}

await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfElementToHaveText(
DetailsModal.title,
DetailsModal.generateExpectedTitle('LINK', 'DAI'),
DetailsModal.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
);
await Assertions.checkIfVisible(DetailsModal.statusConfirmed);
await DetailsModal.tapOnCloseIcon();
Expand Down
9 changes: 5 additions & 4 deletions e2e/utils/Matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Matchers {
*
* @param {string} elementId - Match elements with the specified testID
* @param {number} [index] - Index of the element (default: 0)
* @return {Promise<Detox.IndexableNativeElement> | Promise<Detox.NativeElement>} - Resolves to the located element
* @return {Promise<Detox.IndexableNativeElement | Detox.NativeElement>} - Resolves to the located element
*/
static async getElementByID(elementId, index) {
if (index) {
Expand Down Expand Up @@ -49,7 +49,8 @@ class Matchers {
* Get element by label.
*
* @param {string} label - Match elements with the specified accessibility label (iOS) or content description (Android)
* @return {Promise<Detox.IndexableNativeElement>} - Resolves to the located element
* @param {number} index - Index of the element (default: 0)
* @return {Promise<Detox.NativeElement>} - Resolves to the located element
*/
static async getElementByLabel(label, index = 0) {
return element(by.label(label)).atIndex(index);
Expand Down Expand Up @@ -96,7 +97,7 @@ class Matchers {
*
* @param {string} webviewID - The web ID of the inner element to locate within the webview
* @param {string} innerID - The web ID of the browser webview
* @return {Promise<Detox.IndexableWebElement>} Resolves to the located element
* @return {Promise<Detox.IndexableWebElement | Detox.SecuredWebElementFacade>} Resolves to the located element
*/
static async getElementByWebID(webviewID, innerID) {
const myWebView = this.getWebViewByID(webviewID);
Expand All @@ -119,7 +120,7 @@ class Matchers {
* Get element by XPath.
* @param {string} webviewID - The web ID of the browser webview
* @param {string} xpath - XPath expression to locate the element
* @return {Promise<Detox.WebElement>} - Resolves to the located element
* @return {Promise<Detox.IndexableWebElement | Detox.SecuredWebElementFacade>} - Resolves to the located element
*/
static async getElementByXPath(webviewID, xpath) {
const myWebView = this.getWebViewByID(webviewID);
Expand Down
Loading