Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(e2e): add downloads disabled test
  • Loading branch information
jsjoeio committed Mar 31, 2022
commit 05e789beb4e239aec23d308bc073402b79d8b234
2 changes: 1 addition & 1 deletion test/e2e/downloads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { promises as fs } from "fs"
import { clean } from "../utils/helpers"
import { describe, test, expect } from "./baseFixture"

describe("Downloads", true, [], {}, async () => {
describe("Downloads (enabled)", true, [], {}, async () => {
const testName = "downloads"
test.beforeAll(async () => {
await clean(testName)
Expand Down
26 changes: 26 additions & 0 deletions test/e2e/downloadsDisabled.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as path from "path"
import { promises as fs } from "fs"
import { clean } from "../utils/helpers"
import { describe, test, expect } from "./baseFixture"

describe("Downloads (disabled)", true, ["--disable-file-downloads"], {}, async () => {
const testName = "downloads"
test.beforeAll(async () => {
await clean(testName)
})

test("should not see the 'Download...' option", async ({ codeServerPage }) => {
// Setup
const workspaceDir = await codeServerPage.workspaceDir
const tmpFilePath = path.join(workspaceDir, "unique-file.txt")
await fs.writeFile(tmpFilePath, "hello world")

// Action
const fileInExplorer = await codeServerPage.page.waitForSelector("text=unique-file.txt")
await fileInExplorer.click({
button: "right",
})

expect(await codeServerPage.page.isVisible("text=Download...")).toBe(false)
})
})