chore: move tooling to vue-cli v3.0.0-rc.2

This commit is contained in:
xidedix
2018-06-15 19:53:13 +02:00
parent 58fd280d51
commit 9e31783d91
58 changed files with 197 additions and 1093 deletions
@@ -0,0 +1,19 @@
// A custom Nightwatch assertion.
// The assertion name is the filename.
// Example usage:
//
// browser.assert.elementCount(selector, count)
//
// For more information on custom assertions see:
// http://nightwatchjs.org/guide#writing-custom-assertions
exports.assertion = function elementCount (selector, count) {
this.message = `Testing if element <${selector}> has count: ${count}`
this.expected = count
this.pass = val => val === count
this.value = res => res.value
function evaluator (_selector) {
return document.querySelectorAll(_selector).length
}
this.command = cb => this.api.execute(evaluator, [selector], cb)
}
+87
View File
@@ -0,0 +1,87 @@
// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage
module.exports = {
before: function (browser) {
console.log('Setting up... browser', typeof browser)
},
after: function (browser) {
console.log('Closing down... browser', typeof browser)
},
'CoreUI Vue e2e tests': function (browser) {
// automatically uses dev Server port from /config.index.js
// default: http://localhost:8080
// see nightwatch.conf.js
// const devServer = browser.globals.devServerURL
const devServer = process.env.VUE_DEV_SERVER_URL
browser.url(devServer).pause(500).expect.element('body').to.be.present
browser.waitForElementVisible('.app', 10000)
.assert.elementPresent('.app-header')
.assert.elementPresent('.app-header > .navbar-brand')
.assert.elementPresent('.app-body')
.assert.elementPresent('.app-body > .main > .breadcrumb')
.assert.elementPresent('.app-body > .main > .container-fluid > .animated')
.assert.elementPresent('.app-body > .sidebar > .sidebar-nav')
.assert.elementPresent('.app-body > .sidebar > .sidebar-minimizer')
.assert.elementPresent('.app-footer')
.assert.containsText('.app-footer > div > span', 'creativeLabs')
.assert.containsText('.app-footer > div.ml-auto > span', 'Powered by')
.assert.elementCount('button', 10)
.resizeWindow(1024, 800)
.pause(500)
browser.click('body > div > header > button.d-none.d-lg-block.navbar-toggler', function (response) {
console.log('response', typeof response)
this.assert.ok(browser === this, 'Check if the context is right.')
this.assert.cssClassPresent('body', 'aside-menu-show')
})
browser.pause(500)
browser.click('body > div > header > button.d-none.d-lg-block.navbar-toggler', function (response) {
console.log('response', typeof response)
this.assert.cssClassNotPresent('body', 'aside-menu-show')
})
browser.pause(500)
browser
.useXpath()
.click('/html/body/div/header/button[2]', function (response) {
console.log('response', typeof response)
this.assert.cssClassNotPresent('/html/body', 'sidebar-lg-show')
})
browser
.pause(500)
.click('/html/body/div/header/button[2]', function (response) {
console.log('response', typeof response)
this.assert.cssClassPresent('/html/body', 'sidebar-lg-show')
})
browser
.pause(500)
.click('/html/body/div/div/div/button', function (response) {
console.log('response', typeof response)
this.assert.cssClassPresent('/html/body', 'sidebar-minimized')
this.assert.cssClassPresent('/html/body', 'brand-minimized')
})
.pause(500)
.click('/html/body/div/div/div/button', function (response) {
console.log('response', typeof response)
this.assert.cssClassNotPresent('/html/body', 'sidebar-minimized')
this.assert.cssClassNotPresent('/html/body', 'brand-minimized')
})
browser
.pause(5000)
.end()
}
}
+8
View File
@@ -0,0 +1,8 @@
module.exports = {
env: {
jest: true
},
rules: {
'import/no-extraneous-dependencies': 'off'
}
}
+29
View File
@@ -0,0 +1,29 @@
import Vue from 'vue'
import { shallowMount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Dashboard from '@/views/Dashboard'
Vue.use(BootstrapVue)
describe('Dashboard.vue', () => {
it('has a created hook', () => {
expect(typeof Dashboard.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Dashboard.data).toMatch('function')
const defaultData = Dashboard.data()
expect(defaultData.selected).toMatch('Month')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Dashboard)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Dashboard', () => {
const wrapper = shallowMount(Dashboard)
expect(wrapper.is(Dashboard)).toBe(true)
})
// it('should render correct content', () => {
// const wrapper = shallowMount(Dashboard)
// expect(wrapper.find('h4 > #traffic').text()).toMatch('Traffic')
// })
})