Paratii-Video / paratii-portal

Component-based web-interface for uploading, browsing and organising content of Paratii's P2P network.
GNU General Public License v3.0
12 stars 5 forks source link

Need util to send PTI in integration tests #782

Closed bent0b0x closed 6 years ago

bent0b0x commented 6 years ago

Right now if we want to test functionality that requires PTI we do not have a nice util to make this simple.

For example, this is required to write integration tests for tipping, as most of the core of the tipping functionality requires PTI.

bent0b0x commented 6 years ago

@jellegerbrandy would you be able to assist with this?

A webdriver.io command that we could run to set the user's PTI balance would be great, but if we cannot do that a util to just add (and then maybe even detract?) balance works.

I tried to wire something up but failed, due to lack of understanding. How do we, in the browser, execute a script that reconfigures paratii-js to be using the main account? And then successfully reconfigure it to use the test user's account.

jellegerbrandy commented 6 years ago

Hey ben, so this is not something i would do in the browser, but simply diretly in the test code. So it works like this (and probably we are using that pattern already in some tests):

const testSettings = thoseSettingsThatAreUsedInSetupDevEnvThatUse0xCbe...
const paratiiFor0xCbe - new Paratii(testSettings)
await paratiiFor0xCBe.eth.transfer(2e18, 'PTI')
jellegerbrandy commented 6 years ago

so to answer there is no need to set the account on the paratii object: we can use different instances of paratii instead