у нас есть угловое приложение, в котором возможен только адаль-вход?
если да, было бы здорово, как мы можем этого добиться?
ниже я попробовал, но не работал
Мой тестовый пример выглядит как ниже
it('should display message saying app works', () => {
browser.ignoreSynchronization = true;
browser.waitForAngularEnabled(false);
page.navigateToLogin();
page.fillCredentials();
page.waitForRedirect(100000).then(() => {
page.navigateTo();
//// Some Expectations here
});
});
below are the supporting methods
fillCredentials() {
// browser.findElement(by.id('cred_userid_inputtext')).sendKeys('test@microsoft.onmicrosoft.com');
// browser.findElement(by.id('cred_password_inputtext')).sendKeys('*******');
// browser.findElement(by.id('cred_sign_in_button')).click();
element(by.id('i0116')).sendKeys('test@microsoft.onmicrosoft.com');
element(by.id('i0118')).sendKeys('********');
element(by.id('idSIButton9')).click();
}
waitForRedirect(timeout: number = browser.getPageTimeout) {
// Before we tell the browser to wait, assume it has not navigated
let hasRedirected = false;
// Passing a function to browser.wait() tells protractor to call that function repeatedly.
// This function returns the closure variable hasRedirected, which will be set to true once the
// necessaryUrlFragment has been found in the url
return browser.wait(() => {
browser.getCurrentUrl()
// Check to see if necessaryUrlFragment is in the current url
.then(url => {
return (url.indexOf('home') > -1);
})
// Update our navigation status
.then(hasNavigated => {
hasRedirected = hasNavigated;
});
// Return our navigation status every time protractor asks for it - even if navigation is
if (hasRedirected) {
browser.waitForAngularEnabled(true);
return hasRedirected;
}
// not complete
}, timeout);
}
Редактировать: Здесь учетные данные заполнения не работают должным образом.страница https://login.microsoftonline.com
принимает имя пользователя, но всегда входит в систему с моими кэшированными учетными данными из браузера.вместо использования учетных данных, переданных через транспортир