Skip to content

Commit

Permalink
feat: NFT token transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronfigueiredo committed Oct 21, 2024
1 parent 776bc1e commit 34a5515
Show file tree
Hide file tree
Showing 18 changed files with 674 additions and 5 deletions.
13 changes: 13 additions & 0 deletions test/e2e/page-objects/pages/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class HomePage {
private readonly activityTab =
'[data-testid="account-overview__activity-tab"]';

private readonly nftTab = '[data-testid="account-overview__nfts-tab"]';

private readonly nftIconOnActivityList = '[data-testid="nft-item"]';

private readonly balance = '[data-testid="eth-overview__primary-currency"]';

private readonly completedTransactions = '[data-testid="activity-list-item"]';
Expand Down Expand Up @@ -60,6 +64,15 @@ class HomePage {
await this.driver.clickElement(this.activityTab);
}

async goToNFTList(): Promise<void> {
console.log(`Open NFT tab on homepage`);
await this.driver.clickElement(this.nftTab);
}

async clickNFTIconOnActivityList() {
await this.driver.clickElement(this.nftIconOnActivityList);
}

/**
* This function checks if the specified number of confirmed transactions are displayed in the activity list on homepage.
* It waits up to 10 seconds for the expected number of confirmed transactions to be visible.
Expand Down
17 changes: 17 additions & 0 deletions test/e2e/page-objects/pages/nft-details-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Driver } from '../../webdriver/driver';

class NFTDetailsPage {
private driver: Driver;

private readonly nftSendButton = '[data-testid="nft-send-button"]';

constructor(driver: Driver) {
this.driver = driver;
}

async clickNFTSendButton() {
await this.driver.clickElement(this.nftSendButton);
}
}

export default NFTDetailsPage;
7 changes: 7 additions & 0 deletions test/e2e/page-objects/pages/send/send-token-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class SendTokenPage {

private inputAmount: string;

private inputNFTAmount: string;

private scanButton: string;

private continueButton: object;
Expand All @@ -26,6 +28,7 @@ class SendTokenPage {
constructor(driver: Driver) {
this.driver = driver;
this.inputAmount = '[data-testid="currency-input"]';
this.inputNFTAmount = '[data-testid="nft-input"]';
this.inputRecipient = '[data-testid="ens-input"]';
this.scanButton = '[data-testid="ens-qr-scan-button"]';
this.ensResolvedName =
Expand Down Expand Up @@ -79,6 +82,10 @@ class SendTokenPage {
);
}

async fillNFTAmount(amount: string) {
await this.driver.pasteIntoField(this.inputNFTAmount, amount);
}

async goToNextScreen(): Promise<void> {
await this.driver.clickElement(this.continueButton);
}
Expand Down
36 changes: 36 additions & 0 deletions test/e2e/page-objects/pages/test-dapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ class TestDapp {
tag: 'button',
};

private readonly erc721MintButton = '#mintButton';

private readonly erc721TransferFromButton = '#transferFromButton';

private readonly erc1155TokenIDInput = '#batchMintTokenIds';

private readonly erc1155TokenAmountInput = '#batchMintIdAmounts';

private readonly erc1155MintButton = '#batchMintButton';

private readonly erc1155WatchButton = '#watchAssetButton';

private readonly erc1155RevokeSetApprovalForAllButton =
'#revokeERC1155Button';

Expand Down Expand Up @@ -174,6 +186,30 @@ class TestDapp {
});
}

async clickERC721MintButton() {
await this.driver.clickElement(this.erc721MintButton);
}

async clickERC721TransferFromButton() {
await this.driver.clickElement(this.erc721TransferFromButton);
}

async fillERC1155TokenID(tokenID: string) {
await this.driver.pasteIntoField(this.erc1155TokenIDInput, tokenID);
}

async fillERC1155TokenAmount(amount: string) {
await this.driver.pasteIntoField(this.erc1155TokenAmountInput, amount);
}

async clickERC1155MintButton() {
await this.driver.clickElement(this.erc1155MintButton);
}

async clickERC1155WatchButton() {
await this.driver.clickElement(this.erc1155WatchButton);
}

async clickERC721SetApprovalForAllButton() {
await this.driver.clickElement(this.erc721SetApprovalForAllButton);
}
Expand Down
Loading

0 comments on commit 34a5515

Please sign in to comment.