diff --git a/.github/workflows/pr_ci_playwright_e2e.yaml b/.github/workflows/pr_ci_playwright_e2e.yaml index b7369f4ff..e6d9eeb99 100644 --- a/.github/workflows/pr_ci_playwright_e2e.yaml +++ b/.github/workflows/pr_ci_playwright_e2e.yaml @@ -4,18 +4,18 @@ on: jobs: frontend: - name: Run PR Frontend Check + name: Run PR Frontend E2E Check runs-on: ubuntu-latest environment: dev steps: - - name: cleanup old checkout + - name: Cleanup Old Checkout run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*; - name: Checkout uses: actions/checkout@v4 - - name: Clean up any existing containers + - name: Clean Any Existing Containers run: | docker stop $(docker ps -aq) || true docker rm $(docker ps -aq) || true @@ -27,32 +27,39 @@ jobs: ! nc -z localhost 5432 - name: Run Docker Compose - run: docker compose --env-file .env.dev up --build -d + run: docker compose --env-file .env.dev up --build -d backend db - name: Check Docker Container Logs run: docker compose --env-file .env.dev logs - - name: Setup Node environment + - name: Setup Node Environment uses: actions/setup-node@v4 with: node-version: 20 - - name: Clean Yarn cache + - uses: c-py/action-dotenv-to-setenv@v5 + with: + env-file: .env.dev + + - name: Clean Yarn Cache working-directory: ./frontend - run: | - sudo yarn cache clean + run: sudo yarn cache clean - name: Install dependencies via Yarn working-directory: ./frontend run: | sudo yarn install + sudo yarn build + + - name: Run Node Server + working-directory: ./frontend + run: nohup node .output/server/index.mjs & - name: Install Playwright Browsers working-directory: ./frontend - run: | - sudo yarn playwright install --with-deps + run: sudo yarn playwright install --with-deps - - name: Wait for web server to be ready + - name: Wait for Web Server working-directory: ./frontend run: | MAX_ATTEMPTS=3 @@ -76,12 +83,11 @@ jobs: fi done - - name: Run Playwright tests + - name: Run Playwright Tests working-directory: ./frontend - run: | - sudo yarn playwright test --reporter=html + run: sudo yarn playwright test - - name: Upload Playwright report + - name: Upload Playwright Report if: always() uses: actions/upload-artifact@v4 with: diff --git a/.prettierignore b/.prettierignore index f45f23c4d..5695e88c9 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,6 @@ node_modules/ .nuxt/ +.output/ playwright-report/ tests-examples/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a58f56d69..72325d415 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,8 +27,9 @@ If you have questions or would like to communicate with the team, please [join u - [Documentation](#documentation-) - [Accessibility](#accessibility-) - [Design](#design-) +- [Troubleshooting](#troubleshooting-) - + ## First steps as a contributor [`⇧`](#contents) @@ -44,7 +45,7 @@ Thank you for your interest in contributing to activist.org! We look forward to - Check out our [public designs on Figma](https://www.figma.com/file/I9McFfaLu1RiiWp5IP3YjE/activist_public_designs?type=design&node-id=10%3A18&mode=design&t=tdQyOtl5lU1n7oLN-1) to understand activist's goals and direction - Consider joining our [bi-weekly developer sync](https://etherpad.wikimedia.org/p/activist-dev-sync)! - + ## Tech Stack [`⇧`](#contents) @@ -73,7 +74,7 @@ The following are the current and planned technologies for [activist.org](https: > [!NOTE] > Those new to any frameworks or technologies who want to work on their skills are more than welcome to contribute! - + ## Learning the tech stack [`⇧`](#contents) @@ -119,7 +120,7 @@ activist is very open to contributions from people in the early stages of their
- + ## Development environment [`⇧`](#contents) @@ -223,7 +224,7 @@ git remote add upstream https://github.com/activist-org/activist.git > [!NOTE] > Feel free to contact the team in the [Development room on Matrix](https://matrix.to/#/!CRgLpGeOBNwxYCtqmK:matrix.org?via=matrix.org&via=acter.global&via=chat.0x7cd.xyz) if you're having problems getting your environment setup! - + ### Using Yarn or Python @@ -237,6 +238,11 @@ The frontend currently uses [Yarn 1](https://classic.yarnpkg.com/lang/en/docs/in ```bash # In the root activist directory: cd frontend + +# Set the environment variables: +set -a && source ../.env.dev && set +a + +# Install and run the project: yarn install yarn run dev:local ``` @@ -324,13 +330,13 @@ yarn run story:dev From there you'll be able to visit http://localhost:6006/ to view the documentation. Contributions are very welcome! --> - + ## Style guide [`⇧`](#contents) Please see the [activist style guide](STYLEGUIDE.md) for details about how to follow the code style for the project. We made these guidelines to assure that we as a community write clean, cohesive code that's easy to write and review. Suggestions for the style guide are welcome. - + ## Testing [`⇧`](#contents) @@ -389,7 +395,41 @@ Please see the [frontend testing guide](FRONTEND_TESTING.md) for information on > [!NOTE] > The vitest test suite is still in a very early stage. There is a lot of work left to do to increase test coverage, and some features still need troubleshooting. If you need assistance then feel free to open a PR and we'll support! - +### End to End Testing + +#### Local E2E + +In order to test locally, you first need to build the production version of the frontend as directed in the [local build directions](#using-yarn-or-python-). + +To run the end to end tests locally, please run the following commands: + +```bash +docker-compose --env-file .env.dev up backend db # run backend and db in docker +``` + +Then in a second shell: + +```bash +node .output/server/index.mjs # start the build frontend +``` + +Then in a third shell: + +```bash +yarn test:local +``` + +#### Remote E2E + +To run the tests on the repository, first create a branch from the remote branch that you want to test against. This can be done with the following command: + +```bash +git push upstream