本文整理汇总了TypeScript中protractor.protractor.promise类的典型用法代码示例。如果您正苦于以下问题:TypeScript protractor.promise类的具体用法?TypeScript protractor.promise怎么用?TypeScript protractor.promise使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了protractor.promise类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should stop be able to stop all running scroll animations, regardless of the namespace', () => {
// Check that both containers start at the top
protractor.promise.all([page.getContainer2ScrollTop(), page.getContainer3ScrollTop()]).then(
([container2ScrollTop, container3ScrollTop]) => {
expect(container2ScrollTop).toEqual(0);
expect(container3ScrollTop).toEqual(0);
// Schedule a click on the stop button in the browser (calling it from protractor won't work)
page.scheduleStopAllButtonClick();
// Start both scroll animations
page.triggerDefaultAndCustomNamespaceScroll().then(() => {
// Wait a bit
browser.sleep(10000).then(() => {
protractor.promise.all([page.getContainer2ScrollTop(), page.getContainer3ScrollTop()])
.then(([laterContainer2ScrollTop, laterContainer3ScrollTop]) => {
// Test that the both containers scrolled a bit but did not reach their target
expect(laterContainer2ScrollTop).toBeGreaterThan(0);
expect(page.getTarget2OffsetTop()).toBeGreaterThan(+laterContainer2ScrollTop);
expect(laterContainer3ScrollTop).toBeGreaterThan(0);
expect(page.getTarget3OffsetTop()).toBeGreaterThan(+laterContainer3ScrollTop);
});
});
});
}
);
});
示例2: it
it('should recreate the pageScrollInstance on input changes', () => {
protractor.promise.all(
[page.getHead7VerticalPosition(), page.getHead10VerticalPosition()]
).then(targetLocations => {
page.getScrollPos().then((initialPos: number) => {
expect(initialPos).toEqual(0);
// Scroll to first target
page.triggerDynamicTargetButton().then(() => {
browser.sleep(1250).then(() => {
page.getScrollPos().then((firstScrollPos: number) => {
expect(firstScrollPos).toBeCloseTo(Math.round(targetLocations[0]), Closeness.ofByOne);
// Change the dynamic target value...
page.selectDifferentDynamicScrollTarget();
// ... and scroll again
page.triggerDynamicTargetButton().then(() => {
browser.sleep(1250).then(() => {
page.getScrollPos().then((secondScrollPos: number) => {
expect(secondScrollPos).toBeCloseTo(Math.round(targetLocations[1]), Closeness.ofByOne);
});
});
});
});
});
});
});
});
});
示例3: expect
browser.sleep(1250).then(() => {
protractor.promise.all([page.getContainer2ScrollTop(), page.getContainer3ScrollTop()])
.then(([laterContainer2ScrollTop, laterContainer3ScrollTop]) => {
expect(laterContainer2ScrollTop).toBeGreaterThan(0);
expect(laterContainer3ScrollTop).toBeGreaterThan(0);
});
});
示例4:
browser.wait(function () {
let deferred = protractor.promise.defer();
browser.executeScript('return document.readyState').then((text) => {
deferred.fulfill(() => {
return text === 'complete';
});
});
return deferred.promise;
});
示例5:
.then((values) => {
let promises = [];
for (let i = 0; i < values.length; i++) {
promises.push(OperationsHelper.retrieveTextFromElement(values[i]));
}
return protractor.promise.all(promises).then((texts) => {
let IDs = [];
texts.forEach((text) => {
text = text.split('\n');
IDs.push({id: text[0], issued: text[1], status: text[2]});
});
return IDs;
});
});