Skip to content

Commit

Permalink
Merge pull request #408 from Web3Auth/demo_wallet
Browse files Browse the repository at this point in the history
Wallet services test cases enabled
  • Loading branch information
vinayaktorus authored Sep 19, 2024
2 parents 1e0beb9 + 43db0fa commit ff79a2d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/walletservice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
schedule:
- cron: "0 */2 * * *"
- cron: "0 0 * * *"

env:
NODE_VERSION: 20
Expand Down
8 changes: 4 additions & 4 deletions walletservices/wallet-service/WalletServicesPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export class WalletServicesPage {
}

async verifyTransferFromAddress(content: string) {
expect(
await this.page.locator(`xpath=.//p[text()='Sepolia Test Network']/parent::div/following-sibling::div//p`).first().textContent()
).toContain(content);
expect(await this.page.locator(`xpath=.//p[text()='Polygon Amoy']/parent::div/following-sibling::div//p`).first().textContent()).toContain(
content
);
}

async verifyTransferToAddress(content: string) {
expect(await this.page.locator(`xpath=.//p[text()='Sepolia Test Network']/parent::div/following-sibling::div//p`).last().textContent()).toContain(
expect(await this.page.locator(`xpath=.//p[text()='Polygon Amoy']/parent::div/following-sibling::div//p`).last().textContent()).toContain(
content
);
}
Expand Down
51 changes: 19 additions & 32 deletions walletservices/wallet-service/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { WalletServicesPage } from "./WalletServicesPage";

const walletServiceLoginURL = "https://develop-wallet.web3auth.io";

const testEmail = "kelg8.j5s90ldb0b35@inbox.testmail.app";
const testEmail = "kelg8.wallet@inbox.testmail.app";

test.describe.serial("Core Wallet Services Scenarios @smoke", () => {
let page: Page;
Expand All @@ -28,18 +28,18 @@ test.describe.serial("Core Wallet Services Scenarios @smoke", () => {
await accountsPage.enableTestNetworks();
await accountsPage.selectNetwork("Ethereum", "Ethereum");
await accountsPage.clickHome();
await accountsPage.verifyBalanceAndAddress("0x0dBa...4e49F", "0");
await accountsPage.verifyBalanceAndAddress("0xed21...4C0a7", "0");
});

test(`Verify network switch and balance on wallet services`, async () => {
const accountsPage = new WalletServicesPage(page);
await accountsPage.verifyNetworkName("Ethereum");
await accountsPage.navigateToSettingsWithOption("General");
await accountsPage.selectNetwork("Ethereum", "Sepolia Test Network");
await accountsPage.selectNetwork("Ethereum", "Polygon Amoy");
await accountsPage.selectCurrency("USD");
await accountsPage.clickHome();
await accountsPage.verifyNetworkName("Sepolia Test Network");
await accountsPage.verifyBalanceAndAddress("0x0dBa...4e49F", "1500");
await accountsPage.verifyNetworkName("Polygon Amoy");
await accountsPage.verifyBalanceAndAddress("0xed21...4C0a7", "0.08");
});

test(`Verify validations on send transaction screen`, async () => {
Expand All @@ -64,77 +64,64 @@ test.describe.serial("Core Wallet Services Scenarios @smoke", () => {

test(`Verify details displayed on send transaction screen`, async () => {
const accountsPage = new WalletServicesPage(page);
await accountsPage.verifyAvailableBalance("0.6");
await accountsPage.verifyAvailableBalance("0.1899 MATIC");
await accountsPage.enterTransactionAmount("0.0001");
await accountsPage.clickButton("Submit");
await accountsPage.verifyTransferTokenAmount("0.0001 ETH");
await accountsPage.verifyTransferFromAddress("0x0dBa...4e49F");
await accountsPage.verifyTransferTokenAmount("0.0001 MATIC");
await accountsPage.verifyTransferFromAddress("0xed21...4C0a7");
await accountsPage.verifyTransferToAddress("0x9904...ADE6A");
});

test.skip(`Verify existing assets are displayed`, async () => {
const accountsPage = new WalletServicesPage(page);
await page.goto(`${walletServiceLoginURL}/wallet/home`);
await accountsPage.navigateToSettingsWithOption("General");
await accountsPage.selectNetwork("Main Ethereum Network", "Sepolia Test Network");
await accountsPage.clickHome();
await accountsPage.navigateToSettingsWithOption("General");
await accountsPage.selectNetwork("Main Ethereum Network", "Polygon Mumbai");
await accountsPage.clickHome();
await accountsPage.verifyNftIsPresent("final_touch");
await accountsPage.verifyNftIsPresent("SampleERC721");
});

test(`Verify user is able to view the sent transaction activity`, async () => {
const accountsPage = new WalletServicesPage(page);
await page.goto(`${walletServiceLoginURL}/wallet/home`);
await accountsPage.navigateToSettingsWithOption("General");
await accountsPage.selectNetwork("Main Ethereum Network", "Sepolia Test Network");
await accountsPage.selectNetwork("Main Ethereum Network", "Polygon Amoy");
await accountsPage.clickHome();
await accountsPage.clickLink(" Activity");
await page.waitForURL(`${walletServiceLoginURL}/wallet/activity`, {
waitUntil: "load",
});
await accountsPage.verifyTransactionActivity("Sent ETH|cfa5|10:11:30 | 8 May 2024");
await accountsPage.verifyTransactionActivity("Received ETH|e49f|20:22:18 | 1 May 2024");
await accountsPage.verifyTransactionActivity("Sent MATIC|to 0x9904bf11c69233454162b72d7289ccbb295ade6a|20:12:44 | 19 Sept 2024");
await accountsPage.verifyTransactionActivity("Received MATIC|to 0xed2130dd79960a00be8abe75962c75678af4c0a7|19:57:52 | 19 Sept 2024");
});

test(`Verify user is able to switch currency`, async () => {
const accountsPage = new WalletServicesPage(page);
await page.goto(`${walletServiceLoginURL}/wallet/home`);
await accountsPage.clickLink(" Home");
await accountsPage.navigateToSettingsWithOption("General");
await accountsPage.selectNetwork("Main Ethereum Network", "Polygon Amoy");
await accountsPage.selectCurrency("SGD");
await accountsPage.clickHome();
await accountsPage.verifyBalanceAndAddress("0x0dBa...4e49F", "0.21");
});

test.skip(`Verify user is able to import account`, async () => {
const accountsPage = new WalletServicesPage(page);
await accountsPage.navigateToSettingsWithOption("Manage Wallets");
await accountsPage.clickButton(" Import Account");
await accountsPage.inputPrivateKey("18a6aa7e43a8f7f57c4cfb8d322cc9c12cd4cc573ea137c9bcd6d2b5d060a90a");
await accountsPage.clickLink(" Home");
await accountsPage.verifyBalanceAndAddress("0x2b7f47e9bb...B99a8a33151c", "0.00013");
await accountsPage.verifyBalanceAndAddress("0xed21...4C0a7", "0.08");
});

test(`Verify user is able to connect via wallet connect`, async () => {
const accountsPage = new WalletServicesPage(page);
await page.goto(`${walletServiceLoginURL}/wallet/home`);
await accountsPage.navigateToSettingsWithOption("General");
await accountsPage.selectNetwork("Main Ethereum Network", "Ethereum");
await accountsPage.clickHome();
await accountsPage.clickButton(" Wallet connect");
await page.waitForSelector('[aria-placeholder="Paste QR link here"]');
expect(await page.locator('[aria-placeholder="Paste QR link here"]').first().isVisible()).toBeTruthy();
});

test(`Verify user is able to buy tokens`, async () => {
const accountsPage = new WalletServicesPage(page);
await accountsPage.navigateToSettingsWithOption("General");
await accountsPage.selectNetwork("Main Ethereum Network", "Ethereum");
await page.goto(`${walletServiceLoginURL}/wallet/home`);
await accountsPage.clickHome();
await accountsPage.clickOption("Buy");
await page.waitForURL(`${walletServiceLoginURL}/wallet/checkout`, {
waitUntil: "load",
});
await delay(10000);
await delay(5000);
await accountsPage.verifyBuyOption();
});
});

0 comments on commit ff79a2d

Please sign in to comment.