本文整理匯總了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;
});
});