diff --git a/.github/playwright.yml b/.github/playwright.yml deleted file mode 100644 index 164051b0a..000000000 --- a/.github/playwright.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Playwright Tests -on: - push: - branches: [feat/playwright-jest-cicd] - pull_request: - branches: [feat/playwright-jest-cicd] -jobs: - tests_e2e: - name: Run Playwright tests - timeout-minutes: 60 - runs-on: ubuntu-latest - env: - # BINGAI_TOKEN: ${{ secrets.BINGAI_TOKEN }} - # CHATGPT_TOKEN: ${{ secrets.CHATGPT_TOKEN }} - MONGO_URI: ${{ secrets.MONGO_URI }} - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - E2E_USER_EMAIL: ${{ secrets.E2E_USER_EMAIL }} - E2E_USER_PASSWORD: ${{ secrets.E2E_USER_PASSWORD }} - JWT_SECRET: ${{ secrets.JWT_SECRET }} - CREDS_KEY: ${{ secrets.CREDS_KEY }} - CREDS_IV: ${{ secrets.CREDS_IV }} - # NODE_ENV: ${{ vars.NODE_ENV }} - DOMAIN_CLIENT: ${{ vars.DOMAIN_CLIENT }} - DOMAIN_SERVER: ${{ vars.DOMAIN_SERVER }} - # PALM_KEY: ${{ secrets.PALM_KEY }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'npm' - - - name: Install global dependencies - run: npm ci --ignore-scripts - - - name: Install API dependencies - working-directory: ./api - run: npm ci --ignore-scripts - - - name: Install Client dependencies - working-directory: ./client - run: npm ci --ignore-scripts - - - name: Build Client - run: cd client && npm run build:ci - - - name: Install Playwright Browsers - run: npx playwright install --with-deps && npm install -D @playwright/test - - - name: Start server - run: | - npm run backend & sleep 10 - - - name: Run Playwright tests - run: npx playwright test --config=e2e/playwright.config.ts - - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: e2e/playwright-report/ - retention-days: 30 diff --git a/.github/wip-playwright.yml b/.github/wip-playwright.yml deleted file mode 100644 index 29c87ca95..000000000 --- a/.github/wip-playwright.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Playwright Tests -on: - push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] -jobs: - tests_e2e: - name: Run end-to-end tests - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Run Playwright tests - run: npx playwright test - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: e2e/playwright-report/ - retention-days: 30 diff --git a/.github/workflows/backend-review.yml b/.github/workflows/backend-review.yml index 3e9afa2e0..7c79cadce 100644 --- a/.github/workflows/backend-review.yml +++ b/.github/workflows/backend-review.yml @@ -1,15 +1,17 @@ name: Backend Unit Tests on: - push: - branches: - - main - - dev - - release/* + # push: + # branches: + # - main + # - dev + # - release/* pull_request: branches: - main - dev - release/* + paths: + - 'api/**' jobs: tests_Backend: name: Run Backend unit tests diff --git a/.github/workflows/frontend-review.yml b/.github/workflows/frontend-review.yml index 1401af97f..a26324fb0 100644 --- a/.github/workflows/frontend-review.yml +++ b/.github/workflows/frontend-review.yml @@ -1,16 +1,19 @@ #github action to run unit tests for frontend with jest name: Frontend Unit Tests on: - push: - branches: - - main - - dev - - release/* + # push: + # branches: + # - main + # - dev + # - release/* pull_request: branches: - main - dev - release/* + paths: + - 'client/**' + - 'packages/**' jobs: tests_frontend: name: Run frontend unit tests diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 000000000..a822d6307 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,81 @@ +name: Playwright Tests +on: + pull_request: + branches: + - main + - dev + - release/* + paths: + - 'api/**' + - 'client/**' + - 'packages/**' + - 'e2e/**' +jobs: + tests_e2e: + name: Run Playwright tests + timeout-minutes: 60 + runs-on: ubuntu-latest + env: + NODE_ENV: ci + CI: true + SEARCH: false + BINGAI_TOKEN: user_provided + CHATGPT_TOKEN: user_provided + MONGO_URI: ${{ secrets.MONGO_URI }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + E2E_USER_EMAIL: ${{ secrets.E2E_USER_EMAIL }} + E2E_USER_PASSWORD: ${{ secrets.E2E_USER_PASSWORD }} + JWT_SECRET: ${{ secrets.JWT_SECRET }} + CREDS_KEY: ${{ secrets.CREDS_KEY }} + CREDS_IV: ${{ secrets.CREDS_IV }} + DOMAIN_CLIENT: ${{ secrets.DOMAIN_CLIENT }} + DOMAIN_SERVER: ${{ secrets.DOMAIN_SERVER }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'npm' + + - name: Cache Node.js modules + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install global dependencies + run: npm ci + + - name: Remove sharp dependency + run: rm -rf node_modules/sharp + + - name: Install sharp with linux dependencies + run: cd api && SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp + + - name: Build Client + run: npm run frontend + + - name: Cache Playwright installations + uses: actions/cache@v3 + with: + path: ~/.cache/ms-playwright/ + key: ${{ runner.os }}-pw-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-pw- + + - name: Install Playwright Browsers + run: npx playwright install --with-deps chromium && npm install -D @playwright/test@latest + + - name: Run Playwright tests + run: npm run e2e:ci + + - name: Upload playwright report + uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: e2e/playwright-report/ + retention-days: 30 + diff --git a/.gitignore b/.gitignore index cedb6ac0a..c294b25b4 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ types/ # Environment .npmrc .env* +my.secrets !**/.env.example !**/.env.test.example cache.json diff --git a/client/src/components/Auth/LoginForm.tsx b/client/src/components/Auth/LoginForm.tsx index 30c76dcf2..c205ece32 100644 --- a/client/src/components/Auth/LoginForm.tsx +++ b/client/src/components/Auth/LoginForm.tsx @@ -107,6 +107,7 @@ function LoginForm({ onSubmit }: TLoginFormProps) {