Skip to content

Commit

Permalink
increase test timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
itsMapleLeaf committed Oct 22, 2023
1 parent def8890 commit 4896f3a
Showing 1 changed file with 76 additions and 56 deletions.
132 changes: 76 additions & 56 deletions tests/integration.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -33,59 +33,79 @@ async function launch() {
}
}

test("electron apis", async () => {
const { app, window, dispose } = await launch()

const userDataPath = await app.evaluate(({ app }) => app.getPath("userData"))

expect(
await window.locator('[data-testid="user-data-path"]').textContent(),
).toBe(userDataPath)

await dispose()
})

test("scripts", async () => {
const { window, dispose } = await launch()

const counter = window.locator("[data-testid='counter']")
expect(await counter.textContent()).toBe("0")
await counter.click({ clickCount: 2 })
expect(await counter.textContent()).toBe("2")

await dispose()
})

test("action referrer redirect", async () => {
const { window, dispose } = await launch()

await window.goto("http://localhost/referrer-redirect/form")

const redirectCount = window.locator("[data-testid=redirects]")
await expect(redirectCount).toHaveText("0")
await window.click("text=submit")
await expect(redirectCount).toHaveText("1")

await dispose()
})

test.skip("multipart uploads", async () => {
const { window, dispose } = await launch()

await window.goto("http://localhost/multipart-uploads")

const assetUrl = new URL(
"./fixtures/asset-files/file-upload.txt",
import.meta.url,
)

const assetContent = await readFile(assetUrl, "utf-8")

await window
.locator("input[type=file]")
.setInputFiles(fileURLToPath(assetUrl))
await window.locator("button").click()
await expect(window.locator("[data-testid=result]")).toHaveText(assetContent)

await dispose()
})
test(
"electron apis",
async () => {
const { app, window, dispose } = await launch()

const userDataPath = await app.evaluate(({ app }) =>
app.getPath("userData"),
)

expect(
await window.locator('[data-testid="user-data-path"]').textContent(),
).toBe(userDataPath)

await dispose()
},
1000 * 30,
)

test(
"scripts",
async () => {
const { window, dispose } = await launch()

const counter = window.locator("[data-testid='counter']")
expect(await counter.textContent()).toBe("0")
await counter.click({ clickCount: 2 })
expect(await counter.textContent()).toBe("2")

await dispose()
},
1000 * 30,
)

test(
"action referrer redirect",
async () => {
const { window, dispose } = await launch()

await window.goto("http://localhost/referrer-redirect/form")

const redirectCount = window.locator("[data-testid=redirects]")
await expect(redirectCount).toHaveText("0")
await window.click("text=submit")
await expect(redirectCount).toHaveText("1")

await dispose()
},
1000 * 30,
)

test.skip(
"multipart uploads",
async () => {
const { window, dispose } = await launch()

await window.goto("http://localhost/multipart-uploads")

const assetUrl = new URL(
"./fixtures/asset-files/file-upload.txt",
import.meta.url,
)

const assetContent = await readFile(assetUrl, "utf-8")

await window
.locator("input[type=file]")
.setInputFiles(fileURLToPath(assetUrl))
await window.locator("button").click()
await expect(window.locator("[data-testid=result]")).toHaveText(
assetContent,
)

await dispose()
},
1000 * 30,
)

0 comments on commit 4896f3a

Please sign in to comment.