Skip to content
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

Visual tests #2534

Merged
merged 62 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b7e0248
ci: testing visual comp
karl-cardenas-coding Mar 29, 2024
8f8ca2e
ci: more test
karl-cardenas-coding Mar 29, 2024
c1856c1
test: changes
karl-cardenas-coding Mar 29, 2024
f8fbd16
chore: update CI
karl-cardenas-coding Mar 29, 2024
b115a6b
Merge branch 'master' of github.com:spectrocloud/librarium into visua…
karl-cardenas-coding Mar 29, 2024
013572b
chore: fix npm
karl-cardenas-coding Mar 29, 2024
b24ac3a
save
karl-cardenas-coding Mar 29, 2024
7e73246
chore: working locally
karl-cardenas-coding Mar 29, 2024
990d607
chore: working logic
karl-cardenas-coding Mar 29, 2024
376ef39
chore: save
karl-cardenas-coding Mar 30, 2024
023bfd4
chore: testing CI
karl-cardenas-coding Mar 30, 2024
6c6d255
ci: test ci
karl-cardenas-coding Mar 30, 2024
a7d4689
ci: more test
karl-cardenas-coding Mar 30, 2024
23e7a76
ci: more ci tests
karl-cardenas-coding Mar 30, 2024
39ad322
ci: test
karl-cardenas-coding Mar 30, 2024
72c48f2
chore: updated test
karl-cardenas-coding Mar 30, 2024
bd9111d
chore: test
karl-cardenas-coding Mar 30, 2024
75347ad
more tests
karl-cardenas-coding Mar 30, 2024
6be0f98
ci: test
karl-cardenas-coding Mar 30, 2024
e133cdc
ci: change folder structure
karl-cardenas-coding Mar 30, 2024
a1d27f5
chore: fixed ci
karl-cardenas-coding Mar 30, 2024
979eb23
chore: reduce test feedback
karl-cardenas-coding Mar 30, 2024
91dff3b
chore: more test
karl-cardenas-coding Mar 30, 2024
9df7d23
ci: path change
karl-cardenas-coding Mar 30, 2024
622377e
ci: more test
karl-cardenas-coding Mar 30, 2024
918eee6
ci: update tar config
karl-cardenas-coding Mar 31, 2024
22b52ad
ci: retrest
karl-cardenas-coding Mar 31, 2024
a695f69
chore: test
karl-cardenas-coding Mar 31, 2024
4c7e4bd
chore: test
karl-cardenas-coding Mar 31, 2024
bffceee
ci: more test
karl-cardenas-coding Mar 31, 2024
6e0c103
chore: more test
karl-cardenas-coding Mar 31, 2024
175f02f
save
karl-cardenas-coding Mar 31, 2024
a9bf135
ci: different workflow
karl-cardenas-coding Mar 31, 2024
c22b634
chore: fixed logic
karl-cardenas-coding Mar 31, 2024
5021d00
chore: more tests
karl-cardenas-coding Mar 31, 2024
cf4cf20
core: ready for PR test
karl-cardenas-coding Mar 31, 2024
a294a9f
ci: added missing steps
karl-cardenas-coding Mar 31, 2024
d2fd0c1
ci: screenshot logic
karl-cardenas-coding Mar 31, 2024
2026da2
ci: trigger
karl-cardenas-coding Mar 31, 2024
5b205e8
ci: more logic
karl-cardenas-coding Mar 31, 2024
948fa5c
ci: fix test path
karl-cardenas-coding Mar 31, 2024
c854284
test: new logic
karl-cardenas-coding Mar 31, 2024
33d3118
ci: fix download path
karl-cardenas-coding Mar 31, 2024
0e255d0
chore: ready
karl-cardenas-coding Apr 1, 2024
1935902
save
karl-cardenas-coding Apr 1, 2024
0dc1322
Merge branch 'master' of github.com:spectrocloud/librarium into visua…
karl-cardenas-coding Apr 1, 2024
729fdbc
ci: more tests
karl-cardenas-coding Apr 1, 2024
533aabb
Merge branch 'master' into visual-tests
karl-cardenas-coding Apr 1, 2024
12b77e6
ci: fix screenshots
karl-cardenas-coding Apr 1, 2024
b240e06
ci: more changes
karl-cardenas-coding Apr 1, 2024
c1f6156
chore: more tests
karl-cardenas-coding Apr 1, 2024
425c5c4
ci: more tests
karl-cardenas-coding Apr 1, 2024
fd0a3e7
chore: restart
karl-cardenas-coding Apr 1, 2024
bd3620c
chore: update
karl-cardenas-coding Apr 1, 2024
39905dc
ci: removed Appzi from builds
karl-cardenas-coding Apr 1, 2024
f0d24d3
chore: save
karl-cardenas-coding Apr 1, 2024
bf3f210
ci: new test
karl-cardenas-coding Apr 1, 2024
3a188f4
save
karl-cardenas-coding Apr 2, 2024
b05d5c2
ci: updated artifacts logic
karl-cardenas-coding Apr 2, 2024
19bb87e
chore: verify self-hosted runner
karl-cardenas-coding Apr 2, 2024
b03ca5d
Merge branch 'master' of github.com:spectrocloud/librarium into visua…
karl-cardenas-coding Apr 2, 2024
4c49175
chore: ready for merge
karl-cardenas-coding Apr 2, 2024
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
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ CHANGES
.gitignore
.cache
prow/
.env
.env
screenshots/
tests/screenshot.spec.ts-snapshots/
tests-results/
playwright-report/
61 changes: 61 additions & 0 deletions .github/workflows/clean-up-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Delete Visual Tests Reports

