Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: change folder structure
Browse files Browse the repository at this point in the history
karl-cardenas-coding committed Mar 30, 2024
1 parent 6be0f98 commit e133cdc
Showing 2 changed files with 21 additions and 19 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/visual-comparison.yaml
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ jobs:
path: |
screenshots/screenshot.spec.ts-snapshots/
if-no-files-found: error
retention-days: 1
retention-days: 3

- name: Upload Report
uses: actions/upload-artifact@v4
@@ -81,7 +81,7 @@ jobs:
path: |
playwright-report/
if-no-files-found: error
retention-days: 1
retention-days: 3

- name: Download URLs
run: |
@@ -92,18 +92,19 @@ jobs:
uses: actions/configure-pages@v5

- name: Unique Folder name
run : mkdir ${{ github.sha }} && cp -r playwright-report/* ${{ github.sha }}
run : mkdir -p ${{ github.sha }} && cp -r playwright-report/* ${{ github.sha }}

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ github.sha }}

- name: Archive directory with SHA
run: tar -czvf visual-assets.tar ${GITHUB_SHA}

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
path: visual-assets.tar

- name: GH Pages URL
run: echo "https://spectrocloud.github.io/docs.spectrocloud.com/${{ github.sha }}/playwright-report/index.html"
run: echo "https://spectrocloud.github.io/librarium/${{ github.sha }}/playwright-report/index.html"


23 changes: 12 additions & 11 deletions visuals/screenshot.spec.ts
Original file line number Diff line number Diff line change
@@ -30,28 +30,29 @@ function isVersionedDocsPathname(pathname: string): boolean {

function screenshotPathname(pathname: string) {
test(`pathname ${pathname}`, async ({ page }) => {
console.log(`Taking screenshot of ${pathname}`);
const url = siteUrl + pathname;
await page.goto(url);
await page.waitForFunction(waitForDocusaurusHydration);
await page.waitForLoadState("domcontentloaded");
await page.addStyleTag({ content: stylesheet });
await page.waitForTimeout(500); // Waits for 100 milliseconds

// Sanitize the pathname to be used as a valid filename
// const sanitizedPathname = sanitizePathnameForFile(pathname);

// Ensure the screenshot is saved with a cleaned-up, valid file name
// await page.screenshot({ path: `screenshots/${sanitizedPathname}.png`, fullPage: true });

// This line ensures that the screenshot matches the expected screenshot.
// It may need to be customized based on how your testing framework expects to
// handle screenshot comparisons.
await expect(page).toHaveScreenshot({ fullPage: true, timeout: 10000 });
});
}

// test.describe("cookie-banner is visible", () => {
// test("cookie-banner is visible", async ({ page }) => {
// await page.goto(siteUrl);
// await page.waitForFunction(waitForDocusaurusHydration);
// await page.waitForLoadState("domcontentloaded");
// await page.addStyleTag({ content: stylesheet });
// await expect(page).toHaveScreenshot({ fullPage: true });
// await expect(page.getByTestId("#usercentrics-root")).toBeVisible();
// });
// });

test.describe("Docusaurus site screenshots", () => {
const pathnames = extractSitemapPathnames(sitemapPath).filter(isVersionedDocsPathname);
console.log("Pathnames to screenshot:", pathnames);
pathnames.forEach(screenshotPathname);
});

0 comments on commit e133cdc

Please sign in to comment.