-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[e2e] Add eth_gasPrice json rpc method test.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const { strict: assert } = require('assert'); | ||
const { withFixtures, defaultGanacheOptions } = require('../helpers'); | ||
const FixtureBuilder = require('../fixture-builder'); | ||
|
||
describe('eth_gasPrice', function () { | ||
it('executes gas price json rpc call', async function () { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixtures: new FixtureBuilder() | ||
.withPermissionControllerConnectedToTestDapp() | ||
.build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test.title, | ||
}, | ||
async ({ driver }) => { | ||
await driver.navigate(); | ||
await driver.fill('#password', 'correct horse battery staple'); | ||
await driver.press('#password', driver.Key.ENTER); | ||
|
||
// eth_gasPrice | ||
await driver.openNewPage(`http://127.0.0.1:8080`); | ||
|
||
const gasPriceRequest = JSON.stringify({ | ||
jsonrpc: '2.0', | ||
method: 'eth_gasPrice', | ||
}); | ||
|
||
const gasPrice = await driver.executeScript( | ||
`return window.ethereum.request(${gasPriceRequest})`, | ||
); | ||
|
||
assert.strictEqual(gasPrice, '0x77359400'); // 2000000000 | ||
}, | ||
); | ||
}); | ||
}); |