From 1c986fcff2b14439e4d945bfe2b09770b6533ad5 Mon Sep 17 00:00:00 2001 From: Zhixin Zhou Date: Thu, 6 Mar 2025 17:19:17 +1100 Subject: [PATCH] update e2e test script about nft evm transaction --- e2e/sendTransaction.test.ts | 86 ++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/e2e/sendTransaction.test.ts b/e2e/sendTransaction.test.ts index dd153cd2..27cbbbe2 100644 --- a/e2e/sendTransaction.test.ts +++ b/e2e/sendTransaction.test.ts @@ -58,7 +58,50 @@ export const moveTokenCoaHomepage = async ({ page, tokenname, amount = '0.000000 // Wait for the transaction to be completed await waitForTransaction({ page, successtext: 'success', amount }); }; - +export const sendNftCOA = async ({ page, nftname, receiver, successtext }) => { + // Wait for the EVM account to be loaded + await getCurrentAddress(page); + await page.getByRole('tab', { name: 'NFTs' }).click(); + await page.getByRole('button', { name: nftname }).click(); + await page.getByRole('link').nth(0).click(); + await page.getByRole('button', { name: 'Send' }).click(); + await page.getByPlaceholder('Search, Address(0x) or Flow').click(); + await page.getByPlaceholder('Search, Address(0x) or Flow').fill(receiver); + await page.getByRole('button', { name: 'Send' }).click(); + // // Wait for the transaction to be completed + await waitForTransaction({ page, successtext }); +}; +export const moveNftCOA = async ({ page, nftname, receiver, successtext }) => { + // Wait for the EVM account to be loaded + await getCurrentAddress(page); + await page.getByRole('tab', { name: 'NFTs' }).click(); + await page.getByRole('button', { name: nftname }).click(); + await page.getByRole('link').nth(0).click(); + await page.getByRole('button', { name: 'Move' }).click(); + await page.getByRole('combobox').click(); + await page.getByRole('option', { name: receiver }).click(); + await page.getByRole('button', { name: 'Move' }).click(); + // // Wait for the transaction to be completed + await waitForTransaction({ page, successtext }); +}; +export const batchmoveNftCOA = async ({ page, nftname, receiver, successtext }) => { + // Wait for the EVM account to be loaded + await getCurrentAddress(page); + await page + .locator('div') + .filter({ hasText: /^Move$/ }) + .getByRole('button') + .click(); + await page.getByRole('button', { name: 'Move NFTs' }).click(); + await page.getByRole('combobox').click(); + await page.getByRole('option', { name: receiver }).click(); + await page.getByRole('button').nth(1).click(); + await page.getByRole('button', { name: 'TopShot' }).click(); + await page.getByRole('button', { name: '#' }).nth(0).click(); + await page.getByRole('button', { name: 'Move' }).click(); + // Wait for the transaction to be completed + await waitForTransaction({ page, successtext }); +}; test.beforeEach(async ({ page, extensionId }) => { // Login to our sender account await loginToSenderAccount({ page, extensionId }); @@ -172,6 +215,47 @@ test('move USDC token COA to FLOW homepage', async ({ page }) => { }); }); */ //Send NFT from COA to COA +test('send top shot COA to COA', async ({ page }) => { + await sendNftCOA({ + page, + nftname: 'NBA Top Shot', + receiver: process.env.TEST_RECEIVER_EVM_ADDR!, + successtext: 'success', + }); +}); //Send NFT from COA to FLOW +test('send top shot COA to FLOW', async ({ page }) => { + await sendNftCOA({ + page, + nftname: 'NBA Top Shot', + receiver: process.env.TEST_RECEIVER_ADDR!, + successtext: 'success', + }); +}); //Send NFT from COA to EOA +test('send top shot COA to EOA', async ({ page }) => { + await sendNftCOA({ + page, + nftname: 'NBA Top Shot', + receiver: process.env.TEST_RECEIVER_METAMASK_EVM_ADDR!, + successtext: 'success', + }); +}); //Move NFT from COA to FLOW +test('Move top shot COA to FLOW', async ({ page }) => { + await moveNftCOA({ + page, + nftname: 'NBA Top Shot', + receiver: process.env.TEST_SENDER_ADDR!, + successtext: 'success', + }); +}); +//Batch move NFT from COA to FLOW +test('Batch Move top shot COA to FLOW', async ({ page }) => { + await batchmoveNftCOA({ + page, + nftname: 'TopShot', + receiver: process.env.TEST_SENDER_ADDR!, + successtext: 'success', + }); +});