本文整理汇总了TypeScript中protractor.browser.switchTo方法的典型用法代码示例。如果您正苦于以下问题:TypeScript browser.switchTo方法的具体用法?TypeScript browser.switchTo怎么用?TypeScript browser.switchTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.browser
的用法示例。
在下文中一共展示了browser.switchTo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should show 2 alerts from Save w/prop button', async () => {
await saveProp.click();
expect(browser.switchTo().alert().getText()).toEqual('Saved.');
browser.switchTo().alert().accept();
expect(browser.switchTo().alert().getText()).toEqual('Saved.');
browser.switchTo().alert().accept();
});
示例2: it
it('shows', async () => {
await builder.goForce();
await force.clickStartButton();
await builder.goForce();
await force.clickStartButton();
// hopefully we'll see at least one buildrequest by the time we get to
// the pending build requests page
await pendingBuildrequests.go();
const isBulidrequestsVisible = async () => {
let count = await pendingBuildrequests.getAllBuildrequestRows().count();
return count > 0;
};
await browser.wait(isBulidrequestsVisible,
5000,
"did not find buildrequests");
const br = pendingBuildrequests.getAllBuildrequestRows().first();
expect(await br.element(By.css('td:nth-child(2) a')).getText()).toMatch('slowruntests');
// kill remaining builds
await builder.go();
await force.clickCancelWholeQueue();
await browser.wait(EC.alertIsPresent(),
5000,
"did not find confirmation alert");
await browser.switchTo().alert().accept();
});
示例3:
return browser.switchTo().frame(iframe).then( () => {
let el = browser.driver.findElement(by.id('tinymce'));
let text = el.getText();
return browser.switchTo().defaultContent().then(()=>{
return browser.waitForAngular().then(()=>{return text});
});
});
示例4: it
it('should go through the checkout process', async() => {
await pageElements.productListLinks.get(0).click();
const checkoutLink = pageElements.topBarCheckoutLink;
const productDetailsPage = pageElements.productDetailsPage;
const buyButton = await productDetailsPage.element(by.css('button'));
const cartPage = pageElements.cartPage;
const inputFields = cartPage.all(by.css('form input'));
const purchaseButton = await cartPage.element(by.css('button'));
const nameField = inputFields.get(0);
const addressField = inputFields.get(1);
await buyButton.click();
await browser.wait(EC.alertIsPresent(), 1000);
await browser.switchTo().alert().accept();
await checkoutLink.click();
await nameField.sendKeys('Customer');
await addressField.sendKeys('Address');
await purchaseButton.click();
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
const cartMessages = logs.filter(({ message }) => message.includes('Your order has been submitted'));
expect(cartMessages.length).toBe(1);
});
示例5: crisisCenterEdit
async function crisisCenterEdit(index: number, save: boolean) {
const page = getPageStruct();
await page.crisisHref.click();
let crisisEle = page.crisisList.get(index);
let text = await crisisEle.getText();
expect(text.length).toBeGreaterThan(0, 'crisis item text length');
// remove leading id from text
const crisisText = text.substr(text.indexOf(' ')).trim();
await crisisEle.click();
expect(page.crisisDetail.isPresent()).toBe(true, 'crisis detail present');
expect(page.crisisDetailTitle.getText()).toContain(crisisText);
let inputEle = page.crisisDetail.element(by.css('input'));
await inputEle.sendKeys('-foo');
let buttonEle = page.crisisDetail.element(by.buttonText(save ? 'Save' : 'Cancel'));
await buttonEle.click();
crisisEle = page.crisisList.get(index);
if (save) {
expect(crisisEle.getText()).toEqual(crisisText + '-foo');
} else {
await browser.wait(EC.alertIsPresent(), 4000);
await browser.switchTo().alert().accept();
expect(crisisEle.getText()).toEqual(crisisText);
}
}
示例6:
browser.getAllWindowHandles().then((handles) => {
browser.switchTo().window(handles[1]).then(() => {
browser.get(TestConfig.adf.url + '/activiti');
processServicesPage.checkApsContainer();
browser.get(TestConfig.adf.url + '/files');
contentServicesPage.checkAcsContainer();
});
});
示例7: it
it('should get error on leaving when name is changed.', async function () {
await browser.setLocation(`/${tribe.id}/player/${player1._id}`);
expect(browser.getCurrentUrl()).toBe(`${hostName}/${tribe.id}/player/${player1._id}/`);
element(By.id('player-name')).clear();
element(By.id('player-name')).sendKeys('completely different name');
element(By.css(`.tribe-card img`)).click();
await browser.wait(() => browser.switchTo().alert().then(() => true, () => false), 5000);
const alertDialog = await browser.switchTo().alert();
expect(alertDialog.getText())
.toEqual('You have unsaved data. Would you like to save before you leave?');
alertDialog.dismiss();
});
示例8: it
it('can be deleted', async function () {
const pairAssignmentSetElements = element.all(by.className('pair-assignments'));
const deleteButton = pairAssignmentSetElements.get(0).element(By.css('.delete-button'));
deleteButton.click();
const alert = await browser.switchTo().alert();
alert.accept();
await browser.wait(async () => await pairAssignmentSetElements.count() === 1, 2000);
expect(pairAssignmentSetElements.count()).toBe(1);
});
示例9: it
it('should have an alert when the message is dismissed', () => {
// https://git.io/vKHN1
if (browserName !== 'chrome') {
rxNotify.byStack('custom').byText(msgText).dismiss();
let EC = ExpectedConditions;
browser.wait(EC.alertIsPresent());
browser.switchTo().alert().then(alertBox => {
let msg = 'We are dismissing the message: Testing On Dismiss Method';
expect(alertBox.getText()).to.eventually.equal(msg);
alertBox.accept();
});
}
});