add some basic cypress test

This commit is contained in:
Kacper Donat 2019-12-09 20:58:59 +01:00
parent 4cb1d1ead7
commit 8cb1f9342c
10 changed files with 1350 additions and 39 deletions

5
cypress.json Normal file
View File

@ -0,0 +1,5 @@
{
"supportFile": "cypress/support/index.ts",
"fixturesFolder": false,
"baseUrl": "http://czydojade.localhost:8080"
}

View File

@ -0,0 +1,10 @@
describe("The Start Page", () => {
it("Sucessfully Loads", () => {
cy.visit('/dummy');
});
it("Allows to open favourites window", () => {
cy.get('#open_favourites_picker').click();
cy.get('#favourites_list').should('exist');
})
});

9
cypress/plugins/index.js Normal file
View File

@ -0,0 +1,9 @@
const wp = require('@cypress/webpack-preprocessor');
module.exports = (on) => {
const options = {
webpackOptions: require('../webpack.config'),
};
on('file:preprocessor', wp(options))
};

View File

@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

20
cypress/support/index.ts Normal file
View File

@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.ts using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')

14
cypress/tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"strict": true,
"baseUrl": "../node_modules",
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"],
"paths": {
"@app/*": ["../resources/ts/*"]
}
},
"include": ["**/*.ts"]
}

26
cypress/webpack.config.js Normal file
View File

@ -0,0 +1,26 @@
module.exports = {
mode: 'development',
// webpack will transpile TS and JS files
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
// every time webpack sees a TS file (except for node_modules)
// webpack will use "ts-loader" to transpile it to JavaScript
test: /\.ts$/,
exclude: [/node_modules/],
use: [
{
loader: 'ts-loader',
options: {
// skip typechecking for speed
transpileOnly: true,
}
}
]
}
]
}
};

View File

@ -34,13 +34,18 @@
"xpath": "^0.0.27"
},
"dependencies": {
"@cypress/webpack-preprocessor": "^4.1.1",
"babel-minify-webpack-plugin": "^0.3.1",
"copy-webpack-plugin": "^4.5.2",
"cypress": "^3.7.0",
"imagemin-webpack-plugin": "^2.3.0",
"mini-css-extract-plugin": "^0.4.2",
"vue2-leaflet": "^1.0.2",
"vuex": "^3.0.1",
"vuex-class": "^0.3.1",
"workbox-webpack-plugin": "^4.3.1"
},
"scripts": {
"cypress": "cypress open"
}
}

View File

@ -116,7 +116,7 @@
<fa :icon="['fal', 'search']" fixed-width class="mr-1"></fa>
Wybierz przystanki
</h2>
<button class="btn btn-action" @click="visibility.picker = 'favourites'">
<button class="btn btn-action" @click="visibility.picker = 'favourites'" id="open_favourites_picker">
<fa :icon="['fal', 'star']" fixed-witdth></fa>
</button>
</template>
@ -125,7 +125,7 @@
<fa :icon="['fal', 'star']" fixed-width class="mr-1"></fa>
Zapisane
</h2>
<button class="btn btn-action" @click="visibility.picker = 'search'">
<button class="btn btn-action" @click="visibility.picker = 'search'" id="open_stop_search">
<fa :icon="['fal', 'search']" fixed-witdth></fa>
</button>
</template>
@ -133,8 +133,8 @@
<div class="transition-box">
<transition name="fade">
<keep-alive>
<stop-finder @select="add" :blacklist="stops" v-if="visibility.picker === 'search'"></stop-finder>
<favourites v-else-if="visibility.picker === 'favourites'"></favourites>
<stop-finder @select="add" :blacklist="stops" v-if="visibility.picker === 'search'" id="stop_search"></stop-finder>
<favourites v-else-if="visibility.picker === 'favourites'" id="favourites_list"></favourites>
</keep-alive>
</transition>
</div>

1267
yarn.lock

File diff suppressed because it is too large Load Diff