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

Add dark mode and mobile view snapshots #154

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

786 changes: 786 additions & 0 deletions .yarn/releases/yarn-3.2.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
yarnPath: .yarn/releases/yarn-3.2.1.cjs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@
"printWidth": 80,
"tabWidth": 2
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].1"
}
47 changes: 37 additions & 10 deletions website/snapshots.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
const urls = [
{ name: 'URL Spec', path: '/examples/using-remote-url/' },
{
name: 'YAML Spec',
path: '/examples/using-single-yaml/',
},
{ name: 'URL Spec', path: '/examples/using-remote-url/' },
{ name: 'Schema Imports', path: '/docs/guides/schema-imports' },
];

module.exports = () => {
const baseUrl = process.env.TARGET_URL || 'http://localhost:3000';
return urls.map(({ name, path }) => {
return {
name,
url: `${baseUrl}${path}`,
};
});
};
const baseUrl = process.env.TARGET_URL || 'http://localhost:3000';

const snapshots = urls.map(({ name, path }) => {
return {
name,
url: `${baseUrl}${path}`,
waitForTimeout: 400,
execute: {
afterNavigation() {
// Switch to light mode if currently dark mode
document
.querySelector(
'[title^="Switch between dark and light mode (currently dark mode)"]',
)
// @ts-ignore
?.click();
},
},
additionalSnapshots: [
{
suffix: ' (Dark Mode)',
execute() {
// Switch to dark mode if currently light mode
document
.querySelector(
'[title^="Switch between dark and light mode (currently light mode)"]',
)
// @ts-ignore
?.click();
},
},
],
};
});

module.exports = snapshots;
Loading