From 944685ca7be1f8bbf424800c64f60f8a4ed9d17f Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Apr 2024 17:16:04 +0100 Subject: [PATCH] Updates 2 (#6) * Update paseo RPC wss://sys.dotters.network/paseo (#398) * Prettier write * Make properties public. Remove try catches. Lint * remove console.log * Increase test timeout * try installing playwright with yarn --------- Co-authored-by: Maksym H <1177472+mordamax@users.noreply.github.com> --- .github/workflows/deploy-site.yml | 2 +- client/src/app.css | 5 +--- client/src/app.html | 2 +- client/tests/faucet.ts | 4 ++- src/networkData.ts | 2 +- src/test/setupE2EProcaptcha.ts | 49 +++++++------------------------ src/test/webhookHelpers.ts | 1 - 7 files changed, 18 insertions(+), 47 deletions(-) diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 8d6c3352..5d2b45e7 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -26,7 +26,7 @@ jobs: - run: yarn install --frozen-lockfile - run: yarn run check - name: Install Playwright - run: npx playwright install + run: yarn playwright install --with-deps - run: yarn run test - run: yarn run build env: diff --git a/client/src/app.css b/client/src/app.css index df9a8783..2f321b94 100644 --- a/client/src/app.css +++ b/client/src/app.css @@ -44,10 +44,7 @@ body { background-repeat: no-repeat; position: absolute; background-position-y: 10%, 73%, 50%; - background-position-x: - 25%, - -13%, - 115%; + background-position-x: 25%, -13%, 115%; background-size: 20%, 20%, 30%; bottom: 0px; right: 0px; diff --git a/client/src/app.html b/client/src/app.html index c88f65f9..ad7e7593 100644 --- a/client/src/app.html +++ b/client/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/client/tests/faucet.ts b/client/tests/faucet.ts index e4d5cbe4..d937d02f 100644 --- a/client/tests/faucet.ts +++ b/client/tests/faucet.ts @@ -232,7 +232,9 @@ export class FaucetTests { }); test.describe("form interaction", () => { - test("submit form becomes valid on data entry", async ({ page }, { config }) => { + test("submit form becomes valid on data entry", async ({ page }, testInfo) => { + const config = testInfo.config; + testInfo.setTimeout(testInfo.timeout * 2); await page.goto(this.url); const { address, captcha, submit } = await getFormElements(page, this.getCaptchaProvider(config), true); await expect(submit).toBeDisabled(); diff --git a/src/networkData.ts b/src/networkData.ts index 1b874ead..255d4065 100644 --- a/src/networkData.ts +++ b/src/networkData.ts @@ -85,7 +85,7 @@ const paseo: NetworkData = { dripAmount: "100", explorer: null, networkName: "Paseo", - rpcEndpoint: "wss://paseo.rpc.amforc.com/", + rpcEndpoint: "wss://sys.dotters.network/paseo", matrixWhitelistPatterns: [ /^@erin:parity\.io$/, /^@mak:parity\.io$/, diff --git a/src/test/setupE2EProcaptcha.ts b/src/test/setupE2EProcaptcha.ts index 81264576..529a402b 100644 --- a/src/test/setupE2EProcaptcha.ts +++ b/src/test/setupE2EProcaptcha.ts @@ -21,27 +21,15 @@ export type ProcaptchaTestSetup = { const GAS_INCREASE_FACTOR = 2 export class ProcaptchaSetup { - private _api: ApiPromise; - private _siteKey: string; - private _port: number; + public api: ApiPromise; + public siteKey: string; + public port: number; private _transactionQueue: TransactionQueue | undefined; constructor(api: ApiPromise, siteKey: string, port: number) { - this._api = api; - this._siteKey = siteKey; - this._port = port; - } - - get api(): ApiPromise { - return this._api - } - - get port(): number { - return this._port - } - - get siteKey(): string { - return this._siteKey + this.api = api; + this.siteKey = siteKey; + this.port = port; } get transactionQueue(): TransactionQueue { @@ -56,7 +44,6 @@ export class ProcaptchaSetup { } async isReady() { - try { await this.api.isReady; const alicePair = await getPairAsync(undefined, '//Alice', undefined, 'sr25519', 42) const contract = await this.deployProcaptchaContract(alicePair); @@ -74,9 +61,7 @@ export class ProcaptchaSetup { await this.procaptchaAppRegister(contract, this.siteKey); return {contract, contractAddress: contract.address, testAccount: alicePair.address, siteKey: this.siteKey} - } catch (e) { - throw new Error(`Failed to setup Procaptcha: ${JSON.stringify(e, null, 4)}`) - } + } @@ -105,7 +90,6 @@ export class ProcaptchaSetup { } async procaptchaProviderRegister(contract: ProsopoCaptchaContract, port: number): Promise { - try { console.log("Registering Procaptcha provider") const value = (await contract.query.getProviderStakeThreshold()).value.unwrap().toNumber() const providerRegisterArgs: Parameters = [ @@ -114,16 +98,13 @@ export class ProcaptchaSetup { Payee.dapp ] await this.submitTx(contract, contract.query.providerRegister.name, providerRegisterArgs, value, contract.pair) - } catch (e) { - throw new Error(`Failed to register Procaptcha provider: ${JSON.stringify(e, null, 4)}`) - } + } async procaptchaProviderSetDataset(contract: ProsopoCaptchaContract): Promise<{ datasetId: Hash, datasetContentId: Hash }> { - try { console.log("Setting Procaptcha provider dataset") const providerSetDatasetArgs: Parameters = [ "0x28c1ba9d21c00f2e29c9ace8c46fd7dbfbb6f5a5f516771278635ac3ab88c267" as Hash, // hashed value of "TESTDATASET" @@ -135,13 +116,10 @@ export class ProcaptchaSetup { datasetId: providerSetDatasetArgs[0], datasetContentId: providerSetDatasetArgs[1] } - } catch (e) { - throw new Error(`Failed to set Procaptcha provider dataset: ${JSON.stringify(e, null, 4)}`) - } + } async procaptchaAppRegister(contract: ProsopoCaptchaContract, siteKey: string): Promise { - try { console.log("Registering Procaptcha app") const value = (await contract.query.getDappStakeThreshold()).value.unwrap().toNumber() const appRegisterArgs: Parameters = [ @@ -149,9 +127,7 @@ export class ProcaptchaSetup { DappPayee.dapp ] await this.submitTx(contract, contract.query.dappRegister.name, appRegisterArgs, value) - } catch (e) { - throw new Error(`Failed to register Procaptcha app: ${JSON.stringify(e, null, 4)}`) - } + } private async submitTx( @@ -168,7 +144,6 @@ export class ProcaptchaSetup { contract.nativeContract.tx[methodName] !== undefined ) { - try { const weight = await getWeight(this.api) const txPair = pair ? pair : contract.pair @@ -217,9 +192,7 @@ export class ProcaptchaSetup { reject(err) }) }) - } catch (e) { - throw new Error(`Failed to submit Procaptcha transaction: ${JSON.stringify(e, null, 4)}`) - } + } else { throw new Error('CONTRACT.INVALID_METHOD') diff --git a/src/test/webhookHelpers.ts b/src/test/webhookHelpers.ts index fee0738f..e5703e11 100644 --- a/src/test/webhookHelpers.ts +++ b/src/test/webhookHelpers.ts @@ -21,7 +21,6 @@ export async function drip(webEndpoint: string, address: string, parachainId?: s provider: "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM", blockNumber: blockNumber }) - console.log("Captcha response", captchaResponse) const body: { address: string, captchaResponse: string, parachain_id?: string } = { address: address, captchaResponse