Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes a skipped management x-pack test #96178

Merged
merged 4 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
29 changes: 16 additions & 13 deletions x-pack/test/functional/apps/security/management.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const browser = getService('browser');
const find = getService('find');
const PageObjects = getPageObjects(['security', 'settings', 'common', 'header']);

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`;
const security = getService('security');

// 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 @@ -43,20 +44,26 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.navigateTo();
});

after(async () => {
await security.role.delete('logstash-readonly');
await security.user.delete('dashuser', 'new-user');
await PageObjects.security.forceLogout();
});

describe('Security', () => {
describe('navigation', () => {
it('Can navigate to create user section', async () => {
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 @@ -67,12 +74,11 @@ export default function ({ getService, getPageObjects }) {
await testSubjects.setValue('passwordConfirmationInput', '123456');
await testSubjects.setValue('userFormFullNameInput', 'Full User Name');
await testSubjects.setValue('userFormEmailInput', '[email protected]');

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 @@ -143,14 +149,11 @@ export default function ({ getService, getPageObjects }) {
await testSubjects.setValue('passwordConfirmationInput', '123456');
await testSubjects.setValue('userFormFullNameInput', 'dashuser');
await testSubjects.setValue('userFormEmailInput', '[email protected]');
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 PageObjects.settings.clickLinkText('kibana_dashboard_only_user');
await find.clickByButtonText('logstash-readonly');
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