Skip to content
This repository was archived by the owner on Oct 13, 2022. It is now read-only.

vue-cli-2 app + quasar UI with Cypress 10 #87

Draft
wants to merge 11 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
23 changes: 23 additions & 0 deletions vue-cli-2-quasar-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
24 changes: 24 additions & 0 deletions vue-cli-2-quasar-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Component Testing Example: vue-cli-quasar-ui

## Project setup
```
yarn install
```

### Compiles and hot-reloads for development
```
yarn serve
```

### Compiles and minifies for production
```
yarn build
```

### Lints and fixes files
```
yarn lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions vue-cli-2-quasar-ui/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
11 changes: 11 additions & 0 deletions vue-cli-2-quasar-ui/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { defineConfig } = require("cypress");
const { devServer } = require("@cypress/webpack-dev-server");
const webpackConfig = require("@vue/cli-service/webpack.config");

module.exports = defineConfig({
component: {
devServer,
devServerConfig: { webpackConfig },
specPattern: "src/**/*.cy.{js,jsx,ts,tsx}",
},
});
15 changes: 15 additions & 0 deletions vue-cli-2-quasar-ui/cypress/support/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { mount } from "@cypress/vue";
import { Quasar } from "quasar";
import quasarUserOptions from "../../src/quasar-user-options";

Cypress.Commands.add("mount", (component, options = {}) => {
options.global = options.global || {};
options.global.plugins = options.global.plugins || [];
return mount(component, {
...options,
global: {
...options.global,
plugins: [[Quasar, quasarUserOptions], ...options.global.plugins],
},
});
});
53 changes: 53 additions & 0 deletions vue-cli-2-quasar-ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "vue-cli-quasar-ui",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@quasar/extras": "^1.0.0",
"core-js": "^3.6.5",
"cypress": "https://cdn.cypress.io/beta/npm/10.0.0/linux-x64/10.0-release-188b9a742ee2ef51102167bfd84b3696a3f72a26/cypress.tgz",
"quasar": "^2.0.0",
"vue": "^3.0.0"
},
"devDependencies": {
"@cypress/vue": "^3.1.1",
"@cypress/webpack-dev-server": "^1.8.1",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-vue": "^7.0.0",
"html-webpack-plugin": "4",
"sass": "1.32.12",
"sass-loader": "^10.1.0",
"vue-cli-plugin-quasar": "~4.0.4"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"plugin:cypress/recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
Binary file added vue-cli-2-quasar-ui/public/favicon.ico
Binary file not shown.
17 changes: 17 additions & 0 deletions vue-cli-2-quasar-ui/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
104 changes: 104 additions & 0 deletions vue-cli-2-quasar-ui/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<template>
<q-layout view="lHh Lpr lFf">
<q-header elevated class="glossy">
<q-toolbar>
<q-btn
flat
dense
round
@click="leftDrawerOpen = !leftDrawerOpen"
aria-label="Menu"
icon="menu"
/>

<q-toolbar-title>
Quasar App
</q-toolbar-title>

<div>Quasar v{{ $q.version }}</div>
</q-toolbar>
</q-header>

<q-drawer
v-model="leftDrawerOpen"
show-if-above
bordered
class="bg-grey-2"
>
<q-list>
<q-item-label header>Essential Links</q-item-label>
<q-item clickable tag="a" target="_blank" href="https://quasar.dev">
<q-item-section avatar>
<q-icon name="school" />
</q-item-section>
<q-item-section>
<q-item-label>Docs</q-item-label>
<q-item-label caption>quasar.dev</q-item-label>
</q-item-section>
</q-item>
<q-item clickable tag="a" target="_blank" href="https://github.com/quasarframework/">
<q-item-section avatar>
<q-icon name="code" />
</q-item-section>
<q-item-section>
<q-item-label>Github</q-item-label>
<q-item-label caption>github.com/quasarframework</q-item-label>
</q-item-section>
</q-item>
<q-item clickable tag="a" target="_blank" href="https://chat.quasar.dev">
<q-item-section avatar>
<q-icon name="chat" />
</q-item-section>
<q-item-section>
<q-item-label>Discord Chat Channel</q-item-label>
<q-item-label caption>chat.quasar.dev</q-item-label>
</q-item-section>
</q-item>
<q-item clickable tag="a" target="_blank" href="https://forum.quasar.dev">
<q-item-section avatar>
<q-icon name="forum" />
</q-item-section>
<q-item-section>
<q-item-label>Forum</q-item-label>
<q-item-label caption>forum.quasar.dev</q-item-label>
</q-item-section>
</q-item>
<q-item clickable tag="a" target="_blank" href="https://twitter.com/quasarframework">
<q-item-section avatar>
<q-icon name="rss_feed" />
</q-item-section>
<q-item-section>
<q-item-label>Twitter</q-item-label>
<q-item-label caption>@quasarframework</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-drawer>

<q-page-container>
<Card />
<HelloWorld />
</q-page-container>
</q-layout>
</template>

<script>
import { ref } from 'vue'
import HelloWorld from './components/HelloWorld.vue'
import Card from './components/Card.vue'

export default {
name: 'LayoutDefault',

components: {
Card,
HelloWorld
},

setup () {
return {
leftDrawerOpen: ref(false)
}
}
}
</script>
Binary file added vue-cli-2-quasar-ui/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions vue-cli-2-quasar-ui/src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions vue-cli-2-quasar-ui/src/components/Card.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Card from "./Card.vue";

it("renders the Card component", () => {
cy.mount(Card);

cy.contains("Our Changing Planet");
});
104 changes: 104 additions & 0 deletions vue-cli-2-quasar-ui/src/components/Card.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<template>
<div class="q-pa-md row items-start q-gutter-md">
<q-card class="my-card bg-secondary text-white">
<q-card-section>
<div class="text-h6">Our Changing Planet</div>
<div class="text-subtitle2">by John Doe</div>
</q-card-section>

<q-card-section>
{{ lorem }}
</q-card-section>

<q-separator dark />

<q-card-actions>
<q-btn flat>Action 1</q-btn>
<q-btn flat>Action 2</q-btn>
</q-card-actions>
</q-card>

<q-card class="my-card">
<q-card-section>
<div class="text-h6">Our Changing Planet</div>
<div class="text-subtitle2">by John Doe</div>
</q-card-section>

<q-separator />

<q-card-actions vertical>
<q-btn flat>Action 1</q-btn>
<q-btn flat>Action 2</q-btn>
</q-card-actions>
</q-card>

<q-card class="my-card bg-purple text-white">
<q-card-section>
<div class="text-h6">Our Changing Planet</div>
<div class="text-subtitle2">by John Doe</div>
</q-card-section>

<q-card-actions>
<q-btn flat>Action 1</q-btn>
<q-btn flat>Action 2</q-btn>
</q-card-actions>
</q-card>

<q-card flat bordered class="my-card bg-grey-1">
<q-card-section>
<div class="row items-center no-wrap">
<div class="col">
<div class="text-h6">Our Planet</div>
<div class="text-subtitle2">by John Doe</div>
</div>

<div class="col-auto">
<q-btn color="grey-7" round flat icon="more_vert">
<q-menu cover auto-close>
<q-list>
<q-item clickable>
<q-item-section>Remove Card</q-item-section>
</q-item>
<q-item clickable>
<q-item-section>Send Feedback</q-item-section>
</q-item>
<q-item clickable>
<q-item-section>Share</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</div>
</div>
</q-card-section>

<q-card-section>
{{ lorem }}
</q-card-section>

<q-separator />

<q-card-actions>
<q-btn flat>Action 1</q-btn>
<q-btn flat>Action 2</q-btn>
</q-card-actions>
</q-card>
</div>
</template>

<script>
export default {
setup() {
return {
lorem:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
};
},
};
</script>

<style lang="sass" scoped>
.my-card
width: 100%
max-width: 250px
</style>
Loading