@swapper-finance/sdk
Version:
JavaScript SDK form Swapper
66 lines (57 loc) • 1.72 kB
text/typescript
import { defineConfig, devices } from "@playwright/test";
import dotenv from "dotenv";
import path from "path";
dotenv.config({ path: path.resolve(__dirname, ".env") });
const testEnv = process.env.TEST_ENV || "development";
const isTestnet = testEnv === "development";
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./tests",
globalSetup: require.resolve("./tests/auth/global-setup"),
timeout: 30_000,
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: "html",
use: {
baseURL: isTestnet
? `http://localhost:3001/`
: process.env.BASE_URL || "https://mainnet.swapper.finance",
trace: "on-first-retry",
headless: true, // Set to false if you want to see the browser during tests
viewport: { width: 1280, height: 720 },
screenshot: "only-on-failure",
video: "retain-on-failure",
actionTimeout: 10_000,
},
projects: [
// ========== Public tests (no auth) ==========
{
name: "public-chromium",
use: { ...devices["Desktop Chrome"], storageState: undefined },
testMatch: /.*\.public\.spec\.ts$/,
},
// ========== Authenticated tests ==========
{
name: "auth-chromium",
use: {
...devices["Desktop Chrome"],
storageState: "authState.json",
},
testMatch: /.*\.auth\.spec\.ts$/,
},
],
...(isTestnet
? {
webServer: {
command: "pnpm --prefix iframe-app run dev",
url: "http://localhost:3001",
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
}
: {}),
});