さまざまなE2Eテストで使用したいいくつかの機能を持つファイルを作成しました。私はこれをテストしようとしていますが、解決策はいくつか見つかりましたが、私にとってはうまくいきません。分度器の1つのファイルから別のファイルへの機能の読み込みJS
これは物事の立場です。
var TestingFunc = function() {
this.login = function(Url) {
browser.ignoreSynchronization = true;
browser.get(Url);
browser.wait(EC.elementToBeClickable(element(by.eeHook('login',null,null))), 300000);
element(by.eeHook('login', null, null)).click();
element(by.eeHook('authenticationEmailField',null,null)).sendKeys(logins.International);
element(by.name('password')).sendKeys(logins.password);
element(by.eeHook('authenticationLoginButton',null,null)).click();
browser.wait(EC.elementToBeClickable(paymentFlow), 100000);
paymentFlow.click();
browser.wait(EC.elementToBeClickable(depositAmount), 7000);
};
};
と、私は次のようにそれを読むしようとしています:私のTestingFunc.jsで
は、私は次のように作成したファイル
var url = 'http://master.mrgreen.avengers.zone/en-US/casino';
var TestingFunc = require("C:/Users/davbor.3DB/MrGreen Google Drive/LetsTest/TestingFunc.js");
describe("The security application", function() {
var test = new TestingFunc();
it("will login to the page", function() {
test.login(url);
});
});
は、まだ私はそれを実行するたびに、私はエラーを取得しておいてください。
Failures:
1) The security application encountered a declaration exception
Message:
TypeError: TestingFunc is not a constructor
Stack:
TypeError: TestingFunc is not a constructor
at Suite.<anonymous> (C:\Users\davbor.3DB\MrGreen Google Drive\LetsTest\Testing.js:6:17)
ない私も成功せず、それを見て、家の開発者に尋ねてきたように、私が行方不明です何を確認してください。
'TestingFunc'をエクスポートしましたか? 'module.exports = TestingFunc' – casraf
ええ、mは輸出ではなく輸出で書かれていましたが、今はうまく働いていますよ、助けてくれてありがとうございます:) –