-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⬆️ Upgrade DaisyUI v4 #405
Merged
Merged
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f44c087
🔧 Moved build-only deps to dev-deps list
KemingHe cb7cc89
📝 Updated changeset with info on latest commit.
KemingHe ab70456
✅ Added Playwright test to main user story, updated scripts
KemingHe 6b28377
📝 Updated changeset following last playwright commit
KemingHe c961e3b
⬆️ Bumped DaisyUI to v4, maintained app behavior
KemingHe f255cb4
💄 Proposed new landing page ui (DaisyUI v4)
KemingHe 7eac1fb
💄 Fully bumped (rewrite) to DaisyUI v4
KemingHe 2075d55
✅ Added full UI Playwright test suite
KemingHe 8038d66
📝 Updated changeset per latest commit
KemingHe 0059b68
💄 Updated landing input box color closer to original
KemingHe 652a119
📝 Updated changeset per latest commit
KemingHe ec313db
🎨 Used daisyui color config instead of hard-code
KemingHe 9b182b5
📝 Updated changeset to reflect latest commit
KemingHe b9e24c1
✅ Enforced 100% Playwright consistency
KemingHe d749aba
📝 Updated changeset per latest commit (patch)
KemingHe 53367ac
Merge remote-tracking branch 'upstream/master' into fix-bumptodaisyui…
wei 718e1fc
Merge remote-tracking branch 'upstream/master' into fix-bumptodaisyui…
wei ccb88bf
📄 Update changeset
wei 65bb644
💄 Improve heading gradient color
wei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"socialify": patch | ||
--- | ||
|
||
moved strictly build-time deps to dev-deps list in package.json |
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,5 @@ | ||
--- | ||
"socialify": patch | ||
--- | ||
|
||
Updated landing input box bg color to closer match the original DaisyUI v2 app. |
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,5 @@ | ||
--- | ||
"socialify": minor | ||
--- | ||
|
||
Bumped DaisyUI to v4 with full Playwright UI + user story test suite. |
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,5 @@ | ||
--- | ||
"socialify": minor | ||
--- | ||
|
||
Added playwright e2e testing to workflow. |
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,41 @@ | ||
import { type Page, expect, test } from '@playwright/test' | ||
|
||
// Give each expect a generous timeout of 60 seconds. | ||
const customTimeout = { timeout: 60000 } | ||
|
||
// Due to the dynamic rendering nature of this NextJS app, | ||
// give each test a "generous" threshold of max 2% difference. | ||
const customDiffPixelRatio = { maxDiffPixelRatio: 0.02 } | ||
|
||
// Testing constants. | ||
const repoPreviewURL: string = | ||
'/wei/socialify?language=1&owner=1&name=1&stargazers=1&theme=Light' | ||
|
||
test.describe('Socialify UI:', () => { | ||
test(`is consistent for landing page`, async ({ | ||
page, | ||
}: { page: Page }): Promise<void> => { | ||
await page.goto('/', customTimeout) | ||
await page.waitForSelector('button[type="submit"]', customTimeout) | ||
const image = await page.screenshot() | ||
expect(image).toMatchSnapshot(customDiffPixelRatio) | ||
}) | ||
|
||
test(`is consistent for error (404) page`, async ({ | ||
page, | ||
}: { page: Page }): Promise<void> => { | ||
await page.goto('/404', customTimeout) | ||
await page.waitForSelector('a[href="/"]', customTimeout) | ||
const image = await page.screenshot() | ||
expect(image).toMatchSnapshot(customDiffPixelRatio) | ||
}) | ||
|
||
test(`is consistent for preview config page`, async ({ | ||
page, | ||
}: { page: Page }): Promise<void> => { | ||
await page.goto(repoPreviewURL, customTimeout) | ||
await page.waitForSelector('button:has-text("URL")', customTimeout) | ||
const image = await page.screenshot() | ||
expect(image).toMatchSnapshot(customDiffPixelRatio) | ||
}) | ||
}) |
Binary file added
BIN
+295 KB
...apshots/Socialify-UI-is-consistent-for-error-404-page-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+295 KB
...pshots/Socialify-UI-is-consistent-for-error-404-page-1-Microsoft-Edge-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+562 KB
...apshots/Socialify-UI-is-consistent-for-error-404-page-1-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+294 KB
...ts-snapshots/Socialify-UI-is-consistent-for-error-404-page-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+141 KB
....ts-snapshots/Socialify-UI-is-consistent-for-error-404-page-1-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+283 KB
...snapshots/Socialify-UI-is-consistent-for-landing-page-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+282 KB
...napshots/Socialify-UI-is-consistent-for-landing-page-1-Microsoft-Edge-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+509 KB
...snapshots/Socialify-UI-is-consistent-for-landing-page-1-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+283 KB
...c.ts-snapshots/Socialify-UI-is-consistent-for-landing-page-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+140 KB
...ec.ts-snapshots/Socialify-UI-is-consistent-for-landing-page-1-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+204 KB
...ts/Socialify-UI-is-consistent-for-preview-config-page-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+203 KB
...s/Socialify-UI-is-consistent-for-preview-config-page-1-Microsoft-Edge-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+226 KB
...ts/Socialify-UI-is-consistent-for-preview-config-page-1-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+204 KB
...apshots/Socialify-UI-is-consistent-for-preview-config-page-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+133 KB
...napshots/Socialify-UI-is-consistent-for-preview-config-page-1-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,46 @@ | ||
import { type Page, expect, test } from '@playwright/test' | ||
|
||
// Give each expect a generous timeout of 60 seconds. | ||
const customTimeout = { timeout: 60000 } | ||
|
||
// Testing constants. | ||
const repo: string = 'wei/socialify' | ||
const expectedConfigURL: string = | ||
'/wei/socialify?language=1&owner=1&name=1&stargazers=1&theme=Light' | ||
const expectedImageURLRegExp: RegExp = | ||
/\/wei\/socialify\/image\?language=1&owner=1&name=1&stargazers=1&theme=Light$/ | ||
|
||
async function getClipboardText(page: Page): Promise<string> { | ||
return await page.evaluate(async () => { | ||
return await navigator.clipboard.readText() | ||
}) | ||
} | ||
|
||
test.beforeEach(async ({ page }: { page: Page }): Promise<void> => { | ||
await page.goto('/', customTimeout) | ||
}) | ||
|
||
test.describe('A simple user story:', () => { | ||
test(`user can enter a GitHub repo ("username/repo"), click submit button, click "URL", and get the social preview image`, async ({ | ||
page, | ||
}: { page: Page }): Promise<void> => { | ||
// Input and submit the repo following accessibility best practices. | ||
await page.fill('input[name="repo-input"]', repo) | ||
await page.click('button[type="submit"]') | ||
|
||
// Wait for navigation to the preview config page. | ||
await expect(page).toHaveURL(expectedConfigURL, customTimeout) | ||
|
||
await page.click('button:has-text("URL")') | ||
|
||
// Compare the clipboard content to the expected image URL. | ||
// (Only check the end of the URL due to dynamic localhost port allocation.) | ||
const url: string = await getClipboardText(page) | ||
expect(url).toMatch(expectedImageURLRegExp) | ||
|
||
// Visit the image URL and snapshot the image. | ||
await page.goto(url, customTimeout) | ||
const image = await page.screenshot() | ||
expect(image).toMatchSnapshot() | ||
}) | ||
}) |
Binary file added
BIN
+31.5 KB
...ub-r-50b6f-click-URL-and-get-the-social-preview-image-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.5 KB
...b-r-50b6f-click-URL-and-get-the-social-preview-image-1-Microsoft-Edge-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.6 KB
...ub-r-50b6f-click-URL-and-get-the-social-preview-image-1-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.5 KB
...-GitHub-r-50b6f-click-URL-and-get-the-social-preview-image-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+58 KB
...a-GitHub-r-50b6f-click-URL-and-get-the-social-preview-image-1-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -3,15 +3,25 @@ | |
"version": "2.12.1", | ||
"description": "Socialify your project. Share with the world!", | ||
"author": "@CryogenicPlanet, @wei", | ||
"contributors": [ | ||
{ | ||
"name": "Keming He", | ||
"email": "[email protected]", | ||
"url": "https://linkedin.com/in/keminghe" | ||
} | ||
], | ||
"license": "MIT", | ||
"repository": "https://github.com/wei/socialify.git", | ||
"scripts": { | ||
"dev": "next dev", | ||
"debug": "NODE_OPTIONS='--inspect' next", | ||
"build": "next build", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:update-snapshot": "jest -u", | ||
"test:unit": "jest", | ||
"test:unit:watch": "jest --watch", | ||
"test:unit:update-snapshot": "jest -u", | ||
"test:e2e": "playwright test", | ||
"test:e2e:update-snapshot": "playwright test --update-snapshots", | ||
"test": "yarn test:unit && yarn test:e2e", | ||
"start": "next start", | ||
"lint": "biome ci --max-diagnostics=999 .", | ||
"lint:fix": "biome check --write --verbose --max-diagnostics=999 .", | ||
|
@@ -27,15 +37,12 @@ | |
}, | ||
"dependencies": { | ||
"@resvg/resvg-wasm": "^2.6.2", | ||
"autoprefixer": "^10.4.20", | ||
"badgen": "^3.2.3", | ||
"clsx": "^2.1.1", | ||
"copee": "^1.0.6", | ||
"daisyui": "^2.52.0", | ||
"hero-patterns": "^2.1.0", | ||
"is-ci": "^3.0.1", | ||
"next": "^14.2.8", | ||
"postcss": "^8.4.49", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"react-error-boundary": "^4.1.2", | ||
|
@@ -44,25 +51,29 @@ | |
"satori": "^0.10.14", | ||
"simple-icons": "^13.17.0", | ||
"styled-jsx": "^5.1.6", | ||
"tailwindcss": "^3.4.15", | ||
"typescript": "~5.7.2", | ||
"use-debounce": "^10.0.4", | ||
"yoga-wasm-web": "^0.3.3" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "^1.9.4", | ||
"@changesets/cli": "^2.27.10", | ||
"@playwright/test": "^1.49.0", | ||
"@testing-library/dom": "^10.4.0", | ||
"@testing-library/jest-dom": "^6.6.3", | ||
"@testing-library/react": "^16.0.1", | ||
"@types/jest": "^29.5.14", | ||
"@types/react": "18.3.12", | ||
"autoprefixer": "^10.4.20", | ||
"daisyui": "^4.12.14", | ||
"graphql": "^16.9.0", | ||
"graphql-compiler": "^1.7.0", | ||
"husky": "^9.1.7", | ||
"identity-obj-proxy": "^3.0.0", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0" | ||
"jest-environment-jsdom": "^29.7.0", | ||
"postcss": "^8.4.49", | ||
"tailwindcss": "^3.4.15", | ||
"typescript": "^5.7.2" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
|
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,109 @@ | ||
import { defineConfig, devices } from '@playwright/test' | ||
|
||
// See https://playwright.dev/docs/test-configuration. | ||
export default defineConfig({ | ||
testDir: './.playwright', | ||
testMatch: '**/*.spec.ts', | ||
|
||
// Run tests in files in parallel. | ||
fullyParallel: true, | ||
|
||
// Fail the build on CI if you accidentally left test.only in the source code. | ||
forbidOnly: !!process.env.CI, | ||
|
||
// Retry on CI only. | ||
retries: process.env.CI ? 2 : 0, | ||
|
||
// Opt out of parallel tests on CI. | ||
workers: process.env.CI ? 1 : undefined, | ||
|
||
// Reporter to use. | ||
// See https://playwright.dev/docs/test-reporters for more. | ||
reporter: [ | ||
[ | ||
'html', | ||
{ | ||
outputFolder: './.playwright/test-report', | ||
}, | ||
], | ||
], | ||
|
||
// Folder for test artifacts such as screenshots and trace files. | ||
outputDir: './.playwright/test-results', | ||
|
||
// Shared settings for all the projects below. | ||
// See https://playwright.dev/docs/api/class-testoptions. | ||
use: { | ||
// Base URL to use in actions such as `await page.goto("/")`. | ||
baseURL: 'http://127.0.0.1:3000', | ||
|
||
// Collect trace when retrying the failed test. | ||
// See https://playwright.dev/docs/trace-viewer for more. | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
// Configure projects for major browsers. | ||
projects: [ | ||
/* Test against desktop viewports. */ | ||
{ | ||
name: 'chromium', | ||
use: { | ||
...devices['Desktop Chrome'], | ||
permissions: ['clipboard-read'], | ||
}, | ||
}, | ||
|
||
// Firefox supports clipboard permission by default. | ||
// (In fact, clipboard permission is not defined for Firefox. DO NOT ADD IT.) | ||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
// Playwright's clipboard permission is bugged on Safari. | ||
// { | ||
// name: "webkit", | ||
// use: { ...devices["Desktop Safari"] } | ||
// }, | ||
|
||
/* Test against mobile viewports. */ | ||
{ | ||
name: 'Mobile Chrome', | ||
use: { | ||
...devices['Pixel 5'], | ||
permissions: ['clipboard-read'], | ||
}, | ||
}, | ||
|
||
// Playwrights's clipboard permission is bugged on Mobile Safari, too. | ||
// { | ||
// name: "Mobile Safari", | ||
// use: { ...devices["iPhone 12"] } | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
{ | ||
name: 'Microsoft Edge', | ||
use: { | ||
...devices['Desktop Edge'], | ||
channel: 'msedge', | ||
permissions: ['clipboard-read'], | ||
}, | ||
}, | ||
{ | ||
name: 'Google Chrome', | ||
use: { | ||
...devices['Desktop Chrome'], | ||
channel: 'chrome', | ||
permissions: ['clipboard-read'], | ||
}, | ||
}, | ||
], | ||
|
||
// Run your local dev server before starting the tests. | ||
webServer: { | ||
command: 'yarn dev', | ||
url: 'http://127.0.0.1:3000', | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
}) |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I like your email address hehe! Great idea~ What do you think about using all contributors spec or similar in
README.md
so it's easier to maintain and more visible, instead of ballooning thepackage.json
?