Skip to content

Commit 7a2efd7

Browse files
authored
Merge pull request #82 from microsoft/feature/revamp-skills-site
feat: Skills Explorer Website
2 parents 2d9bd03 + d99e706 commit 7a2efd7

40 files changed

Lines changed: 10608 additions & 2105 deletions

docs-site/.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# build output
2+
dist/
3+
4+
# generated types
5+
.astro/
6+
7+
# generated data (built from source)
8+
src/data/skills.json
9+
10+
# dependencies
11+
node_modules/
12+
13+
# playwright test artifacts
14+
playwright-report/
15+
test-results/
16+
17+
# logs
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
21+
pnpm-debug.log*
22+
23+
24+
# environment variables
25+
.env
26+
.env.production
27+
28+
# macOS-specific files
29+
.DS_Store
30+
31+
# jetbrains setting folder
32+
.idea/

docs-site/.vscode/extensions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"recommendations": ["astro-build.astro-vscode"],
3+
"unwantedRecommendations": []
4+
}

docs-site/.vscode/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"command": "./node_modules/.bin/astro dev",
6+
"name": "Development server",
7+
"request": "launch",
8+
"type": "node-terminal"
9+
}
10+
]
11+
}

docs-site/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Astro Starter Kit: Minimal
2+
3+
```sh
4+
npm create astro@latest -- --template minimal
5+
```
6+
7+
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
8+
9+
## 🚀 Project Structure
10+
11+
Inside of your Astro project, you'll see the following folders and files:
12+
13+
```text
14+
/
15+
├── public/
16+
├── src/
17+
│ └── pages/
18+
│ └── index.astro
19+
└── package.json
20+
```
21+
22+
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
23+
24+
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
25+
26+
Any static assets, like images, can be placed in the `public/` directory.
27+
28+
## 🧞 Commands
29+
30+
All commands are run from the root of the project, from a terminal:
31+
32+
| Command | Action |
33+
| :------------------------ | :----------------------------------------------- |
34+
| `npm install` | Installs dependencies |
35+
| `npm run dev` | Starts local dev server at `localhost:4321` |
36+
| `npm run build` | Build your production site to `./dist/` |
37+
| `npm run preview` | Preview your build locally, before deploying |
38+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
39+
| `npm run astro -- --help` | Get help using the Astro CLI |
40+
41+
## 👀 Want to learn more?
42+
43+
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).

