import "dotenv/config";
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
	testDir: "./e2e",
	fullyParallel: true,
	forbidOnly: !!process.env.CI,
	retries: 0,
	timeout: 60000,
	reporter: "html",
	use: {
		baseURL: `http://${process.env.SERVER_IP}:4096`,
		video: "retain-on-failure",
		trace: "retain-on-failure",
		ignoreHTTPSErrors: true,
	},
	projects: [
		{
			name: "setup",
			testMatch: /.*\.setup\.ts/,
			workers: 1,
		},
		{
			name: "chromium",
			use: {
				...devices["Desktop Chrome"],
				launchOptions: {
					args: ["--host-rules=MAP tinyauth.example.com 127.0.0.1"],
				},
			},
			dependencies: ["setup"],
		},

		// {
		// 	name: "firefox",
		// 	use: { ...devices["Desktop Firefox"] },
		// },
		//
		// {
		// 	name: "webkit",
		// 	use: { ...devices["Desktop Safari"] },
		// },

		// {
		//   name: 'Mobile Chrome',
		//   use: { ...devices['Pixel 5'] },
		// },
		// {
		//   name: 'Mobile Safari',
		//   use: { ...devices['iPhone 12'] },
		// },

		/* Test against branded browsers. */
		// {
		//   name: 'Microsoft Edge',
		//   use: { ...devices['Desktop Edge'], channel: 'msedge' },
		// },
		// {
		//   name: 'Google Chrome',
		//   use: { ...devices['Desktop Chrome'], channel: 'chrome' },
		// },
	],
});
