将variables从beforeLaunch传递给onPrepare
我在configuration中使用了带有sharedTestFiles: true
,我需要为将为所有套件运行的所有报告创build一个公共文件夹。
试图通过在beforeLaunch
定义一个date
variables来实现这beforeLaunch
,然后将其传递给onPrepare
函数,但它返回undefined
。
我试图等待date
variables被定义(认为这可能是一个asynchronous问题),但即使在等待10秒后,date仍然没有定义。 这甚至是可能的,可以通过一个variables从beforeLaunch
到onPrepare
?
beforeLaunch: function() { date = dateTime.getFullDateTime(); } onPrepare: function() { return webdriver.promise.delayed(1000).then(function() { return browser.driver.wait(function() { if(date !== undefined) { return true; } } }, 10000, 'onPrepare wait'); }