docs-site/astro.config.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// @ts-check
2+
import { defineConfig } from 'astro/config';
3+
import react from '@astrojs/react';
4+
5+
// https://astro.build/config
6+
export default defineConfig({
7+
integrations: [react()],
8+
outDir: '../docs',
9+
base: '/skills/',
10+
build: {
11+
assets: '_astro'
12+
}
13+
});
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import { test, expect } from '@playwright/test';
2+
import AxeBuilder from '@axe-core/playwright';
3+
4+
test.describe('Accessibility', () => {
5+
test('homepage should have no WCAG AA violations', async ({ page }) => {
6+
await page.goto('./');
7+
8+
await page.waitForSelector('.skills-grid a');
9+
10+
const accessibilityScanResults = await new AxeBuilder({ page })
11+
.withTags(['wcag2a', 'wcag2aa'])
12+
.analyze();
13+
14+
if (accessibilityScanResults.violations.length > 0) {
15+
console.log('Accessibility violations:', JSON.stringify(accessibilityScanResults.violations, null, 2));
16+
}
17+
18+
expect(accessibilityScanResults.violations).toEqual([]);
19+
});
20+
21+
test('skip-to-content link works', async ({ page }) => {
22+
await page.goto('./');
23+
24+
await page.keyboard.press('Tab');
25+
26+
const skipLink = page.locator('a[href="#main-content"], .skip-link');
27+
28+
if (await skipLink.isVisible()) {
29+
await skipLink.click();
30+
31+
const mainContent = page.locator('#main-content, main');
32+
await expect(mainContent).toBeVisible();
33+
}
34+
});
35+
36+
test('all images have alt text', async ({ page }) => {
37+
await page.goto('./');
38+
39+
const images = page.locator('img');
40+
const imageCount = await images.count();
41+
42+
for (let i = 0; i < imageCount; i++) {
43+
const img = images.nth(i);
44+
const alt = await img.getAttribute('alt');
45+
const role = await img.getAttribute('role');
46+
47+
const hasAccessibleLabel = alt !== null || role === 'presentation' || role === 'none';
48+
expect(hasAccessibleLabel).toBeTruthy();
49+
}
50+
});
51+
52+
test('interactive elements are keyboard accessible', async ({ page }) => {
53+
await page.goto('./');
54+
55+
for (let i = 0; i < 10; i++) {
56+
await page.keyboard.press('Tab');
57+
58+
const focusedElement = page.locator(':focus');
59+
const isVisible = await focusedElement.isVisible().catch(() => false);
60+
61+
if (isVisible) {
62+
const tagName = await focusedElement.evaluate(el => el.tagName.toLowerCase());
63+
const role = await focusedElement.getAttribute('role');
64+
const tabIndex = await focusedElement.getAttribute('tabindex');
65+
66+
const isInteractive = ['a', 'button', 'input', 'select', 'textarea'].includes(tagName) ||
67+
['button', 'link', 'tab', 'menuitem'].includes(role || '') ||
68+
tabIndex === '0';
69+
70+
expect(isInteractive).toBeTruthy();
71+
}
72+
}
73+
});
74+
75+
test('color contrast meets WCAG AA standards', async ({ page }) => {
76+
await page.goto('./');
77+
78+
const accessibilityScanResults = await new AxeBuilder({ page })
79+
.withTags(['wcag2aa'])
80+
.options({ rules: { 'color-contrast': { enabled: true } } })
81+
.analyze();
82+
83+
const contrastViolations = accessibilityScanResults.violations.filter(
84+
v => v.id === 'color-contrast'
85+
);
86+
87+
expect(contrastViolations).toEqual([]);
88+
});
89+
90+
test('focus indicators are visible', async ({ page }) => {
91+
await page.goto('./');
92+
93+
await page.keyboard.press('Tab');
94+
95+
const focusedElement = page.locator(':focus');
96+
97+
if (await focusedElement.isVisible()) {
98+
const outline = await focusedElement.evaluate(el => {
99+
const styles = window.getComputedStyle(el);
100+
return {
101+
outlineStyle: styles.outlineStyle,
102+
outlineWidth: styles.outlineWidth,
103+
boxShadow: styles.boxShadow,
104+
};
105+
});
106+
107+
const hasFocusIndicator =
108+
(outline.outlineStyle !== 'none' && outline.outlineWidth !== '0px') ||
109+
outline.boxShadow !== 'none';
110+
111+
expect(hasFocusIndicator).toBeTruthy();
112+
}
113+
});
114+
115+
test('command palette is keyboard navigable', async ({ page }) => {
116+
await page.goto('./');
117+
await page.waitForLoadState('networkidle');
118+
119+
await page.keyboard.press('Control+k');
120+
121+
const searchInput = page.locator('[cmdk-input]');
122+
await searchInput.waitFor({ state: 'visible', timeout: 10000 });
123+
await expect(searchInput).toBeVisible();
124+
125+
await page.keyboard.type('azure');
126+
await page.waitForTimeout(200);
127+
128+
await page.keyboard.press('ArrowDown');
129+
130+
const results = page.locator('[cmdk-item]');
131+
if (await results.count() > 0) {
132+
const selectedItem = page.locator('[cmdk-item][aria-selected="true"]');
133+
const count = await selectedItem.count();
134+
expect(count).toBeGreaterThanOrEqual(0);
135+
}
136+
137+
await page.keyboard.press('Escape');
138+
await expect(searchInput).not.toBeVisible();
139+
});
140+
});

docs-site/e2e/copy.spec.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Copy to Clipboard', () => {
4+
test.beforeEach(async ({ page, context }) => {
5+
await context.grantPermissions(['clipboard-read', 'clipboard-write']);
6+
await page.goto('./');
7+
await page.waitForLoadState('networkidle');
8+
});
9+
10+
test('copy button is visible on skill cards', async ({ page }) => {
11+
const skillCard = page.locator('.skills-grid a').first();
12+
await skillCard.waitFor({ state: 'visible', timeout: 10000 });
13+
14+
await skillCard.hover();
15+
16+
const copyButton = skillCard.locator('button:has-text("Copy")');
17+
await expect(copyButton).toBeVisible();
18+
});
19+
20+
test('clicking copy button shows success feedback', async ({ page }) => {
21+
const skillCard = page.locator('.skills-grid a').first();
22+
await skillCard.waitFor({ state: 'visible', timeout: 10000 });
23+
await skillCard.hover();
24+
25+
const copyButton = skillCard.locator('button:has-text("Copy")');
26+
await expect(copyButton).toBeVisible();
27+
await copyButton.click();
28+
29+
const copiedButton = skillCard.locator('button:has-text("Copied!")');
30+
await expect(copiedButton).toBeVisible({ timeout: 3000 });
31+
});
32+
33+
test('copy button copies correct install command', async ({ page }) => {
34+
const skillCard = page.locator('.skills-grid a').first();
35+
await skillCard.waitFor({ state: 'visible', timeout: 10000 });
36+
await skillCard.hover();
37+
38+
const copyButton = skillCard.locator('button:has-text("Copy")');
39+
await expect(copyButton).toBeVisible();
40+
await copyButton.click();
41+
42+
const clipboardText = await page.evaluate(() => navigator.clipboard.readText());
43+
44+
expect(clipboardText).toMatch(/npx skills add microsoft\/skills --skill/);
45+
});
46+
});

0 commit comments

Comments
 (0)