Skip to content

Commit

Permalink
Merge branch 'master' into update-v7
Browse files Browse the repository at this point in the history
  • Loading branch information
asr2003 authored Feb 23, 2025
2 parents 55fcaa3 + efb9c87 commit 8db475e
Show file tree
Hide file tree
Showing 75 changed files with 1,925 additions and 283 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/argos.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
name: Argos CI Screenshots

on:
workflow_dispatch:
push:
paths:
- '**.js'
- '**.json'
- '**.yml'
- '**.yaml'
- '**.css'
branches: [master]
pull_request:
paths:
- '**.js'
- '**.json'
- '**.yml'
- '**.yaml'
- '**.css'
branches: [master]


jobs:
take-screenshots:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: current
node-version: 22.x

- name: Install dependencies
run: yarn install
run: npm install

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

- name: Build the website
run: yarn docusaurus build
run: npm run build

- name: Take screenshots with Playwright
run: yarn playwright test
run: npx playwright test

- name: Upload screenshots to Argos
env:
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
run: yarn argos upload ./screenshots
run: npx argos upload ./screenshots
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
screenshots
22 changes: 22 additions & 0 deletions argo_utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const cheerio = require("cheerio");
const fs = require("fs");

function extractSitemapPathnames(sitemapPath) {
const sitemap = fs.readFileSync(sitemapPath).toString();
const $ = cheerio.load(sitemap, { xmlMode: true });
const urls = [];
$("loc").each(function handleLoc() {
urls.push($(this).text());
});
return urls.map((url) => new URL(url).pathname);
}

// Converts a pathname to a decent screenshot name
function pathnameToArgosName(pathname) {
return pathname.replace(/^\/|\/$/g, "") || "index";
}

module.exports = {
extractSitemapPathnames,
pathnameToArgosName,
};
Loading

0 comments on commit 8db475e

Please sign in to comment.