From 84d56ac8ed416e30cb1cf2c45b9bd19e81418cb2 Mon Sep 17 00:00:00 2001 From: Noamili <105313965+Noamili@users.noreply.github.com> Date: Fri, 8 Jul 2022 13:38:46 +0300 Subject: [PATCH] Staging (#254) * feat: add Yedidya Rashi profile (#220) * chore: remove idea folder (#236) * updating readme: custom image (#239) * test: add e2e infra with playwright and a sample test (#235) * test: add e2e infra with playwright and a sample test * test: add github action for e2e test * test: add config for framework spin-up * Yedidyar/issue167 (#240) * feat: add Yedidya Rashi profile (#220) * fix: randomShuffle isn't working correctly (#167) * fix(Description): wrap descriptionHeight with useEffect (#243) see more about the issue: https://stackoverflow.com/questions/62336340/cannot-update-a-component-while-rendering-a-different-component-warning * There is no background for the role of Former admin label Fixes #241 * Test (#238) * inital commit * revert change Co-authored-by: noa Co-authored-by: yedidya rashi Co-authored-by: Omri Bar-Zik Co-authored-by: shir22 <33841818+shir22@users.noreply.github.com> Co-authored-by: Liran Tal Co-authored-by: Inbar Danieli Co-authored-by: noa --- .github/workflows/e2e-ci.yml | 15 +++++++++ .gitignore | 10 ++++++ .idea/.gitignore | 8 ----- .idea/checkstyle-idea.xml | 16 --------- .idea/codeStyles/codeStyleConfig.xml | 5 --- .idea/misc.xml | 6 ---- .idea/modules.xml | 8 ----- .idea/pull-request-community.iml | 9 ------ .idea/vcs.xml | 6 ---- README.md | 6 +++- components/description/Description.tsx | 4 ++- components/label/label.module.scss | 3 ++ e2e/home.spec.ts | 8 +++++ package-lock.json | 45 ++++++++++++++++++++++++++ package.json | 6 ++-- pages/index.tsx | 1 + playwright.config.ts | 10 ++++++ 17 files changed, 104 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/e2e-ci.yml delete mode 100644 .idea/.gitignore delete mode 100644 .idea/checkstyle-idea.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/pull-request-community.iml delete mode 100644 .idea/vcs.xml create mode 100644 e2e/home.spec.ts create mode 100644 playwright.config.ts diff --git a/.github/workflows/e2e-ci.yml b/.github/workflows/e2e-ci.yml new file mode 100644 index 0000000..d5bb769 --- /dev/null +++ b/.github/workflows/e2e-ci.yml @@ -0,0 +1,15 @@ +name: "Tests: E2E" +on: [pull_request] +jobs: + tests_e2e: + name: Run end-to-end tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + - name: install dependencies + run: npm ci + - name: install playwright browsers + run: npx playwright install --with-deps + - name: npm run test:e2e + run: npm run test:e2e diff --git a/.gitignore b/.gitignore index 1437c53..0a7ad7a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,13 @@ yarn-error.log* # vercel .vercel + +## IDE's +.idea/ + +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 73f69e0..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index bfcfff7..0000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index a55e7a1..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index ad03785..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8020e3a..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/pull-request-community.iml b/.idea/pull-request-community.iml deleted file mode 100644 index d6ebd48..0000000 --- a/.idea/pull-request-community.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 8edef0a..2ac25a2 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,11 @@ You can add / update your personal profile by creating a Pull Request to this re and anything that you are passionate about. Are you an architect? Do you speak Chinese? Studied amusement park and roller coaster engineering? This is the place to brag! -2. By default, we'll use your GitHub photo. There's currently an [open issue](https://github.com/urish/pull-request-community/issues/78) to allow custom profile photos. +2. By default, we'll use your GitHub photo. If you don't have a GitHub profile photo, + or want to use a different one, add it under [public/images/people](public/images/people) in jpeg format. + Use your GitHub username for the image, e.g. `MichalPorag.jpg`. + + Then, add `"customImage": true` to your profile JSON that you created in the previous step. 3. Create a pull request with new files. diff --git a/components/description/Description.tsx b/components/description/Description.tsx index f6d063e..58b1515 100644 --- a/components/description/Description.tsx +++ b/components/description/Description.tsx @@ -6,7 +6,9 @@ const Description = ({ descriptionOutput, descriptionHeight }) => { const myRef = useRef(null); const [height, setHeight] = useState(0); - descriptionHeight(height); + useEffect(() => { + descriptionHeight(height); + }, [descriptionHeight, height]); useEffect(() => { const handleResize = () => { diff --git a/components/label/label.module.scss b/components/label/label.module.scss index 54bcc46..45c737f 100644 --- a/components/label/label.module.scss +++ b/components/label/label.module.scss @@ -11,6 +11,9 @@ &[role="Admin"] { background: cornflowerblue; } + &[role="Former admin"] { + background: cadetblue; + } @media screen and (max-width: 600px) { font-size: 10px; diff --git a/e2e/home.spec.ts b/e2e/home.spec.ts new file mode 100644 index 0000000..7362739 --- /dev/null +++ b/e2e/home.spec.ts @@ -0,0 +1,8 @@ +import { test, expect } from '@playwright/test' + +test('page should have title of "קהילת Pull Request"', async ({page}) => { + await page.goto('http://localhost:3000/') + const title = await page.title() + expect(title).toBe('קהילת Pull Request') +}); + diff --git a/package-lock.json b/package-lock.json index b9f3ad7..ccda812 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "uuid": "^8.3.2" }, "devDependencies": { + "@playwright/test": "^1.22.2", "@types/node": "^14.11.2", "@types/react": "^16.9.50", "eslint": "^7.32.0", @@ -1006,6 +1007,22 @@ "node": ">= 8" } }, + "node_modules/@playwright/test": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz", + "integrity": "sha512-cCl96BEBGPtptFz7C2FOSN3PrTnJ3rPpENe+gYCMx4GNNDlN4tmo2D89y13feGKTMMAIVrXfSQ/UmaQKLy1XLA==", + "dev": true, + "dependencies": { + "@types/node": "*", + "playwright-core": "1.22.2" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@rushstack/eslint-patch": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.1.3.tgz", @@ -5280,6 +5297,18 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "node_modules/playwright-core": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.22.2.tgz", + "integrity": "sha512-w/hc/Ld0RM4pmsNeE6aL/fPNWw8BWit2tg+TfqJ3+p59c6s3B6C8mXvXrIPmfQEobkcFDc+4KirNzOQ+uBSP1Q==", + "dev": true, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/please-upgrade-node": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", @@ -7532,6 +7561,16 @@ "fastq": "^1.6.0" } }, + "@playwright/test": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz", + "integrity": "sha512-cCl96BEBGPtptFz7C2FOSN3PrTnJ3rPpENe+gYCMx4GNNDlN4tmo2D89y13feGKTMMAIVrXfSQ/UmaQKLy1XLA==", + "dev": true, + "requires": { + "@types/node": "*", + "playwright-core": "1.22.2" + } + }, "@rushstack/eslint-patch": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.1.3.tgz", @@ -10766,6 +10805,12 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "playwright-core": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.22.2.tgz", + "integrity": "sha512-w/hc/Ld0RM4pmsNeE6aL/fPNWw8BWit2tg+TfqJ3+p59c6s3B6C8mXvXrIPmfQEobkcFDc+4KirNzOQ+uBSP1Q==", + "dev": true + }, "please-upgrade-node": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", diff --git a/package.json b/package.json index 667f33c..c77f7a9 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,10 @@ "dev": "npm run open-browser && next dev", "open-browser": "node ./scripts/open-browser.js", "build": "next build", - "start": "next start", + "start": "npm run build && next start", "prepare": "husky install", - "lint": "next lint" + "lint": "next lint", + "test:e2e": "playwright test" }, "dependencies": { "@mdi/js": "^5.6.55", @@ -22,6 +23,7 @@ "uuid": "^8.3.2" }, "devDependencies": { + "@playwright/test": "^1.22.2", "@types/node": "^14.11.2", "@types/react": "^16.9.50", "eslint": "^7.32.0", diff --git a/pages/index.tsx b/pages/index.tsx index 94e8949..b53a2b8 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -30,5 +30,6 @@ export const getStaticProps: GetStaticProps = async () => { props: { people: randomShuffle(getPeople()), }, + revalidate: true, }; }; diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..1a927d3 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,10 @@ +import { PlaywrightTestConfig } from "@playwright/test"; + +const config: PlaywrightTestConfig = { + webServer: { + command: "npm run start", + url: "http://localhost:3000", + } +}; + +export default config; \ No newline at end of file