minor test to covering sending funds to a wallet
. quick and simple, subject to obviously change.
This commit is contained in:
@@ -8,10 +8,12 @@
|
||||
"build": "yarn parcel build src/index.html"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nymproject/nym-validator-client": "^0.18.0"
|
||||
"@nymproject/nym-validator-client": "^0.18.0",
|
||||
"puppeteer": "^11.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/transformer-sass": "^2.0.1",
|
||||
"jest-puppeteer": "^6.0.0",
|
||||
"parcel": "^2.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ import Validator from '@nymproject/nym-validator-client';
|
||||
error?: any;
|
||||
}) => {
|
||||
if (success && balanceElem) {
|
||||
balanceElem.innerHTML = `Successfuly transfered ${amount!} upunk to address ${accountAddress!}`;
|
||||
balanceElem.innerHTML = `Successfully transfered ${amount!} upunk to address ${accountAddress!}`;
|
||||
} else if (!success && balanceElem) {
|
||||
balanceElem.innerHTML = `Transfer failed - ${error}`;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
localhost: "http://localhost:1234"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "sendaddress": "" }
|
||||
@@ -0,0 +1,35 @@
|
||||
const puppeteer = require('puppeteer');
|
||||
const data = require('./config/test-data.json');
|
||||
const faucet = require('./pageobjects/elements');
|
||||
const environments = require('./config/environments');
|
||||
|
||||
const WALLET_ADDRESS = data.sendaddress;
|
||||
|
||||
const homepageTest = async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto(environments.localhost);
|
||||
|
||||
await page.waitForSelector(faucet.inputAddress);
|
||||
await page.type(faucet.inputAddress, WALLET_ADDRESS);
|
||||
await page.type(faucet.inputAmount, '5');
|
||||
await page.click(faucet.requestTokens);
|
||||
|
||||
//wait the longest period of time for the transaction to finish
|
||||
await page.waitForTimeout(8000);
|
||||
|
||||
await page.waitForSelector('.balance:not(:empty)');
|
||||
|
||||
const element = await page.$(faucet.transaction);
|
||||
const text = await page.evaluate((element) => element.textContent, element);
|
||||
|
||||
//Successfuly transfered 5 upunk to address `punkaddress`
|
||||
//input browser
|
||||
console.log(text);
|
||||
|
||||
await page.screenshot({ path: 'successful_transaction.png' });
|
||||
|
||||
await browser.close();
|
||||
};
|
||||
homepageTest();
|
||||
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
inputAddress: '#address-input',
|
||||
requestTokens: '#request-tokens',
|
||||
inputAmount: '#amount-input',
|
||||
transaction: '.balance'
|
||||
};
|
||||
Reference in New Issue
Block a user