Comment out lots of semi-redundant / easily mocked tests

This commit is contained in:
Oliver Blanthorn 2020-06-07 21:02:17 +01:00
parent 1605106194
commit d65cf60917
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3

View file

@ -242,87 +242,87 @@ describe("webdriver", () => {
}).finally(() => killDriver(driver))
})
test("`:tabopen https://example.org<CR>` opens example.org.", async () => {
const driver = await getDriver()
return newTabWithoutChangingOldTabs(driver, async () => {
await sendKeys(driver, ":tabopen https://example.org<CR>")
}).then(async ([newtab, _]) => {
expect(newtab.active).toEqual(true)
await driver.wait(untilTabUrlMatches(driver, newtab.id, "https://example.org"), 10000)
}).finally(() => killDriver(driver))
})
// test("`:tabopen https://example.org<CR>` opens example.org.", async () => {
// const driver = await getDriver()
// return newTabWithoutChangingOldTabs(driver, async () => {
// await sendKeys(driver, ":tabopen https://example.org<CR>")
// }).then(async ([newtab, _]) => {
// expect(newtab.active).toEqual(true)
// await driver.wait(untilTabUrlMatches(driver, newtab.id, "https://example.org"), 10000)
// }).finally(() => killDriver(driver))
// })
test("`:tabopen qwant https://example.org<CR>` opens qwant.", async () => {
const driver = await getDriver()
return newTabWithoutChangingOldTabs(driver, async () => {
await sendKeys(driver, ":tabopen qwant https://example.org<CR>")
}).then(async ([newtab, _]) => {
expect(newtab.active).toEqual(true)
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.qwant.com/.*example.org")), 10000)
}).finally(() => killDriver(driver))
})
// test("`:tabopen qwant https://example.org<CR>` opens qwant.", async () => {
// const driver = await getDriver()
// return newTabWithoutChangingOldTabs(driver, async () => {
// await sendKeys(driver, ":tabopen qwant https://example.org<CR>")
// }).then(async ([newtab, _]) => {
// expect(newtab.active).toEqual(true)
// await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.qwant.com/.*example.org")), 10000)
// }).finally(() => killDriver(driver))
// })
test("`:tabopen test<CR>` opens google.", async () => {
const driver = await getDriver()
return newTabWithoutChangingOldTabs(driver, async () => {
await sendKeys(driver, ":tabopen test<CR>")
}).then(async ([newtab, _]) => {
expect(newtab.active).toEqual(true)
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/.*test")), 10000)
}).finally(() => killDriver(driver))
})
// test("`:tabopen test<CR>` opens google.", async () => {
// const driver = await getDriver()
// return newTabWithoutChangingOldTabs(driver, async () => {
// await sendKeys(driver, ":tabopen test<CR>")
// }).then(async ([newtab, _]) => {
// expect(newtab.active).toEqual(true)
// await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/.*test")), 10000)
// }).finally(() => killDriver(driver))
// })
test("`:tabopen example.org<CR>` opens example.org.", async () => {
const driver = await getDriver()
return newTabWithoutChangingOldTabs(driver, async () => {
await sendKeys(driver, ":tabopen example.org<CR>")
}).then(async ([newtab, _]) => {
expect(newtab.active).toEqual(true)
await driver.wait(untilTabUrlMatches(driver, newtab.id, "example.org"), 10000)
}).finally(() => killDriver(driver))
})
// test("`:tabopen example.org<CR>` opens example.org.", async () => {
// const driver = await getDriver()
// return newTabWithoutChangingOldTabs(driver, async () => {
// await sendKeys(driver, ":tabopen example.org<CR>")
// }).then(async ([newtab, _]) => {
// expect(newtab.active).toEqual(true)
// await driver.wait(untilTabUrlMatches(driver, newtab.id, "example.org"), 10000)
// }).finally(() => killDriver(driver))
// })
test("`:tabopen search duckduckgo<CR>` opens google.", async () => {
const driver = await getDriver()
return newTabWithoutChangingOldTabs(driver, async () => {
await sendKeys(driver, ":tabopen search duckduckgo<CR>")
}).then(async ([newtab, _]) => {
expect(newtab.active).toEqual(true)
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/search.*duckduckgo")), 10000)
}).finally(() => killDriver(driver))
})
// test("`:tabopen search duckduckgo<CR>` opens google.", async () => {
// const driver = await getDriver()
// return newTabWithoutChangingOldTabs(driver, async () => {
// await sendKeys(driver, ":tabopen search duckduckgo<CR>")
// }).then(async ([newtab, _]) => {
// expect(newtab.active).toEqual(true)
// await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/search.*duckduckgo")), 10000)
// }).finally(() => killDriver(driver))
// })
test("`:tabopen -b about:blank<CR>` opens a background tab.", async () => {
const driver = await getDriver()
return newTabWithoutChangingOldTabs(driver, async () => {
await sendKeys(driver, ":tabopen -b about:blank<CR>")
}).then(async ([newtab, _]) => {
expect(newtab.active).toEqual(false)
await driver.wait(untilTabUrlMatches(driver, newtab.id, "about:blank"))
}).finally(() => killDriver(driver))
})
// test("`:tabopen -b about:blank<CR>` opens a background tab.", async () => {
// const driver = await getDriver()
// return newTabWithoutChangingOldTabs(driver, async () => {
// await sendKeys(driver, ":tabopen -b about:blank<CR>")
// }).then(async ([newtab, _]) => {
// expect(newtab.active).toEqual(false)
// await driver.wait(untilTabUrlMatches(driver, newtab.id, "about:blank"))
// }).finally(() => killDriver(driver))
// })
test("`:tabopen -c work about:blank<CR>` opens about:blank in a container.", async () => {
const driver = await getDriver()
return newTabWithoutChangingOldTabs(driver, async () => {
await sendKeys(driver, ":tabopen -c work about:blank<CR>")
}).then(async ([newtab, _]) => {
expect(newtab.active).toEqual(true)
expect(newtab.cookieStoreId).toMatch("firefox-container-")
await driver.wait(untilTabUrlMatches(driver, newtab.id, "about:blank"))
}).finally(() => killDriver(driver))
})
// test("`:tabopen -c work about:blank<CR>` opens about:blank in a container.", async () => {
// const driver = await getDriver()
// return newTabWithoutChangingOldTabs(driver, async () => {
// await sendKeys(driver, ":tabopen -c work about:blank<CR>")
// }).then(async ([newtab, _]) => {
// expect(newtab.active).toEqual(true)
// expect(newtab.cookieStoreId).toMatch("firefox-container-")
// await driver.wait(untilTabUrlMatches(driver, newtab.id, "about:blank"))
// }).finally(() => killDriver(driver))
// })
test("`:tabopen -b -c work search qwant<CR>` opens about:blank in a container.", async () => {
const driver = await getDriver()
return newTabWithoutChangingOldTabs(driver, async () => {
await sendKeys(driver, ":tabopen -b -c work search qwant<CR>")
}).then(async ([newtab, _]) => {
expect(newtab.active).toEqual(false)
expect(newtab.cookieStoreId).toMatch("firefox-container-")
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/search.*qwant")))
}).finally(() => killDriver(driver))
})
// test("`:tabopen -b -c work search qwant<CR>` opens about:blank in a container.", async () => {
// const driver = await getDriver()
// return newTabWithoutChangingOldTabs(driver, async () => {
// await sendKeys(driver, ":tabopen -b -c work search qwant<CR>")
// }).then(async ([newtab, _]) => {
// expect(newtab.active).toEqual(false)
// expect(newtab.cookieStoreId).toMatch("firefox-container-")
// await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/search.*qwant")))
// }).finally(() => killDriver(driver))
// })
})
// vim: tabstop=4 shiftwidth=4 expandtab