在VUE组件测试中附加资源
我正在我的VUE项目上运行组件测试,遵循文档开始柏树组件测试(VUE 2/3)。
import { mount } from '@cypress/vue'
import HelloWorld from './HelloWorld.vue'
describe('HelloWorld', () => {
it('renders a message', () => {
const msg = 'Hello Cypress Component Testing!'
mount(HelloWorld, {
propsData: {
msg
}
})
cy.get('h1').should('have.text', msg)
})
})
我如何包括通常加载到index.html
的资源,因为组件测试中没有基本页面。
I'm running component tests on my Vue project, have followed the documentation Getting Started with Cypress Component Testing (Vue 2/3).
import { mount } from '@cypress/vue'
import HelloWorld from './HelloWorld.vue'
describe('HelloWorld', () => {
it('renders a message', () => {
const msg = 'Hello Cypress Component Testing!'
mount(HelloWorld, {
propsData: {
msg
}
})
cy.get('h1').should('have.text', msg)
})
})
How do I include resources that are normally loaded to index.html
, as there is no base page in component tests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
例如
Create your resource link on
document
and attach your component to a child element of the same document, for example