astonishing-football-22754
04/10/2021, 4:26 PMbulky-sundown-74498
04/10/2021, 4:26 PMbulky-sundown-74498
04/10/2021, 4:27 PMbulky-sundown-74498
04/10/2021, 4:30 PMmount().then(() => {
Cypress.vueWrapper.setProps ?
})
astonishing-football-22754
04/10/2021, 4:31 PMconsole.log(Cypress.vueWrapper)
after setting the props it has the correct classes, but is not reflected when using cy.get('button'
🤔bulky-sundown-74498
04/10/2021, 4:31 PMastonishing-football-22754
04/10/2021, 4:32 PMbulky-sundown-74498
04/10/2021, 4:32 PMbulky-sundown-74498
04/10/2021, 4:33 PMjs
it('renders a primary button', () => {
mount(AsButton, {
propsData: {
type: btnType.PRIMARY,
label: `I'm a sexy button`,
},
}).then(() => {
Cypress.vueWrapper.setProps({
type: btnType.SECONDARY,
});
cy.wait(1000);
cy.get('button').should('have.class', 'btn-secondary'); // Fails
});
});
astonishing-football-22754
04/10/2021, 4:33 PMbulky-sundown-74498
04/10/2021, 4:34 PMbulky-sundown-74498
04/10/2021, 4:34 PMastonishing-football-22754
04/10/2021, 4:34 PMmount
function that retrieves the vueWrapper as a promiseastonishing-football-22754
04/10/2021, 4:36 PMbulky-sundown-74498
04/10/2021, 4:36 PMbulky-sundown-74498
04/10/2021, 4:37 PMbulky-sundown-74498
04/10/2021, 4:37 PMastonishing-football-22754
04/10/2021, 4:38 PMthankful-battery-80804
04/11/2021, 12:02 PMhttps://github.com/travis5491811/cypress-vue-nuxt/blob/main/cypress/plugins.js
). For testing the basic test with the logo. Unfortunately I get a lot of warnings when I run the test:
js
WARNING in ./node_modules/@cypress/vue/node_modules/@vue/test-utils/dist/vue-test-utils.esm-bundler.js 2205:16-24
"export 'reactive' was not found in 'vue'
@ ./node_modules/@cypress/vue/dist/cypress-vue.esm-bundler.js
@ ./components/cytest/helloWorld.test.js
@ ./node_modules/@cypress/webpack-dev-server/dist/loader.js!./node_modules/@cypress/webpack-dev-server/dist/browser.js
@ ./node_modules/@cypress/webpack-dev-server/dist/browser.js
Cypress itself tells me that the error comes from the test code itself:
bash
The following error originated from your test code, not from Cypress.
> Object(...) is not a function
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Test looks like this, the tested is the regular Nuxt logo component.
js
import { mount } from '@cypress/vue'
import Logo from './Logo'
describe('check logo', () => {
it('contains an svg', () => {
mount(Logo)
cy.get('svg').should('be.visible')
})
})
bulky-sundown-74498
04/11/2021, 12:49 PMbulky-sundown-74498
04/11/2021, 12:50 PMbulky-sundown-74498
04/11/2021, 12:50 PMbulky-sundown-74498
04/11/2021, 12:51 PMbulky-sundown-74498
04/11/2021, 12:52 PMthankful-battery-80804
04/11/2021, 12:53 PM"nuxt": "^2.15.4",
"@cypress/vue": "^3.0.1",
"@cypress/webpack-dev-server": "^1.1.2",
"@nuxt/test-utils": "^0.2.0",
"@vue/test-utils": "^1.1.3",
"cypress": "^7.0.1",
"vue-jest": "^3.0.4",
"vue-loader": "^15.9.6",
"webpack-dev-server": "^3.11.2"
thankful-battery-80804
04/11/2021, 12:54 PMthankful-battery-80804
04/11/2021, 12:55 PMbulky-sundown-74498
04/11/2021, 12:56 PMthankful-battery-80804
04/11/2021, 12:56 PMbulky-sundown-74498
04/11/2021, 12:56 PM