|
6 | 6 | */ |
7 | 7 |
|
8 | 8 | import expect from '@kbn/expect'; |
9 | | -import { FtrProviderContext } from '../ftr_provider_context'; |
| 9 | +import { FtrService } from '../ftr_provider_context'; |
10 | 10 |
|
11 | | -export function AccountSettingProvider({ getService }: FtrProviderContext) { |
12 | | - const testSubjects = getService('testSubjects'); |
13 | | - const userMenu = getService('userMenu'); |
| 11 | +export class AccountSettingsPageObject extends FtrService { |
| 12 | + private readonly testSubjects = this.ctx.getService('testSubjects'); |
| 13 | + private readonly userMenu = this.ctx.getService('userMenu'); |
14 | 14 |
|
15 | | - class AccountSettingsPage { |
16 | | - async verifyAccountSettings(expectedEmail: string, expectedUserName: string) { |
17 | | - await userMenu.clickProvileLink(); |
| 15 | + async verifyAccountSettings(expectedEmail: string, expectedUserName: string) { |
| 16 | + await this.userMenu.clickProvileLink(); |
18 | 17 |
|
19 | | - const usernameField = await testSubjects.find('username'); |
20 | | - const userName = await usernameField.getVisibleText(); |
21 | | - expect(userName).to.be(expectedUserName); |
| 18 | + const usernameField = await this.testSubjects.find('username'); |
| 19 | + const userName = await usernameField.getVisibleText(); |
| 20 | + expect(userName).to.be(expectedUserName); |
22 | 21 |
|
23 | | - const emailIdField = await testSubjects.find('email'); |
24 | | - const emailField = await emailIdField.getVisibleText(); |
25 | | - expect(emailField).to.be(expectedEmail); |
26 | | - await userMenu.closeMenu(); |
27 | | - } |
| 22 | + const emailIdField = await this.testSubjects.find('email'); |
| 23 | + const emailField = await emailIdField.getVisibleText(); |
| 24 | + expect(emailField).to.be(expectedEmail); |
| 25 | + await this.userMenu.closeMenu(); |
| 26 | + } |
28 | 27 |
|
29 | | - async changePassword(currentPassword: string, newPassword: string) { |
30 | | - await testSubjects.setValue('currentPassword', currentPassword); |
31 | | - await testSubjects.setValue('newPassword', newPassword); |
32 | | - await testSubjects.setValue('confirmNewPassword', newPassword); |
33 | | - await testSubjects.click('changePasswordButton'); |
34 | | - await testSubjects.existOrFail('passwordUpdateSuccess'); |
35 | | - } |
| 28 | + async changePassword(currentPassword: string, newPassword: string) { |
| 29 | + await this.testSubjects.setValue('currentPassword', currentPassword); |
| 30 | + await this.testSubjects.setValue('newPassword', newPassword); |
| 31 | + await this.testSubjects.setValue('confirmNewPassword', newPassword); |
| 32 | + await this.testSubjects.click('changePasswordButton'); |
| 33 | + await this.testSubjects.existOrFail('passwordUpdateSuccess'); |
36 | 34 | } |
37 | | - return new AccountSettingsPage(); |
38 | 35 | } |
0 commit comments