-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add playwright skeleton #85
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
Open
carlosthe19916
wants to merge
3
commits into
securesign:main
Choose a base branch
from
carlosthe19916:feat/playwright-skeleton
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| CONSOLE_IMAGE=quay.io/securesign/rhtas-console@sha256:75966d60ed709af33efd48c53b96ea7b2fcd4608f90ccc56885bf224e34b55f5 | ||
| CONSOLE_UI_IMAGE=quay.io/securesign/rhtas-console-ui@sha256:c0b0b2d76548c05efadb2425baf93609cf6c40180f170cb531fbb7689a91db31 | ||
| CONSOLE_DB_IMAGE=registry.redhat.io/rhel9/mariadb-105@sha256:050dd5a7a32395b73b8680570e967e55050b152727412fdd73a25d8816e62d53 | ||
| CONSOLE_IMAGE=ghcr.io/securesign/rhtas-console:latest | ||
| CONSOLE_UI_IMAGE=ghcr.io/securesign/rhtas-console-ui:latest | ||
| CONSOLE_DB_IMAGE=docker.io/library/mariadb:10.5 |
This file contains hidden or 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,81 @@ | ||
| name: Start console | ||
| description: Start console using docker compose. | ||
| inputs: | ||
| ui_image: | ||
| description: image uri for the ui (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| server_image: | ||
| description: image uri for the server (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| server_db_image: | ||
| description: image uri for server-postgres (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| playwright_version: | ||
| description: version of the playwright image to run | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| outputs: | ||
| server_port: | ||
| description: Port where the server is running | ||
| value: ${{ steps.set-output.outputs.server_port }} | ||
| ui_port: | ||
| description: Port where the UI is running | ||
| value: ${{ steps.set-output.outputs.ui_port }} | ||
| playwright_port: | ||
| description: Port where the UI is running | ||
| value: ${{ steps.set-output.outputs.playwright_port }} | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Start console | ||
| working-directory: ${{ github.action_path }}/../../.. | ||
| shell: bash | ||
| run: | | ||
| opts="" | ||
|
|
||
| if [ -n "${{ inputs.server_image }}" ]; then | ||
| opts="${opts} CONSOLE_IMAGE=${{ inputs.server_image }}" | ||
| fi | ||
| if [ -n "${{ inputs.ui_image }}" ]; then | ||
| opts="${opts} CONSOLE_UI_IMAGE=${{ inputs.ui_image }}" | ||
| fi | ||
| if [ -n "${{ inputs.server_db_image }}" ]; then | ||
| opts="${opts} POSTGRESQL_IMAGE=${{ inputs.server_db_image }}" | ||
| fi | ||
|
|
||
| if [ -n "${{ inputs.playwright_version }}" ]; then | ||
| opts="${opts} PLAYWRIGHT_VERSION=${{ inputs.playwright_version }}" | ||
| fi | ||
|
|
||
| echo "opts: $opts" | ||
|
|
||
| eval "${opts} docker compose up -d" | ||
|
|
||
| - name: Wait for services to be ready | ||
| shell: bash | ||
| run: | | ||
| # Wait for backend | ||
| until curl -s http://localhost:8087/healthz | jq -e '.status == "ok"' >/dev/null 2>&1; do | ||
| echo "Waiting for healthy service response on port 8087..." | ||
| sleep 2 | ||
| done | ||
|
|
||
| # Wait for ui | ||
| until curl -s http://localhost:8088 | grep -qi "<html"; do | ||
sourcery-ai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "Waiting for HTML page on port 8088..." | ||
| sleep 2 | ||
| done | ||
|
|
||
| - id: set-output | ||
| shell: bash | ||
| run: | | ||
| echo "server_port=8087" >> $GITHUB_OUTPUT | ||
| echo "ui_port=8088" >> $GITHUB_OUTPUT | ||
| echo "playwright_port=5000" >> $GITHUB_OUTPUT | ||
This file contains hidden or 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,147 @@ | ||
| name: Run e2e RHTAS Console CI tests | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| artifact: | ||
| description: | | ||
| The name of the component being tested, ie server etc. | ||
| Must correspond to an artifact storing the custom built image, named <artifact>, | ||
| and should contain the file <artifact>.tar inside. | ||
| required: false | ||
| type: string | ||
| ui_image: | ||
| description: image uri for the ui (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| server_image: | ||
| description: image uri for the server (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| server_db_image: | ||
| description: image uri for server-postgres (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| workflow_dispatch: | ||
| inputs: | ||
| artifact: | ||
| description: | | ||
| The name of the component being tested, ie server etc. | ||
| Must correspond to an artifact storing the custom built image, named <artifact>, | ||
| and should contain the file <artifact>.tar inside. | ||
| required: false | ||
| type: string | ||
| ui_image: | ||
| description: image uri for the ui (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| server_image: | ||
| description: image uri for the server (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| server_db_image: | ||
| description: image uri for server-postgres (ie. ghcr.io/<namespace>/<image-name>:<tag>) | ||
| type: string | ||
| required: false | ||
| default: "" | ||
|
|
||
| jobs: | ||
| check-images: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Log in to registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| registry: ghcr.io | ||
|
|
||
| - name: Download artifact | ||
| if: "${{ inputs.artifact != '' }}" | ||
| uses: actions/download-artifact@v5 | ||
| with: | ||
| name: ${{ inputs.artifact }} | ||
| path: /tmp | ||
| - name: Load images | ||
| if: ${{ inputs.artifact != '' }} | ||
| run: | | ||
| docker load --input /tmp/${{ inputs.artifact }}.tar | ||
| - name: Check ui image exists | ||
| if: ${{ inputs.ui_image != '' }} | ||
| run: | | ||
| if docker image inspect ${{ inputs.ui_image }} >/dev/null 2>&1; then | ||
| echo "Image exists locally" | ||
| docker image inspect ${{ inputs.ui_image }} | ||
| else | ||
| echo "Image does not exist locally" | ||
| docker manifest inspect ${{ inputs.ui_image }} | ||
| fi | ||
| - name: Check server image exists | ||
| if: ${{ inputs.server_image != '' }} | ||
| run: | | ||
| if docker image inspect ${{ inputs.server_image }} >/dev/null 2>&1; then | ||
| echo "Image exists locally" | ||
| docker image inspect ${{ inputs.server_image }} | ||
| else | ||
| echo "Image does not exist locally" | ||
| docker manifest inspect ${{ inputs.server_image }} | ||
| fi | ||
| - name: Check server_db_image image exists | ||
| if: ${{ inputs.server_db_image != '' }} | ||
| run: | | ||
| if docker image inspect ${{ inputs.server_db_image }} >/dev/null 2>&1; then | ||
| echo "Image exists locally" | ||
| docker image inspect ${{ inputs.server_db_image }} | ||
| else | ||
| echo "Image does not exist locally" | ||
| docker manifest inspect ${{ inputs.server_db_image }} | ||
| fi | ||
|
|
||
| e2e-integration-tests: | ||
| needs: check-images | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download artifact | ||
| if: "${{ inputs.artifact != '' }}" | ||
| uses: actions/download-artifact@v5 | ||
| with: | ||
| name: ${{ inputs.artifact }} | ||
| path: /tmp | ||
| - name: Load images | ||
| if: ${{ inputs.artifact != '' }} | ||
| run: | | ||
| docker load --input /tmp/${{ inputs.artifact }}.tar | ||
|
|
||
| - name: Checkout ui repo | ||
| uses: actions/checkout@v5 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: "npm" | ||
| - name: Install dependencies | ||
| run: npm ci --verbose --ignore-scripts --no-audit | ||
|
|
||
| - name: Start rhtas-console | ||
| uses: ./.github/actions/start-console | ||
| with: | ||
| ui_image: ${{ inputs.ui_image }} | ||
| server_image: ${{ inputs.server_image }} | ||
| server_db_image: ${{ inputs.server_db_image }} | ||
|
|
||
| - name: Run Playwright tests | ||
| run: | | ||
| PW_TEST_CONNECT_WS_ENDPOINT=ws://localhost:5000/ CONSOLE_UI_URL=http://localhost:8088 AUTH_REQUIRED=false npm run -w e2e test | ||
|
|
||
| - name: Upload Playwright artifacts | ||
| if: failure() # only upload if tests failed | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: playwright-artifacts | ||
| path: | | ||
| e2e/test-results | ||
| e2e/playwright-report |
This file contains hidden or 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,79 @@ | ||
| name: CI (e2e) | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "main" | ||
| - "release/*" | ||
| pull_request: | ||
| branches: | ||
| - "main" | ||
| - "release/*" | ||
| workflow_call: | ||
| merge_group: | ||
|
|
||
| concurrency: | ||
| group: ci-e2e-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-upload-for-e2e-ci: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: save rhtas-console-ui image | ||
| run: | | ||
| docker build . -t ghcr.io/securesign/rhtas-console-ui:pr-test -f Dockerfile | ||
| docker save -o /tmp/rhtas-console-ui.tar ghcr.io/securesign/rhtas-console-ui:pr-test | ||
|
|
||
| - name: Upload console-ui image as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: rhtas-console-ui | ||
| path: /tmp/rhtas-console-ui.tar | ||
| retention-days: 1 | ||
|
|
||
| discover-envs-for-e2e-ci: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| image_tag: ${{ steps.set-outputs.outputs.image_tag }} | ||
| steps: | ||
| - name: Extract vars for Pull Request | ||
| shell: bash | ||
| if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} | ||
| env: | ||
| base_ref: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }} | ||
| run: | | ||
| branch=$base_ref | ||
| branch=$(echo ${branch#refs/heads/}) | ||
| image_tag="latest" | ||
| if [[ "$branch" != "main" ]]; then | ||
| image_tag="${branch#release/}" | ||
| fi | ||
| echo "image_tag=$image_tag" >> $GITHUB_ENV | ||
| - name: Extract vars for Push | ||
| shell: bash | ||
| if: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }} | ||
| run: | | ||
| branch=$(echo ${GITHUB_REF#refs/heads/}) | ||
| image_tag="latest" | ||
| if [[ "$branch" != "main" ]]; then | ||
| image_tag="${branch#release/}" | ||
| fi | ||
| echo "image_tag=$image_tag" >> $GITHUB_ENV | ||
| - name: Set outputs | ||
| id: set-outputs | ||
| run: | | ||
| echo ${{ env.image_tag }} | ||
| echo "image_tag=${{ env.image_tag }}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| run-e2e-ci: | ||
| needs: | ||
| - build-and-upload-for-e2e-ci | ||
| - discover-envs-for-e2e-ci | ||
| uses: ./.github/workflows/ci-e2e-template.yaml | ||
| with: | ||
| artifact: rhtas-console-ui | ||
| ui_image: ghcr.io/securesign/rhtas-console-ui:pr-test | ||
| server_image: ghcr.io/securesign/rhtas-console:${{ needs.discover-envs-for-e2e-ci.outputs.image_tag }} |
This file contains hidden or 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 hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.