Skip to content

Commit

Permalink
fixes a skipped management x-pack test
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmivkulkarni committed Apr 2, 2021
1 parent 82f7b21 commit 5f5e7cd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export const UserForm: FunctionComponent<UserFormProps> = ({
>
<EuiFieldText
name="username"
data-test-subj={'userFormUserNameInput'}
icon="user"
value={form.values.username}
isLoading={form.isValidating}
Expand All @@ -283,6 +284,7 @@ export const UserForm: FunctionComponent<UserFormProps> = ({
>
<EuiFieldText
name="full_name"
data-test-subj={'userFormFullNameInput'}
value={form.values.full_name}
isInvalid={form.touched.full_name && !!form.errors.full_name}
onChange={eventHandlers.onChange}
Expand All @@ -298,6 +300,7 @@ export const UserForm: FunctionComponent<UserFormProps> = ({
>
<EuiFieldText
name="email"
data-test-subj={'userFormEmailInput'}
value={form.values.email}
isInvalid={form.touched.email && !!form.errors.email}
onChange={eventHandlers.onChange}
Expand Down Expand Up @@ -337,6 +340,7 @@ export const UserForm: FunctionComponent<UserFormProps> = ({
>
<EuiFieldPassword
name="password"
data-test-subj={'passwordInput'}
type="dual"
value={form.values.password}
isInvalid={form.touched.password && !!form.errors.password}
Expand All @@ -354,6 +358,7 @@ export const UserForm: FunctionComponent<UserFormProps> = ({
>
<EuiFieldPassword
name="confirm_password"
data-test-subj={'passwordConfirmationInput'}
type="dual"
value={form.values.confirm_password}
isInvalid={form.touched.confirm_password && !!form.errors.confirm_password}
Expand Down
20 changes: 11 additions & 9 deletions x-pack/test/functional/apps/security/management.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ export default function ({ getService, getPageObjects }) {

const USERS_PATH = 'security/users';
const EDIT_USERS_PATH = `${USERS_PATH}/edit`;
const CREATE_USERS_PATH = `${USERS_PATH}/create`;

const ROLES_PATH = 'security/roles';
const EDIT_ROLES_PATH = `${ROLES_PATH}/edit`;
const CLONE_ROLES_PATH = `${ROLES_PATH}/clone`;

// FLAKY: https://github.com/elastic/kibana/issues/61173
describe.skip('Management', function () {
describe('Management', function () {
this.tags(['skipFirefox']);

before(async () => {
// await PageObjects.security.login('elastic', 'changeme');
await PageObjects.security.initTests();
await kibanaServer.uiSettings.update({
defaultIndex: 'logstash-*',
Expand All @@ -49,14 +48,14 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.security.clickElasticsearchUsers();
await PageObjects.security.clickCreateNewUser();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(EDIT_USERS_PATH);
expect(currentUrl).to.contain(CREATE_USERS_PATH);
});

it('Clicking cancel in create user section brings user back to listing', async () => {
await PageObjects.security.clickCancelEditUser();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(USERS_PATH);
expect(currentUrl).to.not.contain(EDIT_USERS_PATH);
expect(currentUrl).to.not.contain(CREATE_USERS_PATH);
});

it('Clicking save in create user section brings user back to listing', async () => {
Expand All @@ -68,11 +67,12 @@ export default function ({ getService, getPageObjects }) {
await testSubjects.setValue('userFormFullNameInput', 'Full User Name');
await testSubjects.setValue('userFormEmailInput', 'example@example.com');

await PageObjects.security.clickSaveEditUser();
//await PageObjects.security.clickSaveEditUser();
await PageObjects.security.clickSaveCreateUser();

const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(USERS_PATH);
expect(currentUrl).to.not.contain(EDIT_USERS_PATH);
expect(currentUrl).to.not.contain(CREATE_USERS_PATH);
});

it('Can navigate to edit user section', async () => {
Expand Down Expand Up @@ -146,10 +146,12 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.security.assignRoleToUser('kibana_dashboard_only_user');
await PageObjects.security.assignRoleToUser('logstash-readonly');

await PageObjects.security.clickSaveEditUser();
await PageObjects.security.clickSaveCreateUser();

await PageObjects.settings.navigateTo();
await testSubjects.click('users');
await testSubjects.click('roles');
await testSubjects.click('tablePaginationPopoverButton');
await testSubjects.click('tablePagination-100-rows');
await PageObjects.settings.clickLinkText('kibana_dashboard_only_user');
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(EDIT_ROLES_PATH);
Expand Down
5 changes: 5 additions & 0 deletions x-pack/test/functional/page_objects/security_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ export function SecurityPageProvider({ getService, getPageObjects }: FtrProvider
await PageObjects.header.waitUntilLoadingHasFinished();
}

async clickSaveCreateUser() {
await find.clickByButtonText('Create user');
await PageObjects.header.waitUntilLoadingHasFinished();
}

async clickSaveEditRole() {
const saveButton = await retry.try(() => testSubjects.find('roleFormSaveButton'));
await saveButton.moveMouseTo();
Expand Down

0 comments on commit 5f5e7cd

Please sign in to comment.