Skip to content

Commit

Permalink
Remove waits on terminal runs
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Feb 24, 2024
1 parent 5d009be commit fb43cc1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/common/src/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Terminal {
})
}

async run(command, wait) {
async run(command, wait = 240000) {
if (this.running) {
throw new Error('Terminal is already running a command')
}
Expand All @@ -57,7 +57,7 @@ class Terminal {
this.running = false
}

async input(command, wait) {
async input(command, wait = 200) {
this._write(command)
return this.wait(wait)
}
Expand Down
3 changes: 1 addition & 2 deletions packages/ethernaut-ai/test/tasks/interpret.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
const assert = require('assert')
const { Terminal } = require('common/src/terminal')

describe.skip('interpret', function () {
describe('interpret', function () {
const terminal = new Terminal()

describe('when asked to convert SNX to bytes', function () {
describe('without prompting', function () {
before('call interpret', async function () {
await terminal.run(
'npx hardhat ai interpret "what is SNX in bytes?" --no-confirm --new-thread',
60000,
)
})

Expand Down
3 changes: 1 addition & 2 deletions packages/ethernaut-cli/test/challenges-2-ai.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const assert = require('assert')
const { Terminal } = require('common/src/terminal')
const getNetwork = require('common/src/network')

describe.skip('completing level 2 of ethernaut with ai', function () {
describe('completing level 2 of ethernaut with ai', function () {
const terminal = new Terminal()

before('check network', async function () {
Expand All @@ -14,7 +14,6 @@ describe.skip('completing level 2 of ethernaut with ai', function () {
before('run command', async function () {
await terminal.run(
'ethernaut ai interpret "complete level 2 of the ethernaut challenges" --no-confirm --new-thread',
240000,
)
})

Expand Down
5 changes: 1 addition & 4 deletions packages/ethernaut-interact/test/tasks/contract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ describe('contract', function () {
before('run contract', async function () {
await terminal.run(
`npx hardhat interact contract --address ${await sample.getAddress()} --no-confirm --abi ${abiPath} --fn incrementCounter --params 42`,
2000,
)
})

Expand All @@ -121,7 +120,6 @@ describe('contract', function () {
it('incremented the counter', async function () {
await terminal.run(
`npx hardhat interact contract --address ${await sample.getAddress()} --abi ${abiPath} --fn counter`,
1000,
)
console.log(terminal.output)
assert.ok(terminal.output.includes('counter() => 42'))
Expand All @@ -131,7 +129,6 @@ describe('contract', function () {
before('run contract', async function () {
await terminal.run(
`npx hardhat interact contract --address ${await sample.getAddress()} --no-confirm --abi ${abiPath} --fn decrementCounter --params 42`,
1000,
)
})

Expand All @@ -149,7 +146,7 @@ describe('contract', function () {
before('run contract', async function () {
await terminal.run(
`npx hardhat interact contract --address ${await sample.getAddress()} --abi ${abiPath} --fn incrementCounter --params 42`,
1000,
5000,
)
})

Expand Down
3 changes: 1 addition & 2 deletions packages/ethernaut-interact/test/tasks/send.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ describe('send', function () {
before('run send', async function () {
await terminal.run(
`npx hardhat interact send --address ${signer2.address} --value 1 --no-confirm`,
2000,
)
})

Expand All @@ -95,7 +94,7 @@ describe('send', function () {
before('run send', async function () {
await terminal.run(
`npx hardhat interact send --address ${signer2.address} --value 1`,
1000,
5000,
)
})

Expand Down

0 comments on commit fb43cc1

Please sign in to comment.