Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 52 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,26 @@ on:
push:
branches:
- main_RENAME_THIS_TO_ENABLE_TEST
workflow_dispatch:

jobs:
run-tests:
runs-on: ubuntu-latest

services:
docker:
image: docker:19.03.12
options: --privileged # container has full access to host
ports:
- 9011:9011

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Start FusionAuth
uses: fusionauth/fusionauth-github-action@v1
with:
FUSIONAUTH_VERSION: "latest" # Optional: provide FusionAuth version number otherwise it defaults to latest

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Start FusionAuth in Docker
run: docker-compose up -d # -d in background

- name: Install npm dependencies
run: |
npm install
Expand All @@ -41,3 +37,49 @@ jobs:
- name: Run Playwright tests
run: npx playwright test --project=chromium
working-directory: ./app


# Optional: Using the fusionauth-github-action is the preferred method to start FusionAuth in the workflow, but if you want to start FusionAuth with docker-compose instead, you can use the configuration below (for example, if you need to use a custom password hashing plugin).
# name: Test FusionAuth login
# on:
# push:
# branches:
# - main_RENAME_THIS_TO_ENABLE_TEST

# jobs:
# run-tests:
# runs-on: ubuntu-latest

# services:
# docker:
# image: docker:19.03.12
# options: --privileged # container has full access to host
# ports:
# - 9011:9011

# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '18'

# - name: Start FusionAuth in Docker
# run: docker-compose up -d # -d in background

# - name: Install npm dependencies
# run: |
# npm install
# npx playwright install-deps
# npx playwright install
# working-directory: ./app

# - name: Start app
# run: npm run start & # & in background
# working-directory: ./app

# - name: Run Playwright tests
# run: npx playwright test --project=chromium
# working-directory: ./app
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It's part of the article available at: https://fusionauth.io/docs/get-started/ru
To run this application you will need Node.js and Docker installed. In a terminal run the code below.

```bash
git clone https://github.com/FusionAuth/fusionauth_github_actions.git
git clone https://github.com/FusionAuth/fusionauth-example-github-actions.git
docker compose up
```

Expand All @@ -35,4 +35,8 @@ npx playwright test --project=chromium;

## Run the tests in a GitHub action

To run these tests in a GitHub action, fork this repository, change the branch in `.github/workflows/test.yaml` from `main_RENAME_THIS_TO_ENABLE_TEST` to `main`. Commit and push. The action will start running in the Actions tab in the repository site.
> By default, GitHub prevents action workflows from running on forked repositories. To grant permission for the workflow to execute, navigate to the Actions tab on your forked repository in GitHub and click on the **I understand my workflows, go ahead and enable them** button on the repository.

To run these tests in a GitHub action, fork this repository, change the branch name in `.github/workflows/test.yaml` from `main_RENAME_THIS_TO_ENABLE_TEST` to `main`. Commit and push. The action will start running in the Actions tab in the repository site.