mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-06 05:17:57 +00:00
Improve the web tests (#1430)
* Improve the web tests * That's not portable * Use regex here * Set concurrency on web CI
This commit is contained in:
parent
bd5b7c87fa
commit
aacf2289de
5
.github/workflows/web.yml
vendored
5
.github/workflows/web.yml
vendored
@ -1,11 +1,12 @@
|
|||||||
name: Web CI
|
name: Web CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -31,7 +31,7 @@ export default function Docs({ docs, braces, assign }: DocsProps) {
|
|||||||
>
|
>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<div className="px-2 py-3">
|
<div className="px-2 py-3">
|
||||||
<Link href={`#${doc.name}`}>
|
<Link href={`#${doc.name}`} data-anchor-name={doc.name}>
|
||||||
<LinkIcon size={20} />
|
<LinkIcon size={20} />
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,8 +56,8 @@ export default function Header({
|
|||||||
<div className="border-b-1 backdrop-blur-lg bg-white dark:bg-black bg-opacity-20 dark:bg-opacity-20 transition">
|
<div className="border-b-1 backdrop-blur-lg bg-white dark:bg-black bg-opacity-20 dark:bg-opacity-20 transition">
|
||||||
<header className="max-w-3xl mx-auto m-0 p-1 grow flex w-full">
|
<header className="max-w-3xl mx-auto m-0 p-1 grow flex w-full">
|
||||||
<h1 className="px-2 text-3xl dark:text-white self-end">
|
<h1 className="px-2 text-3xl dark:text-white self-end">
|
||||||
<Link href="/">
|
<Link href="/" className="font-bold" data-cy="top-link">
|
||||||
<strong>{name}</strong>
|
{name}
|
||||||
</Link>
|
</Link>
|
||||||
</h1>
|
</h1>
|
||||||
{router.asPath != '/' && (
|
{router.asPath != '/' && (
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
const { defineConfig } = require('cypress');
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
|
const { defineConfig } = require('cypress')
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
|
scrollBehavior: 'center',
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: 'http://localhost:3000',
|
baseUrl: 'http://localhost:3000',
|
||||||
supportFile: false,
|
supportFile: false,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
7
web/cypress/.eslintrc.json
Normal file
7
web/cypress/.eslintrc.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": ["eslint:recommended", "plugin:cypress/recommended", "prettier"],
|
||||||
|
"plugins": ["cypress"],
|
||||||
|
"settings": {
|
||||||
|
"sort-imports": "error"
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ describe('check index renders', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('displays the title text', () => {
|
it('displays the title text', () => {
|
||||||
cy.get('h1').contains('Conky')
|
cy.get('[data-cy="top-link"]').contains(/^Conky$/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('check config settings', () => {
|
describe('check config settings', () => {
|
||||||
@ -13,7 +13,8 @@ describe('check config settings', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('displays the title text', () => {
|
it('displays the title text', () => {
|
||||||
cy.get('h1').contains('Configuration settings')
|
cy.get('[data-cy="top-link"]').contains(/^Conky$/)
|
||||||
|
cy.get('[data-cy="page-heading"]').contains(/^Configuration settings$/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('check variables', () => {
|
describe('check variables', () => {
|
||||||
@ -22,7 +23,11 @@ describe('check variables', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('displays the title text', () => {
|
it('displays the title text', () => {
|
||||||
cy.get('h1').contains('Variables')
|
cy.get('[data-cy="top-link"]').contains(/^Conky$/)
|
||||||
|
cy.get('[data-cy="page-heading"]').contains(/^Variables$/)
|
||||||
|
})
|
||||||
|
it('has anchor links and can focus on them', () => {
|
||||||
|
cy.get('[data-anchor-name="cpu"]').click().and('be.visible')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('check lua', () => {
|
describe('check lua', () => {
|
||||||
@ -31,6 +36,7 @@ describe('check lua', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('displays the title text', () => {
|
it('displays the title text', () => {
|
||||||
cy.get('h1').contains('Lua API')
|
cy.get('[data-cy="top-link"]').contains(/^Conky$/)
|
||||||
|
cy.get('[data-cy="page-heading"]').contains(/^Lua API$/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
22
web/package-lock.json
generated
22
web/package-lock.json
generated
@ -38,6 +38,7 @@
|
|||||||
"eslint": "^8.34.0",
|
"eslint": "^8.34.0",
|
||||||
"eslint-config-next": "^13.2.1",
|
"eslint-config-next": "^13.2.1",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
|
"eslint-plugin-cypress": "^2.12.1",
|
||||||
"eslint-plugin-mdx": "^2.0.5",
|
"eslint-plugin-mdx": "^2.0.5",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"netlify-plugin-cypress": "^2.2.1",
|
"netlify-plugin-cypress": "^2.2.1",
|
||||||
@ -5105,6 +5106,27 @@
|
|||||||
"ms": "^2.1.1"
|
"ms": "^2.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eslint-plugin-cypress": {
|
||||||
|
"version": "2.12.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.12.1.tgz",
|
||||||
|
"integrity": "sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"globals": "^11.12.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": ">= 3.2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/eslint-plugin-cypress/node_modules/globals": {
|
||||||
|
"version": "11.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
|
||||||
|
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/eslint-plugin-import": {
|
"node_modules/eslint-plugin-import": {
|
||||||
"version": "2.27.5",
|
"version": "2.27.5",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"eslint": "^8.34.0",
|
"eslint": "^8.34.0",
|
||||||
"eslint-config-next": "^13.2.1",
|
"eslint-config-next": "^13.2.1",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
|
"eslint-plugin-cypress": "^2.12.1",
|
||||||
"eslint-plugin-mdx": "^2.0.5",
|
"eslint-plugin-mdx": "^2.0.5",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"netlify-plugin-cypress": "^2.2.1",
|
"netlify-plugin-cypress": "^2.2.1",
|
||||||
|
@ -22,7 +22,9 @@ export default function ConfigSettings(props: ConfigSettingsProps) {
|
|||||||
/>
|
/>
|
||||||
<main className="w-full">
|
<main className="w-full">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl">Configuration settings</h1>
|
<h1 className="text-2xl" data-cy="page-heading">
|
||||||
|
Configuration settings
|
||||||
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<Docs docs={props.config_settings} braces={false} assign={true} />
|
<Docs docs={props.config_settings} braces={false} assign={true} />
|
||||||
</main>
|
</main>
|
||||||
|
@ -15,7 +15,9 @@ export default function Lua(props: LuaProps) {
|
|||||||
<SEO title="Conky – Lua API" description="Conky Lua API documentation" />
|
<SEO title="Conky – Lua API" description="Conky Lua API documentation" />
|
||||||
<main className="w-full">
|
<main className="w-full">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl">Lua API</h1>
|
<h1 className="text-2xl" data-cy="page-heading">
|
||||||
|
Lua API
|
||||||
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<Docs docs={props.lua} braces={false} assign={false} />
|
<Docs docs={props.lua} braces={false} assign={false} />
|
||||||
</main>
|
</main>
|
||||||
|
@ -17,9 +17,9 @@ export default function Variables(props: VariablesProps) {
|
|||||||
description="Conky object variables documentation"
|
description="Conky object variables documentation"
|
||||||
/>
|
/>
|
||||||
<main className="w-full">
|
<main className="w-full">
|
||||||
<div>
|
<h1 className="text-2xl" data-cy="page-heading">
|
||||||
<h1 className="text-2xl">Variables</h1>
|
Variables
|
||||||
</div>
|
</h1>
|
||||||
<Docs docs={props.variables} braces={true} assign={false} />
|
<Docs docs={props.variables} braces={true} assign={false} />
|
||||||
</main>
|
</main>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
Loading…
Reference in New Issue
Block a user