Lesson 9: staging test. Error timeout: All solutions has failed for me #2570
-
Hi all Here is the raffle staging file with the issue. const { assert, expect } = require("chai")
const { getNamedAccounts, deployments, ethers, network } = require("hardhat")
const { developmentChains, networkConfig } = require("../../helper-hardhat-config")
developmentChains.includes(network.name)
? describe.skip
: describe("Raffle unit tests", function () {
let raffle, raffleEntranceFee, deployer //interval
beforeEach(async function () {
deployer = (await getNamedAccounts()).deployer
raffle = await ethers.getContract("Raffle", deployer)
raffleEntranceFee = await raffle.getEntranceFee()
// interval = await raffle.getInterval()
})
describe("fulfillRandomsWords", function () {
it("works with live chainlink keepers and chainlink VRF, we get a random winner", async function () {
const startingTimestamp = await raffle.getLatestTimeStamp()
const accounts = await ethers.getSigners()
// setup listener before we enter the raffle
// just incase the blockchains moves really fast
// different in mock tsting where we can manipulate the blocks
await new Promise(async (resolve, reject) => {
raffle.once("WinnerPicked", async () => {
console.log("WinnerPicked event fired up")
try {
// add our asserts here
const recentWinner = await raffle.getRecentWinner()
const raffleState = await raffle.getRaffleState()
const winnerEndingBalance = await accounts[0].getBalance()
const endingTimeStamp = await raffle.getLatestTimeStamp()
await expect(raffle.getPlayer(0)).to.be.reverted
assert.equal(recentWinner.toString(), accounts[0].address)
assert.equal(raffleState, 0)
assert.equal(
winnerEndingBalance.toString(),
winnerStartingBalance.add(raffleEntranceFee).toString()
)
assert(endingTimeStamp > startingTimestamp)
resolve()
} catch (error) {
console.log(error)
reject(e)
}
})
// then entering the raffle
await raffle.enterRaffle({ value: raffleEntranceFee })
const winnerStartingBalance = await accounts[0].getBalance()
//
})
})
})
}) Here is the repo: https://github.com/tobezhanabi/hardhat-lottery-fcc.git (master branch) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
As it is a staging test, and also the fact that you used the course's repo already, it is necessarily not the logic which is at fault; it follows that the most likely cause is Rinkeby. Try Goerli/Kovan and let me know if it persists :) |
Beta Was this translation helpful? Give feedback.
-
@tobezhanabi You should check the chronological order guide and check this lesson's recommendations also see here my step-by-step process for staging test #1435. Your other things are working just make sure everything is correct on vrf and keepers side. Correct contract is added there, accounts are funded, etc. |
Beta Was this translation helpful? Give feedback.
@tobezhanabi You should check the chronological order guide and check this lesson's recommendations also see here my step-by-step process for staging test #1435. Your other things are working just make sure everything is correct on vrf and keepers side. Correct contract is added there, accounts are funded, etc.