Skip to content

Commit 3fa460c

Browse files
committed
refactor: create helpers.ts & add Cookie
1 parent 38d7718 commit 3fa460c

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/common/util.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { logger, field } from "@coder/logger"
2+
import { Cookie } from "../../test/helpers"
23

34
export interface Options {
45
base: string
@@ -121,21 +122,6 @@ export function logError(prefix: string, err: any): void {
121122
}
122123
}
123124

124-
// Borrowed from playwright
125-
export interface Cookie {
126-
name: string
127-
value: string
128-
domain: string
129-
path: string
130-
/**
131-
* Unix time in seconds.
132-
*/
133-
expires: number
134-
httpOnly: boolean
135-
secure: boolean
136-
sameSite: "Strict" | "Lax" | "None"
137-
}
138-
139125
/**
140126
* Checks if a cookie exists in array of cookies
141127
*/

test/globalSetup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// This setup runs before our e2e tests
22
// so that it authenticates us into code-server
33
// ensuring that we're logged in before we run any tests
4-
import { chromium, Page, Browser, BrowserContext } from "playwright"
4+
import { chromium } from "playwright"
55

66
module.exports = async () => {
77
console.log("🚨 Running Global Setup for Jest Tests")
88
console.log(" Please hang tight...")
9-
const browser: Browser = await chromium.launch()
10-
const context: BrowserContext = await browser.newContext()
11-
const page: Page = await context.newPage()
9+
const browser = await chromium.launch()
10+
const context = await browser.newContext()
11+
const page = await context.newPage()
1212

1313
await page.goto(process.env.CODE_SERVER_ADDRESS || "http://localhost:8080", { waitUntil: "domcontentloaded" })
1414
// Type in password

test/helpers.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Borrowed from playwright
2+
export interface Cookie {
3+
name: string
4+
value: string
5+
domain: string
6+
path: string
7+
/**
8+
* Unix time in seconds.
9+
*/
10+
expires: number
11+
httpOnly: boolean
12+
secure: boolean
13+
sameSite: "Strict" | "Lax" | "None"
14+
}

0 commit comments

Comments
 (0)