on:
delete:
branches-ignore: [master, main, gh-pages]


concurrency:
group: ${{ github.event.ref }}
cancel-in-progress: true

jobs:
delete_reports:
name: Delete Reports
runs-on: ubuntu-latest
env:
# Contains all reports for deleted branch
BRANCH_REPORTS_DIR: reports/${{ github.event.ref }}
steps:
- name: Checkout GitHub Pages Branch
uses: actions/checkout@v4
with:
ref: gh-pages

- name: Set Git User
# see: https://github.com/actions/checkout/issues/13#issuecomment-724415212
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Check for workflow reports
run: |
if [ -z "$(ls -A $BRANCH_REPORTS_DIR)" ]; then
echo "BRANCH_REPORTS_EXIST="false"" >> $GITHUB_ENV
else
echo "BRANCH_REPORTS_EXIST="true"" >> $GITHUB_ENV
fi

- name: Delete reports from repo for branch
if: ${{ env.BRANCH_REPORTS_EXIST == 'true' }}
timeout-minutes: 3
run: |
cd $BRANCH_REPORTS_DIR/..

rm -rf ${{ github.event.ref }}
git add .
git commit -m "workflow: remove all reports for branch ${{ github.event.ref }}"

while true; do
git pull --rebase
if [ $? -ne 0 ]; then
echo "Failed to rebase. Please review manually."
exit 1
fi

git push
if [ $? -eq 0 ]; then
echo "Successfully pushed HTML reports to repo."
exit 0
fi
done
132 changes: 132 additions & 0 deletions .github/workflows/screenshot_capture.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Screenshot Capture
# This workflow is triggered when a workflow run of the "Release to Production" workflow is completed or when manually triggered.
# The primary purpose of this workflow is to take screenshots of the website using Playwright and upload them as artifacts.
# The screenshots can be used to compare the visual appearance of the website before and after a release.
# The workflow Visual Comparison uses these screenshots to generate a visual comparison report.

on:
workflow_run:
workflows: ["Release to Production"]
types: [completed]
workflow_dispatch:



env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MENDABLE_API_KEY: ${{ secrets.MENDABLE_API_KEY }}
FULLSTORY_ORGID: ${{ secrets.FULLSTORY_ORGID }}
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }}


jobs:

create-assets:
name: asset-builds
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"

- name: Install Dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: Build Website
run: make build

- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: "build"
path: |
build/
if-no-files-found: error
retention-days: 1




visual-snapshots:
runs-on: ubuntu-latest
needs: [create-assets]
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"

- name: Install Dependencies
uses: Wandalen/wretry.action@v3
with:
command: npm ci
attempt_limit: 3
attempt_delay: 60000 # 1 minute

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: retry action
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 3
action: actions/download-artifact@v4
with: |
name: build
path: build
attempt_delay: 60000 # 1 minute

- name: Take Screenshots with Playwright
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} || exit 0

- name: Upload Screenshots
uses: actions/upload-artifact@v4
id: screenshots
with:
name: screenshots-${{ matrix.shardIndex }}
path: |
screenshots/
if-no-files-found: error
retention-days: 1

merge-snapshots:
name: Merge Screenshots
runs-on: ubuntu-latest
needs: [visual-snapshots]
steps:

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: screenshots
pattern: screenshots-*
merge-multiple: true

- name: Upload Screenshots
uses: actions/upload-artifact@v4
id: screenshots
with:
name: "screenshots"
path: |
screenshots/
if-no-files-found: error
retention-days: 3
Loading
Loading