mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
move users in the users object to make loginWithProgile general purpose (#6270)
* move users in the users object to make loginWithProgile general puropose * add loginProfile in login page too * fix * fix * fix * fix * fix * fix * more fix * fix * fix * fix * change * fix script * fix
This commit is contained in:
@@ -91,9 +91,9 @@ export class ApiService {
|
||||
* Example: loginWithProfile('admin')
|
||||
*/
|
||||
async loginWithProfile(profileName: string): Promise<void> {
|
||||
const profile = browser.params.testConfig[profileName];
|
||||
const profile = browser.params.testConfig.users[profileName];
|
||||
if (profile) {
|
||||
await this.apiService.login(profile.email, profile.password);
|
||||
await this.apiService.login(profile.username, profile.password);
|
||||
} else {
|
||||
throw new Error(`Login profile "${profileName}" not found on "browser.params.testConfig".`);
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ export class UsersActions {
|
||||
|
||||
async createUser(userModel?: UserModel): Promise<UserModel> {
|
||||
if (!this.api.apiService.isLoggedIn()) {
|
||||
await this.api.apiService.login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
|
||||
await this.api.apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
|
||||
}
|
||||
|
||||
const user = new UserModel({ ...(userModel ? userModel : {}) });
|
||||
|
@@ -53,6 +53,15 @@ export class LoginPage {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.txtPasswordBasicAuth);
|
||||
}
|
||||
|
||||
async loginWithProfile(profileName: string): Promise<void> {
|
||||
const profile = browser.params.testConfig.users[profileName];
|
||||
if (profile) {
|
||||
await this.login(profile.username, profile.password);
|
||||
} else {
|
||||
throw new Error(`Login profile "${profileName}" not found on "browser.params.testConfig".`);
|
||||
}
|
||||
}
|
||||
|
||||
async login(username: string, password: string) {
|
||||
Logger.log('Login With ' + username);
|
||||
|
||||
|
Reference in New Issue
Block a user