-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mikko Forsström
committed
Apr 24, 2023
1 parent
5ad5a1a
commit f90a06c
Showing
9 changed files
with
1,081 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/test-results | ||
/node_modules | ||
.env | ||
.env.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
test("should navigate to the about page", async ({ page }) => { | ||
await page.goto("/"); | ||
await expect(page.locator("h1")).toContainText("Hardcore React Training"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import nextJest from "next/jest.js"; | ||
|
||
const createJestConfig = nextJest({ | ||
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment | ||
dir: "./" | ||
}); | ||
|
||
// Add any custom config to be passed to Jest | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
// Add more setup options before each test is run | ||
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], | ||
|
||
testEnvironment: "jest-environment-jsdom" | ||
}; | ||
|
||
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async | ||
export default createJestConfig(config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { PlaywrightTestConfig, devices } from "@playwright/test"; | ||
import path from "path"; | ||
|
||
// Use process.env.PORT by default and fallback to port 3000 | ||
const PORT = process.env.PORT || 3000; | ||
|
||
// Set webServer.url and use.baseURL with the location of the WebServer respecting the correct set port | ||
const baseURL = `http://localhost:${PORT}`; | ||
|
||
// Reference: https://playwright.dev/docs/test-configuration | ||
const config: PlaywrightTestConfig = { | ||
// Timeout per test | ||
timeout: 30 * 1000, | ||
// Test directory | ||
testDir: path.join(__dirname, "e2e"), | ||
// If a test fails, retry it additional 2 times | ||
retries: 2, | ||
// Artifacts folder where screenshots, videos, and traces are stored. | ||
outputDir: "test-results/", | ||
|
||
// Run your local dev server before starting the tests: | ||
// https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests | ||
webServer: { | ||
command: "npm run dev", | ||
url: baseURL, | ||
timeout: 120 * 1000, | ||
reuseExistingServer: !process.env.CI | ||
}, | ||
|
||
use: { | ||
// Use baseURL so to make navigations relative. | ||
// More information: https://playwright.dev/docs/api/class-testoptions#test-options-base-url | ||
baseURL, | ||
|
||
// Retry a test if its failing with enabled tracing. This allows you to analyse the DOM, console logs, network traffic etc. | ||
// More information: https://playwright.dev/docs/trace-viewer | ||
trace: "retry-with-trace" | ||
|
||
// All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context | ||
// contextOptions: { | ||
// ignoreHTTPSErrors: true, | ||
// }, | ||
}, | ||
|
||
projects: [ | ||
{ | ||
name: "Desktop Chrome", | ||
use: { | ||
...devices["Desktop Chrome"] | ||
} | ||
}, | ||
// { | ||
// name: 'Desktop Firefox', | ||
// use: { | ||
// ...devices['Desktop Firefox'], | ||
// }, | ||
// }, | ||
// { | ||
// name: 'Desktop Safari', | ||
// use: { | ||
// ...devices['Desktop Safari'], | ||
// }, | ||
// }, | ||
// Test against mobile viewports. | ||
{ | ||
name: "Mobile Chrome", | ||
use: { | ||
...devices["Pixel 5"] | ||
} | ||
}, | ||
{ | ||
name: "Mobile Safari", | ||
use: devices["iPhone 12"] | ||
} | ||
] | ||
}; | ||
export default config; |
Oops, something went wrong.
f90a06c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
hardcore-react-training – ./
hardcore-react-training.vercel.app
hardcore-react-training-git-main-dr-kobros.vercel.app
hardcore-react-training-dr-kobros.vercel.app