Skip to content

Commit 05e789b

Browse files
committed
feat(e2e): add downloads disabled test
1 parent dd9a2c3 commit 05e789b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

test/e2e/downloads.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { promises as fs } from "fs"
33
import { clean } from "../utils/helpers"
44
import { describe, test, expect } from "./baseFixture"
55

6-
describe("Downloads", true, [], {}, async () => {
6+
describe("Downloads (enabled)", true, [], {}, async () => {
77
const testName = "downloads"
88
test.beforeAll(async () => {
99
await clean(testName)

test/e2e/downloadsDisabled.test.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import * as path from "path"
2+
import { promises as fs } from "fs"
3+
import { clean } from "../utils/helpers"
4+
import { describe, test, expect } from "./baseFixture"
5+
6+
describe("Downloads (disabled)", true, ["--disable-file-downloads"], {}, async () => {
7+
const testName = "downloads"
8+
test.beforeAll(async () => {
9+
await clean(testName)
10+
})
11+
12+
test("should not see the 'Download...' option", async ({ codeServerPage }) => {
13+
// Setup
14+
const workspaceDir = await codeServerPage.workspaceDir
15+
const tmpFilePath = path.join(workspaceDir, "unique-file.txt")
16+
await fs.writeFile(tmpFilePath, "hello world")
17+
18+
// Action
19+
const fileInExplorer = await codeServerPage.page.waitForSelector("text=unique-file.txt")
20+
await fileInExplorer.click({
21+
button: "right",
22+
})
23+
24+
expect(await codeServerPage.page.isVisible("text=Download...")).toBe(false)
25+
})
26+
})

0 commit comments

Comments
 (0)