モジュールには 3 つのページがあり、次または前のボタンをクリックすると 1 つずつ変化します。クリックメソッドを2回書くことでクリックできます。1 回のテストで動作させるにはどうすればよいですか? ループまたは他の方法を使用する必要がありますか。JavaScript を提案してください。私の矢印環境は初めてです。nodejsを使用しています。
2 つ目は、このモジュールに自動回転機能を追加することです。そのためにも、自動化テストを準備する必要があります。この機能のテストを自動化する方法を提案してください。
http://att.yahoo.com/ (Attspotlight モジュールを確認してください)
便宜上、モジュール用に私が書いた現在のコードを次に示します。
YUI.add("cdt-att-spotlight-func-tests", function(Y) {
'use strict';
var Utils = Y.Media.Cdt.FuncTestUtils;
Y.Media.Cdt.FuncTestUtils.DebugMode=true;
var selectors = {
module: "#mediabcarouselmixedlpca_2",
/*title: ".heading",
numberSlot: ".yui-carousel-pagination",
clickButtons: ".ymg-nav-buttons",*/
nextButton: ".yui-carousel-next",
prevButton: ".yui-carousel-prev",
visibleImage:".img-wrap",
/*linkText_bestdeals: ".txt",
linkText_CheckGoPhone:".txt",
linkText_greatdeals:".txt",*/
linkText: ".txt"
};
var suite = new Y.Test.Suite("Cdt Att Spotlight Func Test Suite");
suite.add(new Y.Test.Case({
setUp: function() {
// Find our module...
this.module = Y.one(selectors.module);
// Define our components...
this.components = {
nextButton: this.module.one(selectors.nextButton),
prevButton: this.module.one(selectors.prevButton),
visibleImage: Utils.track.selector(this.module, selectors.visibleImage),
linkText: this.module.one(selectors.linkText)
};
this.module.scrollIntoView();
},
"Verify MediaCdtAttSpotlight module loaded": function() {
this.module.should.be.visibleToUser();
},
"Verify Image showed in the module": function() {
var visibleImage = this.components.visibleImage.current();
this.wait(function() {
visibleImage.should.be.visibleToUser();
}, 2000);
},
"Verify the Link Text is visible": function() {
this.components.linkText.should.be.visibleToUser();
},
"Verify clicking next button to scroll left": function() {
this.components.nextButton.simulate("click");
this.wait(function() {
}, 3000);
},
"Verify clicking next button1 to scroll left": function() {
this.components.nextButton.simulate("click");
this.wait(function() {
}, 3000);
},
"Verify clicking prev button to scroll right": function() {
this.components.prevButton.simulate("click");
this.wait(function() {
}, 2000);
},
"Verify clicking prev button1 to scroll right": function() {
this.components.prevButton.simulate("click");
this.wait(function() {
}, 2000);
}
}));
Y.Test.Runner.add(suite);
}, "0.1", { requires: ["test", "node", "node-event-simulate", "chai-yui", "cdt-func-test-utils"]});