diff --git a/integration_test/cli/gen-wallets.js b/integration_test/cli/gen-wallets.js index cf8f390..3c73dca 100644 --- a/integration_test/cli/gen-wallets.js +++ b/integration_test/cli/gen-wallets.js @@ -3,6 +3,7 @@ const fs = require('fs'); function createRange(start, end) { return Array.from({ length: end - start }, (_, i) => start + i); } +NETWORK_ID=1 async function genWallet() { // create workshops first @@ -14,8 +15,8 @@ async function genWallet() { const nthWallet = await wallet.getAccount(index); let singleAddress = await nthWallet.singleAddressWallet(); walletJson = singleAddress.toJSON(); - walletJson.address = singleAddress.addressBech32(0); - walletJson.stakeAddress = singleAddress.rewardAddressBech32(0); + walletJson.address = singleAddress.addressBech32(NETWORK_ID); + walletJson.stakeAddress = singleAddress.rewardAddressBech32(NETWORK_ID); return walletJson; }; // make first 3 wallets for manual testing diff --git a/integration_test/lib/constants/environments.ts b/integration_test/lib/constants/environments.ts index bbb4f25..6e126dd 100644 --- a/integration_test/lib/constants/environments.ts +++ b/integration_test/lib/constants/environments.ts @@ -7,7 +7,7 @@ const environments = { process.env.KUBER_API_URL || 'https://sanchonet.kuber.cardanoapi.io', apiKey: process.env.KUBER_API_KEY || '', }, - networkId: process.env.NETWORK_ID || 0, + networkId: process.env.NETWORK_ID || '0', ci: process.env.CI, }; diff --git a/integration_test/lib/fixtures/importWallet.ts b/integration_test/lib/fixtures/importWallet.ts index bb5e8a9..f218060 100644 --- a/integration_test/lib/fixtures/importWallet.ts +++ b/integration_test/lib/fixtures/importWallet.ts @@ -2,18 +2,6 @@ import { CardanoTestWalletJson } from '@cardanoapi/cardano-test-wallet/types'; import { Page } from '@playwright/test'; import { StaticWallet } from '@types'; -export async function importWallet( - page: Page, - wallet: StaticWallet | CardanoTestWalletJson -): Promise { - await page.addInitScript((wallet) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - //@ts-ignore - window.cardanoTestWallet= {wallet: wallet} - }, wallet); -} - - export async function injectWalletExtension( page: Page, wallet: StaticWallet | CardanoTestWalletJson @@ -21,8 +9,17 @@ export async function injectWalletExtension( await page.addInitScript((wallet) => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore - window.cardanoTestWallet= {wallet: wallet} + if(window.cardanoTestWallet){ + //@ts-ignore + window.cardanoTestWallet.wallet=wallet + }else{ + //@ts-ignore + window.cardanoTestWallet={wallet} + } + //@ts-ignore }, wallet); } + +export const importWallet = injectWalletExtension \ No newline at end of file diff --git a/integration_test/lib/fixtures/loadExtension.ts b/integration_test/lib/fixtures/loadExtension.ts index fe79b50..5915ae8 100644 --- a/integration_test/lib/fixtures/loadExtension.ts +++ b/integration_test/lib/fixtures/loadExtension.ts @@ -21,6 +21,7 @@ export default async function loadEternlExtension( enableStakeSigning, kuberApiUrl: environments.kuber.apiUrl, kuberApiKey: environments.kuber.apiKey, + networkId: parseInt(environments.networkId), }; await page.addInitScript( ({ walletConfig, supportedExtensions }) => { diff --git a/integration_test/lib/pages/homePage.ts b/integration_test/lib/pages/homePage.ts index b1685db..8a6a16f 100644 --- a/integration_test/lib/pages/homePage.ts +++ b/integration_test/lib/pages/homePage.ts @@ -1,6 +1,7 @@ import { expect, Locator, Page } from '@playwright/test'; import { faker } from '@faker-js/faker'; import { extractPollIdFromUrl } from '@helpers/string'; +import { blake } from 'libcardano'; export default class HomePage { readonly heading = this.page.getByText( @@ -14,7 +15,7 @@ export default class HomePage { // input readonly pollNameInput = this.page.locator( '[data-testid="poll-name-input"] input' - ); //BUG incorrect position of testid + ); readonly constitutionLinkInput = this.page.locator('[data-testid="poll-link-input"] input').first() @@ -35,8 +36,9 @@ export default class HomePage { ): Promise { await this.createPollBtn.click(); await this.pollNameInput.fill(pollName); - await this.constitutionLinkInput.fill('https://google.com'); - await this.constutionHashInput.fill('aaaa'); + await this.constitutionLinkInput.fill(faker.internet.url()); + const randomHash = blake.hash32(Buffer.from(faker.animal.bear())) + await this.constutionHashInput.fill(randomHash.toString('hex')); await this.submitPollBtn.click();