I would like to write reusable "before" section, but has failed to pass variable from main file (A.js) to imported code (HelloUtil.js). Thanks in advance for any suggestions given.
A.js
import * as UTIL from "./HelloUtil"
let variableFileA = "Hello"
// I hope the imported 'before' section is able to get 'variableFileA'
describe(`Do something`, () => {
it('A "It" section', () => {
cy.log("....")
});
})
HelloUtil.js
before('Reusable "before" 1', () => {
cy.log("lets begin....")
});
before('Reusable "before" 2', () => {
cy.log("print variable:"+variableFileA)
});
The result that I received: