Skip to content

Commit fc07445

Browse files
committed
Fixed lint and formatting
1 parent 71711e5 commit fc07445

4 files changed

Lines changed: 50 additions & 27 deletions

File tree

test/e2e/page-objects/pages/bridge/quote-page.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ class BridgeQuotePage {
7373
private networkNameSelector = (network: string) =>
7474
`[data-testid="${network}"]`;
7575

76+
private transactionComplete = {
77+
tag: 'h4',
78+
text: 'Your transaction is complete',
79+
};
80+
81+
private transactionFailed = { tag: 'h4', text: 'Your transaction failed' };
82+
83+
private closeButton =
84+
'[data-testid="smart-transaction-status-page-footer-close-button"]';
85+
7686
constructor(driver: Driver) {
7787
this.driver = driver;
7888
}
@@ -226,33 +236,21 @@ class BridgeQuotePage {
226236

227237
checkTransactionCompleteAndViewActivity = async () => {
228238
console.log('Waiting for transaction complete modal');
229-
await this.driver.waitForSelector(
230-
{
231-
css: 'h4',
232-
text: 'Your transaction is complete',
233-
},
234-
{ timeout: 30000 },
235-
);
239+
await this.driver.waitForSelector(this.transactionComplete, {
240+
timeout: 60000,
241+
});
236242
console.log('Transaction complete modal is displayed');
237-
await this.driver.clickElement(
238-
'[data-testid="smart-transaction-status-page-footer-close-button"]',
239-
);
243+
await this.driver.clickElement(this.closeButton);
240244
console.log('Clicked View activity button');
241245
};
242246

243247
checkTransactionFailedAndViewActivity = async () => {
244248
console.log('Waiting for transaction failed modal');
245-
await this.driver.waitForSelector(
246-
{
247-
css: 'h4',
248-
text: 'Your transaction failed',
249-
},
250-
{ timeout: 30000 },
251-
);
249+
await this.driver.waitForSelector(this.transactionFailed, {
250+
timeout: 60000,
251+
});
252252
console.log('Transaction failed modal is displayed');
253-
await this.driver.clickElement(
254-
'[data-testid="smart-transaction-status-page-footer-close-button"]',
255-
);
253+
await this.driver.clickElement(this.closeButton);
256254
console.log('Clicked View activity button');
257255
};
258256

test/e2e/tests/bridge/bridge-L2-tests.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ describe('Bridge tests', function (this: Suite) {
88
this.timeout(120000); // Needs a higher timeout as it's a longer tests
99
it('should execute bridge transactions on L2 networks', async function () {
1010
await withFixtures(
11-
getBridgeL2Fixtures(this.test?.fullTitle(), BRIDGE_FEATURE_FLAGS_WITH_SSE_ENABLED, true),
11+
getBridgeL2Fixtures(
12+
this.test?.fullTitle(),
13+
BRIDGE_FEATURE_FLAGS_WITH_SSE_ENABLED,
14+
true,
15+
),
1216
async ({ driver }) => {
1317
await login(driver, { expectedBalance: '$225,730.11' });
1418

test/e2e/tests/bridge/bridge-test-utils.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export class BridgePage {
102102
* @param testParams.expectedDestAmount - The expected quoted destination amounts in the quote page
103103
* @param testParams.submitDelay - The delay to wait before submitting the transaction, must be less than the refresh interval of the stream
104104
* @param testParams.expectedStatus - The expected state of the transaction
105+
* @param testParams.withSmartTransactions
105106
*/
106107
export const bridgeTransaction = async ({
107108
driver,
@@ -142,6 +143,8 @@ export const bridgeTransaction = async ({
142143

143144
if (withSmartTransactions) {
144145
await bridgePage.checkTransactionCompleteAndViewActivity();
146+
} else {
147+
await homePage.goToActivityList();
145148
}
146149

147150
const activityList = new ActivityListPage(driver);
@@ -544,7 +547,7 @@ const emitLine = (controller: ReadableStreamDefaultController, line: string) =>
544547
* @param delay - The delay to wait between emitting each quote
545548
* @returns The Readable stream
546549
*/
547-
const mockSseEventSource = (mockQuotes: unknown[], delay: number = 2000) => {
550+
function mockSseEventSource(mockQuotes: unknown[], delay: number = 2000) {
548551
let index = 0;
549552
return Readable.fromWeb(
550553
new ReadableStreamWeb({
@@ -561,7 +564,7 @@ const mockSseEventSource = (mockQuotes: unknown[], delay: number = 2000) => {
561564
},
562565
}),
563566
);
564-
};
567+
}
565568

566569
async function mockFeatureFlags(
567570
mockServer: Mockttp,
@@ -575,7 +578,11 @@ async function mockFeatureFlags(
575578
ok: true,
576579
statusCode: 200,
577580
json: [
578-
{ bridgeConfig: featureFlags, extensionUxPna25: true, ...additionalFlags },
581+
{
582+
bridgeConfig: featureFlags,
583+
extensionUxPna25: true,
584+
...additionalFlags,
585+
},
579586
],
580587
};
581588
});
@@ -1064,6 +1071,10 @@ const STX_TRANSACTION_HASH =
10641071
* via eth_sendRawTransaction. Anvil mines it immediately, so the real tx hash is
10651072
* on-chain and eth_getTransactionReceipt returns a genuine receipt — which is what
10661073
* the extension's TransactionController needs to mark the transaction as Confirmed.
1074+
* @param mockServer
1075+
* @param chainId
1076+
* @param sentinelUrl
1077+
* @param batchStatusOverride
10671078
*/
10681079
async function mockSmartTransactionsForBridge(
10691080
mockServer: Mockttp,
@@ -1420,7 +1431,11 @@ export const getQuoteNegativeCasesFixtures = (
14201431
testSpecificMock: async (mockServer: Mockttp) => {
14211432
const mocks = [
14221433
await mockTopAssetsLinea(mockServer),
1423-
await mockGetQuoteInvalid(mockServer, options, featureFlags.sse?.enabled),
1434+
await mockGetQuoteInvalid(
1435+
mockServer,
1436+
options,
1437+
featureFlags.sse?.enabled,
1438+
),
14241439
await mockTokensLinea(mockServer),
14251440
await mockGetPopularTokens(mockServer),
14261441
await mockPriceSpotPrices(mockServer),
@@ -1776,7 +1791,11 @@ export const getBridgeL2Fixtures = (
17761791
mocks.push(...(await mockSearchTokens(mockServer)));
17771792

17781793
if (withSmartTransactions) {
1779-
await mockSmartTransactionsForBridge(mockServer, 59144, LINEA_SENTINEL_URL);
1794+
await mockSmartTransactionsForBridge(
1795+
mockServer,
1796+
59144,
1797+
LINEA_SENTINEL_URL,
1798+
);
17801799
}
17811800

17821801
return mocks.filter(Boolean);

test/e2e/tests/smart-transactions/mocks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,9 @@ export async function mockSmartTransactionBatchRequests(
705705
}
706706
}
707707

708-
export async function mockSmartTransactionRequestsBase(mockServer: MockttpServer) {
708+
export async function mockSmartTransactionRequestsBase(
709+
mockServer: MockttpServer,
710+
) {
709711
await mockMultiNetworkBalancePolling(mockServer);
710712

711713
await mockServerJsonRpc(mockServer, [

0 commit comments

Comments
 (0)