"use strict";
var wd = require("wd"),
chai = require("chai"),
chaiAsPromised = require("chai-as-promised"),
actions = require ("./helpers/actions");
var driver = wd.promiseChainRemote("0.0.0.0",4723),
desired = {
"Appium-version":"1.4.13",
platformName:"iOS",
platformVersion:"9.3",
deviceName:"iPhone 6",
app:"/Users/lucien/Library/Developer/Xcode/DerivedData/YCMath345-iOS-crxbfrnkjtohbydohibkqgwayzos/Build/Products/Debug-iphonesimulator/YCMath345-iOS.app"
};
wd.addPromiseChainMethod("swipe",actions.swipe);
describe("一:滑动视频啊", function () {
this.timeout(300000);
before(function () { return driver.init(desired) });
it("1.1:展示滑动视频案例.", function () {
return driver
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIAButton[3]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIATextField[1]").sendKeys("15725040100")
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIASecureTextField[1]").sendKeys("123456")
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIAButton[3]").click()
.sleep(3000)
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIAButton[3]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[2]/UIAButton[1]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[2]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIAButton[13]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIAButton[1]").click()
.elementByXPath("//UIAApplication[1]").click()
.sleep(3000)
.elementByXPath("//UIAApplication[1]/UIAWindow[1]").getLocation()
.then(function(loc){
return driver.swipe({startX:50,startY:50,endX:50,endY:650,duration:800})
})
.sleep(3000)
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIAButton[12]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIAButton[2]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]").click()
.quit()
});
});