-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
1f22922
commit aeb0bf0
Showing
12 changed files
with
162 additions
and
6 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
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,15 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test('should navigate to the about page', async ({ page }) => { | ||
// Start from the index page (the baseURL is set via the webServer in the playwright.config.ts) | ||
await page.goto('/') | ||
|
||
// Find an element with the text 'About Page' and click on it | ||
await page.click('text=About') | ||
// The new url should be "/about" (baseURL is used there) | ||
|
||
await expect(page).toHaveURL('/about') | ||
|
||
// The new page should contain an h1 with "About Page" | ||
await expect(page.locator('h1')).toContainText('About me') | ||
}) |
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
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,79 @@ | ||
import { devices, PlaywrightTestConfig } 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: 'pnpm 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 13'], | ||
// }, | ||
// }, | ||
], | ||
} | ||
export default config |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
23 changes: 23 additions & 0 deletions
23
src/utils/get-article-posts/__tests__/datteSortDesc.test.ts
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,23 @@ | ||
import { dateSortDesc } from '../dateSortDesc' | ||
|
||
describe('dateSortDesc', () => { | ||
it('should return -1 when the first date is greater than the second date', () => { | ||
expect(dateSortDesc(3, 2)).toBe(-1) | ||
expect(dateSortDesc(100, 50)).toBe(-1) | ||
expect(dateSortDesc(new Date('2022-01-01').getTime(), new Date('2021-01-01').getTime())).toBe( | ||
-1 | ||
) | ||
}) | ||
|
||
it('should return 1 when the first date is less than the second date', () => { | ||
expect(dateSortDesc(2, 3)).toBe(1) | ||
expect(dateSortDesc(50, 100)).toBe(1) | ||
expect(dateSortDesc(new Date('2021-01-01').getTime(), new Date('2022-01-01').getTime())).toBe(1) | ||
}) | ||
|
||
it('should return 0 when both dates are equal', () => { | ||
expect(dateSortDesc(3, 3)).toBe(0) | ||
expect(dateSortDesc(100, 100)).toBe(0) | ||
expect(dateSortDesc(new Date('2021-01-01').getTime(), new Date('2021-01-01').getTime())).toBe(0) | ||
}) | ||
}) |
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
aeb0bf0
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:
thedaviddiasdev – ./
thedaviddias-blog.vercel.app
thedaviddiasdev-thedaviddias1.vercel.app
www.thedaviddias.dev
thedaviddiasdev-git-main-thedaviddias1.vercel.app
thedaviddias.dev