Grouped ui-e2e tests (#148)
This commit is contained in:
parent
811e8da6b5
commit
0b183fb861
543
ui-e2e/test.js
543
ui-e2e/test.js
@ -42,282 +42,94 @@ test.describe('e2e-test for bridge.poa, version 1.5.0', async function() {
|
||||
}
|
||||
})
|
||||
|
||||
test.it('User is able to open main page of bridge-ui ', async () => {
|
||||
startURL = await Utils.getStartURL()
|
||||
const result = await mainPage.open(startURL)
|
||||
console.log('Test URL: ' + startURL)
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Build failed.')
|
||||
})
|
||||
test.describe('NATIVE TO ERC', async () => {
|
||||
test.it('User is able to open main page of bridge-ui ', async () => {
|
||||
startURL = await Utils.getStartURL()
|
||||
const result = await mainPage.open(startURL)
|
||||
console.log('Test URL: ' + startURL)
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Build failed.')
|
||||
})
|
||||
|
||||
test.it('Home page: disclaimer is displayed ', async () => {
|
||||
const result = await mainPage.confirmDisclaimer()
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Disclaimer is not displayed')
|
||||
})
|
||||
test.it('Home page: disclaimer is displayed ', async () => {
|
||||
const result = await mainPage.confirmDisclaimer()
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Disclaimer is not displayed')
|
||||
})
|
||||
|
||||
test.it('Main page: foreign POA balance is displayed ', async () => {
|
||||
foreignBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
console.log('foreignBalanceBefore = ' + foreignBalanceBefore)
|
||||
const result = foreignBalanceBefore === 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Foreign POA balance is zero or not displayed '
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Main page: home POA balance is displayed ', async () => {
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
console.log('homeBalanceBefore = ' + homeBalanceBefore)
|
||||
const result = homeBalanceBefore !== 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is zero or not displayed '
|
||||
)
|
||||
})
|
||||
|
||||
test.it('User is able to send tokens from Home account to Foreign account ', async () => {
|
||||
const result = await homeAccount.transferTokens(maxAmountPerTransactionLimit)
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Home account to Foreign account'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Home POA balance has correctly changed after transaction', async () => {
|
||||
const newHomeBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = homeBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
homeBalanceBefore = newHomeBalance
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Foreign account has received correct amount of tokens after transaction ', async () => {
|
||||
const newForeignBalance = await mainPage.getForeignPOABalance()
|
||||
|
||||
const shouldBe = foreignBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
|
||||
const result = Math.abs(shouldBe - newForeignBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('User is able to send tokens from Foreign account to Home account ', async () => {
|
||||
await foreignAccount.setMetaMaskNetwork()
|
||||
foreignBalanceBefore = await mainPage.getHomePOABalance()
|
||||
const result = await foreignAccount.transferTokens(maxAmountPerTransactionLimit)
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Home account to Foreign account'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Foreign POA balance has correctly changed after transaction', async () => {
|
||||
const newForeignBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = foreignBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newForeignBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Home account has received correct amount of tokens after transaction ', async () => {
|
||||
const newHomeBalance = await mainPage.getForeignPOABalance()
|
||||
const shouldBe = homeBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('ERC20-ERC20 - User is able to open main page of bridge-ui ', async () => {
|
||||
startURL = await Utils.getErc20StartURL()
|
||||
const result = await mainPage.open(startURL)
|
||||
console.log('Test URL: ' + startURL)
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Build failed.')
|
||||
})
|
||||
|
||||
test.it('ERC20-ERC20 - Home page: disclaimer is displayed ', async () => {
|
||||
const result = await mainPage.confirmDisclaimer()
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Disclaimer is not displayed')
|
||||
})
|
||||
|
||||
test.it('ERC20-ERC20 - Main page: foreign erc20 balance is displayed ', async () => {
|
||||
foreignBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
console.log('foreignBalanceBefore = ' + foreignBalanceBefore)
|
||||
const result = foreignBalanceBefore === 0
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Foreign erc20 balance is not zero')
|
||||
})
|
||||
|
||||
test.it('ERC20-ERC20 - Main page: home erc20 balance is displayed ', async () => {
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
console.log('homeBalanceBefore = ' + homeBalanceBefore)
|
||||
const result = homeBalanceBefore !== 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Home erc20 balance is zero or not displayed '
|
||||
)
|
||||
})
|
||||
|
||||
test.it(
|
||||
'ERC20-ERC20 - User is able to send tokens from Foreign account to Home account ',
|
||||
async () => {
|
||||
homeBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
foreignBalanceBefore = await mainPage.getHomePOABalance()
|
||||
const result = await foreignAccount.transferTokens(maxAmountPerTransactionLimit)
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Foreign account to Home account'
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
test.it('ERC20-ERC20 - Foreign POA balance has correctly changed after transaction', async () => {
|
||||
const newForeignBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = foreignBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newForeignBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it(
|
||||
'ERC20-ERC20 - Home account has received correct amount of tokens after transaction ',
|
||||
async () => {
|
||||
const newHomeBalance = await mainPage.getForeignPOABalance()
|
||||
const shouldBe = homeBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
}
|
||||
)
|
||||
test.it(
|
||||
'ERC20-ERC20 - User is able to send tokens from Home account to Foreign account ',
|
||||
async () => {
|
||||
await homeAccount.setMetaMaskNetwork()
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
test.it('Main page: foreign POA balance is displayed', async () => {
|
||||
foreignBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
console.log('foreignBalanceBefore = ' + foreignBalanceBefore)
|
||||
const result = foreignBalanceBefore === 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Foreign POA balance is zero or not displayed '
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Main page: home POA balance is displayed', async () => {
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
console.log('homeBalanceBefore = ' + homeBalanceBefore)
|
||||
const result = homeBalanceBefore !== 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is zero or not displayed '
|
||||
)
|
||||
})
|
||||
|
||||
test.it('User is able to send tokens from Home account to Foreign account', async () => {
|
||||
const result = await homeAccount.transferTokens(maxAmountPerTransactionLimit)
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Home account to Foreign account'
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test.it('ERC20-ERC20 - Home POA balance has correctly changed after transaction', async () => {
|
||||
const newHomeBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = homeBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
homeBalanceBefore = newHomeBalance
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it(
|
||||
'ERC20-ERC20 - Foreign account has received correct amount of tokens after transaction ',
|
||||
async () => {
|
||||
const newForeignBalance = await mainPage.getForeignPOABalance()
|
||||
|
||||
const shouldBe = foreignBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
test.it('Home POA balance has correctly changed after transaction', async () => {
|
||||
const newHomeBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = homeBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
|
||||
const result = Math.abs(shouldBe - newForeignBalance) < maxAmountPerTransactionLimit / 100
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
homeBalanceBefore = newHomeBalance
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Foreign POA balance is not correct after transaction'
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test.it('ERC20-Native - User is able to open main page of bridge-ui ', async () => {
|
||||
startURL = await Utils.getErc20NativeStartURL()
|
||||
const result = await mainPage.open(startURL)
|
||||
console.log('Test URL: ' + startURL)
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Build failed.')
|
||||
})
|
||||
test.it(
|
||||
'Foreign account has received correct amount of tokens after transaction ',
|
||||
async () => {
|
||||
const newForeignBalance = await mainPage.getForeignPOABalance()
|
||||
|
||||
test.it('ERC20-Native - Home page: disclaimer is displayed ', async () => {
|
||||
const result = await mainPage.confirmDisclaimer()
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Disclaimer is not displayed')
|
||||
})
|
||||
const shouldBe = foreignBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
|
||||
test.it('ERC20-Native - Main page: foreign erc20 balance is displayed ', async () => {
|
||||
await foreignAccount.setMetaMaskNetwork()
|
||||
foreignBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
console.log('foreignBalanceBefore = ' + foreignBalanceBefore)
|
||||
const result = foreignBalanceBefore !== 0
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Foreign erc20 balance is zero')
|
||||
})
|
||||
|
||||
test.it('ERC20-Native - Main page: home erc20 balance is displayed ', async () => {
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
console.log('homeBalanceBefore = ' + homeBalanceBefore)
|
||||
const result = homeBalanceBefore !== 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Home erc20 balance is zero or not displayed '
|
||||
const result = Math.abs(shouldBe - newForeignBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test.it(
|
||||
'ERC20-Native - User is able to send tokens from Foreign account to Home account ',
|
||||
async () => {
|
||||
homeBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
test.it('User is able to send tokens from Foreign account to Home account', async () => {
|
||||
await foreignAccount.setMetaMaskNetwork()
|
||||
foreignBalanceBefore = await mainPage.getHomePOABalance()
|
||||
const result = await foreignAccount.transferTokens(maxAmountPerTransactionLimit)
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Foreign account to Home account'
|
||||
'Test FAILED. User is able send tokens from Home account to Foreign account'
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test.it(
|
||||
'ERC20-Native - Foreign POA balance has correctly changed after transaction',
|
||||
async () => {
|
||||
test.it('Foreign POA balance has correctly changed after transaction', async () => {
|
||||
const newForeignBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = foreignBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
@ -328,12 +140,9 @@ test.describe('e2e-test for bridge.poa, version 1.5.0', async function() {
|
||||
true,
|
||||
'Test FAILED.Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test.it(
|
||||
'ERC20-Native - Home account has received correct amount of tokens after transaction ',
|
||||
async () => {
|
||||
test.it('Home account has received correct amount of tokens after transaction', async () => {
|
||||
const newHomeBalance = await mainPage.getForeignPOABalance()
|
||||
const shouldBe = homeBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
@ -344,11 +153,81 @@ test.describe('e2e-test for bridge.poa, version 1.5.0', async function() {
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
}
|
||||
)
|
||||
test.it(
|
||||
'ERC20-Native - User is able to send tokens from Home account to Foreign account ',
|
||||
async () => {
|
||||
})
|
||||
})
|
||||
|
||||
test.describe('ERC TO ERC', async () => {
|
||||
test.it('User is able to open main page of bridge-ui ', async () => {
|
||||
startURL = await Utils.getErc20StartURL()
|
||||
const result = await mainPage.open(startURL)
|
||||
console.log('Test URL: ' + startURL)
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Build failed.')
|
||||
})
|
||||
|
||||
test.it('Home page: disclaimer is displayed ', async () => {
|
||||
const result = await mainPage.confirmDisclaimer()
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Disclaimer is not displayed')
|
||||
})
|
||||
|
||||
test.it('Main page: foreign erc20 balance is displayed', async () => {
|
||||
foreignBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
console.log('foreignBalanceBefore = ' + foreignBalanceBefore)
|
||||
const result = foreignBalanceBefore === 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Foreign erc20 balance is not zero'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Main page: home erc20 balance is displayed', async () => {
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
console.log('homeBalanceBefore = ' + homeBalanceBefore)
|
||||
const result = homeBalanceBefore !== 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Home erc20 balance is zero or not displayed '
|
||||
)
|
||||
})
|
||||
|
||||
test.it('User is able to send tokens from Foreign account to Home account ', async () => {
|
||||
homeBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
foreignBalanceBefore = await mainPage.getHomePOABalance()
|
||||
const result = await foreignAccount.transferTokens(maxAmountPerTransactionLimit)
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Foreign account to Home account'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Foreign POA balance has correctly changed after transaction', async () => {
|
||||
const newForeignBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = foreignBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newForeignBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Home account has received correct amount of tokens after transaction ', async () => {
|
||||
const newHomeBalance = await mainPage.getForeignPOABalance()
|
||||
const shouldBe = homeBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
test.it('User is able to send tokens from Home account to Foreign account ', async () => {
|
||||
await homeAccount.setMetaMaskNetwork()
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
foreignBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
@ -358,26 +237,136 @@ test.describe('e2e-test for bridge.poa, version 1.5.0', async function() {
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Home account to Foreign account'
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test.it('ERC20-Native - Home POA balance has correctly changed after transaction', async () => {
|
||||
const newHomeBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = homeBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
homeBalanceBefore = newHomeBalance
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
test.it('Home POA balance has correctly changed after transaction', async () => {
|
||||
const newHomeBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = homeBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
homeBalanceBefore = newHomeBalance
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it(
|
||||
'Foreign account has received correct amount of tokens after transaction ',
|
||||
async () => {
|
||||
const newForeignBalance = await mainPage.getForeignPOABalance()
|
||||
|
||||
const shouldBe = foreignBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
|
||||
const result = Math.abs(shouldBe - newForeignBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test.it(
|
||||
'ERC20-Native - Foreign account has received correct amount of tokens after transaction ',
|
||||
async () => {
|
||||
test.describe('ERC TO NATIVE', async () => {
|
||||
test.it('User is able to open main page of bridge-ui ', async () => {
|
||||
startURL = await Utils.getErc20NativeStartURL()
|
||||
const result = await mainPage.open(startURL)
|
||||
console.log('Test URL: ' + startURL)
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Build failed.')
|
||||
})
|
||||
|
||||
test.it('Home page: disclaimer is displayed ', async () => {
|
||||
const result = await mainPage.confirmDisclaimer()
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Disclaimer is not displayed')
|
||||
})
|
||||
|
||||
test.it('Main page: foreign erc20 balance is displayed', async () => {
|
||||
await foreignAccount.setMetaMaskNetwork()
|
||||
foreignBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
console.log('foreignBalanceBefore = ' + foreignBalanceBefore)
|
||||
const result = foreignBalanceBefore !== 0
|
||||
return await assert.strictEqual(result, true, 'Test FAILED. Foreign erc20 balance is zero')
|
||||
})
|
||||
|
||||
test.it('Main page: home erc20 balance is displayed', async () => {
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
console.log('homeBalanceBefore = ' + homeBalanceBefore)
|
||||
const result = homeBalanceBefore !== 0
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. Home erc20 balance is zero or not displayed '
|
||||
)
|
||||
})
|
||||
|
||||
test.it('User is able to send tokens from Foreign account to Home account', async () => {
|
||||
homeBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
foreignBalanceBefore = await mainPage.getHomePOABalance()
|
||||
const result = await foreignAccount.transferTokens(maxAmountPerTransactionLimit)
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Foreign account to Home account'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Foreign POA balance has correctly changed after transaction', async () => {
|
||||
const newForeignBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = foreignBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newForeignBalance = ' + newForeignBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newForeignBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Home account has received correct amount of tokens after transaction', async () => {
|
||||
const newHomeBalance = await mainPage.getForeignPOABalance()
|
||||
const shouldBe = homeBalanceBefore + maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
test.it('User is able to send tokens from Home account to Foreign account', async () => {
|
||||
await homeAccount.setMetaMaskNetwork()
|
||||
homeBalanceBefore = await mainPage.getHomePOABalance()
|
||||
foreignBalanceBefore = await mainPage.getForeignPOABalance()
|
||||
const result = await homeAccount.transferTokens(maxAmountPerTransactionLimit)
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED. User is able send tokens from Home account to Foreign account'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Home POA balance has correctly changed after transaction', async () => {
|
||||
const newHomeBalance = await mainPage.getHomePOABalance()
|
||||
const shouldBe = homeBalanceBefore - maxAmountPerTransactionLimit
|
||||
console.log('newHomeBalance = ' + newHomeBalance)
|
||||
console.log('shouldBe = ' + shouldBe)
|
||||
const result = Math.abs(shouldBe - newHomeBalance) < maxAmountPerTransactionLimit / 100
|
||||
homeBalanceBefore = newHomeBalance
|
||||
return await assert.strictEqual(
|
||||
result,
|
||||
true,
|
||||
'Test FAILED.Home POA balance is not correct after transaction'
|
||||
)
|
||||
})
|
||||
|
||||
test.it('Foreign account has received correct amount of tokens after transaction', async () => {
|
||||
const newForeignBalance = await mainPage.getForeignPOABalance()
|
||||
|
||||
const shouldBe = foreignBalanceBefore + maxAmountPerTransactionLimit
|
||||
@ -390,6 +379,6 @@ test.describe('e2e-test for bridge.poa, version 1.5.0', async function() {
|
||||
true,
|
||||
'Test FAILED. Foreign POA balance is not correct after transaction'
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user