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

feat: vue starter app #21

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 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
33 changes: 33 additions & 0 deletions starter-apps/vue/vue-template/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-prettier/skip-formatting'
],
overrides: [
{
files: [
'e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'
],
'extends': [
'plugin:playwright/recommended'
]
}
],
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
// Slots used in GCDS Components (web components) are valid usage
// source: https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots
'vue/no-deprecated-slot-attribute': 'off',
'vue/multi-word-component-names': ['error', {
// TODO: Remove About1 from the list if it is no longer needed
'ignores': ['Header', 'Footer', 'Container', 'Heading', 'Text', 'Button', 'Input', 'About1']
}]
}
}
33 changes: 33 additions & 0 deletions starter-apps/vue/vue-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo

test-results/
playwright-report/
8 changes: 8 additions & 0 deletions starter-apps/vue/vue-template/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
8 changes: 8 additions & 0 deletions starter-apps/vue/vue-template/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"Vue.volar",
"ms-playwright.playwright",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
56 changes: 56 additions & 0 deletions starter-apps/vue/vue-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# vue-starter-app

This template should help get you started developing with Vue 3 in Vite using GCDS Components from [@cdssnc/gcds-components-vue](https://www.npmjs.com/package/@cdssnc/gcds-components-vue).

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Compile and Minify for Production

```sh
npm run build
```

### Run Unit Tests with [Vitest](https://vitest.dev/)

```sh
npm run test:unit
```

### Run End-to-End Tests with [Playwright](https://playwright.dev)

```sh
# Install browsers for the first run
npx playwright install

# When testing on CI, must build the project first
npm run build

# Runs the end-to-end tests
npm run test:e2e
# Runs the tests only on Chromium
npm run test:e2e -- --project=chromium
# Runs the tests of a specific file
npm run test:e2e -- tests/example.spec.ts
# Runs the tests in debug mode
npm run test:e2e -- --debug
```

### Lint with [ESLint](https://eslint.org/)

```sh
npm run lint
```
17 changes: 17 additions & 0 deletions starter-apps/vue/vue-template/e2e/aboutPageBreadcrumbs.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { expect, test } from '@playwright/test'
import { en } from '@/i18n/en.js'
import { fr } from '@/i18n/fr.js'

test('shows about1 page breadcrumbs', async ({ page }) => {
await page.goto('/en/about/about1')

await expect(
page.locator('gcds-breadcrumbs').locator('router-link gcds-breadcrumbs-item')
).toHaveText([en.home, en.about, en.about1])

await page.click('text=Français')

await expect(
page.locator('gcds-breadcrumbs').locator('router-link gcds-breadcrumbs-item')
).toHaveText([fr.home, fr.about, fr.about1])
})
24 changes: 24 additions & 0 deletions starter-apps/vue/vue-template/e2e/app.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { expect, test } from '@playwright/test'
import { en } from '../src/i18n/en.js'
import { fr } from '../src/i18n/fr.js'

// See here how to get started:
// https://playwright.dev/docs/intro
test('visits the app root url', async ({ page }) => {
await page.goto('/')
await expect(page.locator('gcds-heading')).toHaveText(en.homePage.heading)

await expect(page.locator('gcds-text').first()).toHaveText(en.homePage.paragraph)
})

test('switches to french', async ({ page }) => {
await page.goto('/')
await page.click('text=Français')
await expect(page.locator('gcds-heading')).toHaveText(fr.homePage.heading)
})

test('switches to english', async ({ page }) => {
await page.goto('/fr')
await page.click('text=English')
await expect(page.locator('gcds-heading')).toHaveText(en.homePage.heading)
})
15 changes: 15 additions & 0 deletions starter-apps/vue/vue-template/e2e/reportABug/reportABug.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { expect, test } from '@playwright/test'
import { en } from '@/i18n/en.js'
import { fr } from '@/i18n/fr.js'

test('visit bug report page', async ({ page }) => {
await page.goto('/en/report-a-bug')
await expect(page.locator('gcds-heading')).toHaveText(en.reportABugPage.heading)
await expect(page.locator('gcds-text').first()).toHaveText(en.reportABugPage.intro)
})

test('switches to french', async ({ page }) => {
await page.goto('/en/report-a-bug')
await page.click('text=Français')
await expect(page.locator('gcds-heading')).toHaveText(fr.reportABugPage.heading)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { expect, test } from '@playwright/test'

test('report bug form missing fields', async ({ page }) => {
await page.goto('/en/report-a-bug')
await page.click('text=Submit')
await expect(page.locator('gcds-error-message').first()).toHaveText(
'Enter information to continue.'
)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect, test } from '@playwright/test'
import { en } from '@/i18n/en.js'

test('report bug form', async ({ page }) => {
await page.goto('/en/report-a-bug')
await page.getByLabel('GC Design System Components Package and Version').fill('1.0.0')
await page.getByLabel('Title').fill('title')
await page.getByLabel('Current Behavior').fill('current behavior')
await page.getByLabel('Expected Behavior').fill('expected behavior')
await page.getByLabel('Steps to Reproduce').fill('steps to reproduce')
await page.getByLabel('Code Reproduction URL').fill('code reproduction url')
await page.getByLabel('System Info').fill('system info')
await page.getByLabel('Additional Information').fill('additional information')
await page.click('text=Submit')
await expect(page.locator('gcds-heading').locator('nth=0')).toHaveText(en.reportABugPage.heading)
await expect(page.locator('gcds-heading').locator('nth=1')).toHaveText(
en.reportABugPage.form.confirmation
)
})
26 changes: 26 additions & 0 deletions starter-apps/vue/vue-template/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="/favicon.ico" rel="icon">
<meta content="width=device-width, initial-scale=1.0" name="viewport">

<!-- GCDS required assets -->
<link href="https://fonts.googleapis.com" rel="preconnect" />
<link crossorigin href="https://fonts.gstatic.com" rel="preconnect" />
<link
href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap"
rel="stylesheet"
/>
daine marked this conversation as resolved.
Show resolved Hide resolved

<!-- GC Design System Utility -->
<link href="https://cdn.design-system.alpha.canada.ca/@cdssnc/gcds-utility@latest/dist/gcds-utility.min.css" rel="stylesheet">

<!-- TODO: Change the title -->
<title>GC Design System Starter Template</title>
</head>
<body>
<div id="app"></div>
<script src="/src/main.js" type="module"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions starter-apps/vue/vue-template/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
Loading
Loading