Skip to content

Commit

Permalink
fix(test): ♻️ simplify scaffolding
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
  • Loading branch information
whizzzkid committed Sep 8, 2023
1 parent 63e815c commit 6d4fca3
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/e2e/ipfs-companion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,23 @@ async function runBrowserTest (browserName, testFunc) {
}
}

async function checkNumberOfConnectedPeers (browser, url) {
const peers = await getNumberOfConnectedPeers(browser, url)
expect(peers).not.to.equal(0)
}

describe('ipfs-companion', function () {
describe('ipfs-companion', () => {
before(function () {
if (process.env.TEST_E2E !== 'true') {
this.skip()
}
})
it('should be able to discover peers in Chromium', async function () {
await runBrowserTest('chromium', checkNumberOfConnectedPeers)
})
it('should be able to discover peers in Firefox', async function () {
await runBrowserTest('firefox', checkNumberOfConnectedPeers)
})

const browsersToTest = ['chromium', 'firefox']

for (const browserName of browsersToTest) {
describe(`ipfs-companion in ${browserName}`, () => {
it(`should be able to install the extension in ${browserName}`, async () => {
await runBrowserTest(browserName, async (browser, url) => {
const peers = await getNumberOfConnectedPeers(browser, url)
expect(peers).not.to.equal(0)
})
})
})
}
})

0 comments on commit 6d4fca3

Please sign in to comment.