From 9b332f0e6644f65679fa74c745155df4fcc3448d Mon Sep 17 00:00:00 2001 From: mikiher Date: Wed, 17 Apr 2024 23:25:44 +0300 Subject: [PATCH] make $constants, $strings, and utility functions avaiable to Cypress mounted componenets --- client/cypress/support/component.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/client/cypress/support/component.js b/client/cypress/support/component.js index e0b83383..a3dd58d9 100644 --- a/client/cypress/support/component.js +++ b/client/cypress/support/component.js @@ -16,13 +16,23 @@ import '../../assets/app.css' import './tailwind.compiled.css' // Import commands.js using ES2015 syntax: import './commands' +import Vue from 'vue' -// Alternatively you can use CommonJS syntax: -// require('./commands') +import { Constants } from '../../plugins/constants' +import Strings from '../../strings/en-us.json' +import '../../plugins/utils' +import '../../plugins/init.client' import { mount } from 'cypress/vue2' -Cypress.Commands.add('mount', mount) +//Cypress.Commands.add('mount', mount) +Cypress.Commands.add('mount', (component, options = {}) => { + + Vue.prototype.$constants = Constants + Vue.prototype.$strings = Strings + + return mount(component, options) +}) // Example use: // cy.mount(MyComponent) \ No newline at end of file