-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Check docs links using Playwright MAASENG-4310 (#5586)
- Re-wrote the docs links checker in Playwright, as `cy.visit()` is notoriously flakey - Updated non-functioning docs links to point to correct pages: - Add machines - Set up MAAS in the UI - DHCP - Configure controllers - Build windows images - IP ranges - Automatic tags - Kernel options in tags - XPaths expressions Resolves [MAASENG-4310](https://warthogs.atlassian.net/browse/MAASENG-4310)
- Loading branch information
Showing
5 changed files
with
57 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -5,23 +5,22 @@ on: | |
push: | ||
branches: | ||
- main | ||
- "3.5" | ||
|
||
jobs: | ||
docs: | ||
name: maas.io/docs links | ||
runs-on: ubuntu-22.04 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Get branch name | ||
uses: nelonoel/[email protected] | ||
- name: Run Cypress docs tests | ||
uses: cypress-io/github-action@v4 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
browser: chrome | ||
config: baseUrl=http://maas.io/docs | ||
spec: "cypress/e2e/docs-links/**/*.spec.ts" | ||
install-command: yarn install | ||
node-version-file: '.nvmrc' | ||
- name: Install dependencies | ||
run: yarn | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run docs links checks | ||
run: yarn test-docs-links | ||
- name: Create issue on failure | ||
if: failure() | ||
uses: JasonEtco/create-an-issue@v2 | ||
|
This file was deleted.
Oops, something went wrong.
This file contains 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 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,30 +1,34 @@ | ||
const docsUrls = { | ||
aboutNativeTLS: "https://maas.io/docs/how-to-implement-tls#enabling-tls-2", | ||
addMachines: "https://maas.io/docs/how-to-manage-machines", | ||
aboutNativeTLS: | ||
"https://maas.io/docs/how-to-implement-tls#p-9022-enabling-tls", | ||
addMachines: "https://maas.io/docs/how-to-provision-machines", | ||
addNodesViaChassis: | ||
"https://maas.io/docs/how-to-manage-machines#add-machines-via-chassis-ui-2", | ||
"https://maas.io/docs/how-to-provision-machines#p-9078-add-machines", | ||
autoRenewTLSCert: | ||
"https://maas.io/docs/how-to-implement-tls#auto-renew-certs-8", | ||
"https://maas.io/docs/how-to-implement-tls#p-9022-auto-renew-certs", | ||
cloudInit: | ||
"https://maas.io/docs/how-to-customise-machines#pre-seed-cloud-init-2", | ||
"https://maas.io/docs/how-to-customise-machines#p-9014-cloud-init-pre-seeding", | ||
configurationJourney: | ||
"https://maas.io/docs/how-to-install-maas#configure-maas-with-the-ui-10", | ||
"https://maas.io/docs/how-to-install-maas#p-9034-maas-ui-setup", | ||
customisingDeployedMachines: "https://maas.io/docs/how-to-customise-machines", | ||
dhcp: "https://maas.io/docs/how-to-enable-dhcp", | ||
ipmi: "https://maas.io/docs/reference-power-drivers#ipmi-6", | ||
ipRanges: "https://maas.io/docs/how-to-enable-dhcp#create-an-ip-range-ui-2", | ||
kvmIntroduction: "https://maas.io/docs/about-virtual-machines", | ||
dhcp: "https://maas.io/docs/about-dhcp-in-maas", | ||
ipmi: "https://maas.io/docs/reference-power-drivers#p-17434-ipmi", | ||
ipRanges: | ||
"https://maas.io/docs/how-to-customise-dhcp#p-9038-edit-delete-or-extend-ip-range", | ||
kvmIntroduction: "https://maas.io/docs/how-to-use-lxd-vms", | ||
networkDiscovery: | ||
"https://maas.io/docs/about-maas-networks#network-discovery-5", | ||
rackController: "https://maas.io/docs/how-to-configure-controllers", | ||
sshKeys: "https://maas.io/docs/how-to-manage-user-access#add-ssh-keys-5", | ||
tagsAutomatic: "https://maas.io/docs/how-to-manage-tags#automatic-tags-17", | ||
"https://maas.io/docs/how-to-customise-maas-networks#p-9070-manage-network-discovery", | ||
rackController: | ||
"https://maas.io/docs/about-controllers#p-13954-rack-controllers", | ||
sshKeys: "https://maas.io/docs/how-to-manage-user-access#p-9090-add-ssh-keys", | ||
tagsAutomatic: | ||
"https://maas.io/docs/about-device-labels#p-13973-automatic-tags", | ||
tagsKernelOptions: | ||
"https://maas.io/docs/how-to-manage-tags#update-tag-kernel-options-22", | ||
tagsXpathExpressions: | ||
"https://maas.io/docs/how-to-manage-tags#automatic-tags-17", | ||
"https://maas.io/docs/how-to-provision-machines#p-9078-set-boot-options", | ||
tagsXpathExpressions: "https://www.w3schools.com/xml/XPath_intro.asp", | ||
vaultIntegration: "https://maas.io/docs/how-to-integrate-vault", | ||
windowsImages: "https://maas.io/docs/how-to-build-a-windows-image", | ||
windowsImages: | ||
"https://maas.io/docs/how-to-build-maas-images#p-17423-building-windows-images-with-packer", | ||
} as const; | ||
|
||
export default docsUrls; |
This file contains 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,24 @@ | ||
import { test, expect } from "@playwright/test"; | ||
import docsUrls from "../src/app/base/docsUrls"; | ||
|
||
const urls = Object.values(docsUrls); | ||
|
||
test.describe("loads the page", () => { | ||
urls.forEach((url) => { | ||
test(`${url}`, async () => { | ||
const docsPage = fetch(url); | ||
const resCode = await docsPage.then((res) => res.status); | ||
expect(resCode).toBe(200); | ||
}); | ||
}); | ||
}); | ||
|
||
test.describe("is a direct link", () => { | ||
urls.forEach((url) => { | ||
test(`${url}`, async () => { | ||
const docsPage = fetch(url, { redirect: "manual" }); | ||
const resCode = await docsPage.then((res) => res.status); | ||
expect(resCode).toBe(200); | ||
}); | ||
}); | ||
}); |