Add feature image grid
This commit is contained in:
15
tests/e2e/specs/image_grid.js
Normal file
15
tests/e2e/specs/image_grid.js
Normal file
@ -0,0 +1,15 @@
|
||||
// For authoring Nightwatch tests, see
|
||||
// https://nightwatchjs.org/guide
|
||||
|
||||
module.exports = {
|
||||
beforeEach: (browser) => browser.init(),
|
||||
|
||||
'Image grid is present': (browser) => {
|
||||
browser
|
||||
.waitForElementVisible('#app')
|
||||
.assert.elementCount('.image-grid-container', 1)
|
||||
.assert.elementCount('figure img', 10)
|
||||
.assert.elementCount('figure figcaption', 10)
|
||||
.end()
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////
|
||||
// For authoring Nightwatch tests, see
|
||||
// https://nightwatchjs.org/guide
|
||||
//
|
||||
// For more information on working with page objects see:
|
||||
// https://nightwatchjs.org/guide/working-with-page-objects/
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
module.exports = {
|
||||
beforeEach: (browser) => browser.init(),
|
||||
|
||||
'e2e tests using page objects': (browser) => {
|
||||
const homepage = browser.page.homepage()
|
||||
homepage.waitForElementVisible('@appContainer')
|
||||
|
||||
const app = homepage.section.app
|
||||
app.assert.elementCount('@logo', 1)
|
||||
app.expect.section('@welcome').to.be.visible
|
||||
app.expect
|
||||
.section('@headline')
|
||||
.text.to.match(/^Welcome to Your Vue\.js (.*)App$/)
|
||||
|
||||
browser.end()
|
||||
},
|
||||
|
||||
'verify if string "e2e-nightwatch" is within the cli plugin links': (
|
||||
browser
|
||||
) => {
|
||||
const homepage = browser.page.homepage()
|
||||
const welcomeSection = homepage.section.app.section.welcome
|
||||
|
||||
welcomeSection.expect
|
||||
.element('@cliPluginLinks')
|
||||
.text.to.contain('e2e-nightwatch')
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
// For authoring Nightwatch tests, see
|
||||
// https://nightwatchjs.org/guide
|
||||
|
||||
module.exports = {
|
||||
'default e2e tests': (browser) => {
|
||||
browser
|
||||
.init()
|
||||
.waitForElementVisible('#app')
|
||||
.assert.elementPresent('.hello')
|
||||
.assert.containsText('h1', 'Welcome to Your Vue.js App')
|
||||
.assert.elementCount('img', 1)
|
||||
.end()
|
||||
},
|
||||
|
||||
'example e2e test using a custom command': (browser) => {
|
||||
browser
|
||||
.openHomepage()
|
||||
.assert.elementPresent('.hello')
|
||||
.end()
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import HelloWorld from '@/components/HelloWorld.vue'
|
||||
|
||||
describe('HelloWorld.vue', () => {
|
||||
it('renders props.msg when passed', () => {
|
||||
const msg = 'new message'
|
||||
const wrapper = shallowMount(HelloWorld, {
|
||||
propsData: { msg }
|
||||
})
|
||||
expect(wrapper.text()).toMatch(msg)
|
||||
})
|
||||
})
|
12
tests/unit/image_grid.spec.js
Normal file
12
tests/unit/image_grid.spec.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import ImageGrid from '@/components/ImageGrid.vue'
|
||||
|
||||
describe('ImageGrid.vue', () => {
|
||||
it('toggles loading', () => {
|
||||
const wrapper = mount(ImageGrid)
|
||||
expect(wrapper.vm.loading).toBe(true)
|
||||
expect(wrapper.text()).toContain('Loading...')
|
||||
wrapper.setData({ loading: false })
|
||||
expect(wrapper.vm.loading).toBe(false)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user