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

[Upgrade Assistant] Enable functional and a11y tests #109909

Merged
merged 6 commits into from
Aug 31, 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,7 +262,7 @@ export const EsDeprecationsTable: React.FunctionComponent<Props> = ({

<EuiSpacer size="m" />

<EuiTable>
<EuiTable data-test-subj="esDeprecationsTable">
<EuiTableHeader>
{Object.entries(cellToLabelMap).map(([fieldName, cell]) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const Overview: FunctionComponent = () => {
}

return (
<EuiPageBody restrictWidth={true}>
<EuiPageBody restrictWidth={true} data-test-subj="overview">
<EuiPageContent horizontalPosition="center" color="transparent" paddingSize="none">
<EuiPageHeader
bottomBorder
Expand Down
124 changes: 64 additions & 60 deletions x-pack/test/accessibility/apps/upgrade_assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,93 @@
* 2.0.
*/

import { IndicesCreateRequest } from '@elastic/elasticsearch/api/types';
import { FtrProviderContext } from '../ftr_provider_context';

const translogSettingsIndexDeprecation: IndicesCreateRequest = {
index: 'deprecated_settings',
body: {
settings: {
'translog.retention.size': '1b',
'translog.retention.age': '5m',
'index.soft_deletes.enabled': true,
},
},
};

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['upgradeAssistant', 'common']);
const a11y = getService('a11y');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const es = getService('es');
const log = getService('log');

// These tests need to be completely refactored to account for new UI
describe.skip('Upgrade Assistant', () => {
describe('Upgrade Assistant', () => {
before(async () => {
await PageObjects.upgradeAssistant.navigateToPage();
});

it('Coming soon prompt', async () => {
await retry.waitFor('Upgrade Assistant coming soon prompt to be visible', async () => {
return testSubjects.exists('comingSoonPrompt');
});
await a11y.testAppSnapshot();
try {
// Create an index that will trigger a deprecation warning to test the ES deprecations page
await es.indices.create(translogSettingsIndexDeprecation);
} catch (e) {
log.debug('[Setup error] Error creating index');
throw e;
}
});

// These tests will be skipped until the last minor of the next major release
describe.skip('Upgrade Assistant content', () => {
it('Overview page', async () => {
await retry.waitFor('Upgrade Assistant overview page to be visible', async () => {
return testSubjects.exists('overviewPageContent');
});
await a11y.testAppSnapshot();
});

it('Elasticsearch cluster deprecations', async () => {
await PageObjects.common.navigateToUrl(
'management',
'stack/upgrade_assistant/es_deprecations/cluster',
{
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
shouldUseHashForSubUrl: false,
}
);

await retry.waitFor('Cluster tab to be visible', async () => {
return testSubjects.exists('clusterTabContent');
after(async () => {
try {
await es.indices.delete({
index: [translogSettingsIndexDeprecation.index],
});
} catch (e) {
log.debug('[Cleanup error] Error deleting index');
throw e;
}
});

await a11y.testAppSnapshot();
it('Overview page', async () => {
await retry.waitFor('Upgrade Assistant overview page to be visible', async () => {
return testSubjects.exists('overview');
});
await a11y.testAppSnapshot();
});

it('Elasticsearch index deprecations', async () => {
await PageObjects.common.navigateToUrl(
'management',
'stack/upgrade_assistant/es_deprecations/indices',
{
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
shouldUseHashForSubUrl: false,
}
);
it('Elasticsearch deprecations page', async () => {
await PageObjects.common.navigateToUrl(
'management',
'stack/upgrade_assistant/es_deprecations',
{
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
shouldUseHashForSubUrl: false,
}
);

await retry.waitFor('Indices tab to be visible', async () => {
return testSubjects.exists('indexTabContent');
});

await a11y.testAppSnapshot();
await retry.waitFor('Elasticsearch deprecations table to be visible', async () => {
return testSubjects.exists('esDeprecationsTable');
});

it('Kibana deprecations', async () => {
await PageObjects.common.navigateToUrl(
'management',
'stack/upgrade_assistant/kibana_deprecations',
{
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
shouldUseHashForSubUrl: false,
}
);
await a11y.testAppSnapshot();
});

await retry.waitFor('Kibana deprecations to be visible', async () => {
return testSubjects.exists('kibanaDeprecationsContent');
});
it('Kibana deprecations page', async () => {
await PageObjects.common.navigateToUrl(
'management',
'stack/upgrade_assistant/kibana_deprecations',
{
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
shouldUseHashForSubUrl: false,
}
);

await a11y.testAppSnapshot();
await retry.waitFor('Kibana deprecations to be visible', async () => {
return testSubjects.exists('kibanaDeprecationsContent');
});

await a11y.testAppSnapshot();
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,16 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const security = getService('security');
const PageObjects = getPageObjects(['common', 'settings', 'security']);
const appsMenu = getService('appsMenu');
const managementMenu = getService('managementMenu');

describe('security', function () {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why were these changes necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked with @cuff-links briefly about it and we agreed it didn't seem necessary since this test suite is only changing roles. I was also occasionally getting strange SO migration errors when running locally.

await PageObjects.common.navigateToApp('home');
});

after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana');
});

describe('global all privileges (aka kibana_admin)', () => {
before(async () => {
await security.testUser.setRoles(['kibana_admin'], true);
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/upgrade_assistant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { FtrProviderContext } from '../../ftr_provider_context';

export default function upgradeCheckup({ loadTestFile }: FtrProviderContext) {
describe('Upgrade checkup ', function upgradeAssistantTestSuite() {
describe('Upgrade Assistant', function upgradeAssistantTestSuite() {
this.tags('ciGroup4');

loadTestFile(require.resolve('./feature_controls'));
Expand Down
114 changes: 70 additions & 44 deletions x-pack/test/functional/apps/upgrade_assistant/upgrade_assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,82 +5,108 @@
* 2.0.
*/

import expect from '@kbn/expect';
import { IndicesCreateRequest } from '@elastic/elasticsearch/api/types';
import { FtrProviderContext } from '../../ftr_provider_context';

const multiFieldsIndexDeprecation: IndicesCreateRequest = {
index: 'nested_multi_fields',
body: {
mappings: {
properties: {
text: {
type: 'text',
fields: {
english: {
type: 'text',
analyzer: 'english',
fields: {
english: {
type: 'text',
analyzer: 'english',
},
},
},
},
},
},
},
},
};

const translogSettingsIndexDeprecation: IndicesCreateRequest = {
index: 'deprecated_settings',
body: {
settings: {
'translog.retention.size': '1b',
'translog.retention.age': '5m',
'index.soft_deletes.enabled': true,
},
},
};

export default function upgradeAssistantFunctionalTests({
getService,
getPageObjects,
}: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['upgradeAssistant', 'common']);
const log = getService('log');
const retry = getService('retry');
const security = getService('security');
const testSubjects = getService('testSubjects');
const es = getService('es');
const log = getService('log');

// These tests need to be completely refactored to account for new UI
describe.skip('Upgrade Checkup', function () {
describe('Upgrade Assistant', function () {
this.tags('skipFirefox');

before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana');
await security.testUser.setRoles(['global_upgrade_assistant_role']);

try {
// Create two indices that will trigger deprecation warnings to test the ES deprecations page
await es.indices.create(multiFieldsIndexDeprecation);
await es.indices.create(translogSettingsIndexDeprecation);
} catch (e) {
log.debug('[Setup error] Error creating indices');
throw e;
}
});

after(async () => {
await PageObjects.upgradeAssistant.waitForTelemetryHidden();
await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana');
try {
await es.indices.delete({
index: [multiFieldsIndexDeprecation.index, translogSettingsIndexDeprecation.index],
});
} catch (e) {
log.debug('[Cleanup error] Error deleting indices');
throw e;
}

await security.testUser.restoreDefaults();
});

it('Overview page', async () => {
it('renders the Overview page', async () => {
await PageObjects.upgradeAssistant.navigateToPage();
await retry.waitFor('Upgrade Assistant overview page to be visible', async () => {
return testSubjects.exists('comingSoonPrompt');
return testSubjects.exists('overview');
});
});

it.skip('allows user to navigate to upgrade checkup', async () => {
it('renders the Elasticsearch deprecations page', async () => {
await PageObjects.upgradeAssistant.navigateToPage();
});
await PageObjects.upgradeAssistant.clickEsDeprecationsPanel();

it.skip('allows user to toggle deprecation logging', async () => {
log.debug('expect initial state to be ON');
expect(await PageObjects.upgradeAssistant.deprecationLoggingEnabledLabel()).to.be('On');
expect(await PageObjects.upgradeAssistant.isDeprecationLoggingEnabled()).to.be(true);

await retry.try(async () => {
log.debug('Now toggle to off');
await PageObjects.upgradeAssistant.toggleDeprecationLogging();

log.debug('expect state to be OFF after toggle');
expect(await PageObjects.upgradeAssistant.isDeprecationLoggingEnabled()).to.be(false);
expect(await PageObjects.upgradeAssistant.deprecationLoggingEnabledLabel()).to.be('Off');
});

log.debug('Now toggle back on.');
await retry.try(async () => {
await PageObjects.upgradeAssistant.toggleDeprecationLogging();
log.debug('expect state to be ON after toggle');
expect(await PageObjects.upgradeAssistant.isDeprecationLoggingEnabled()).to.be(true);
expect(await PageObjects.upgradeAssistant.deprecationLoggingEnabledLabel()).to.be('On');
await retry.waitFor('Elasticsearch deprecations table to be visible', async () => {
return testSubjects.exists('esDeprecationsTable');
});
});

it.skip('allows user to open cluster tab', async () => {
it('renders the Kibana deprecations page', async () => {
await PageObjects.upgradeAssistant.navigateToPage();
await PageObjects.upgradeAssistant.clickTab('cluster');
expect(await PageObjects.upgradeAssistant.issueSummaryText()).to.be(
'You have no cluster issues.'
);
});
await PageObjects.upgradeAssistant.clickKibanaDeprecationsPanel();

it.skip('allows user to open indices tab', async () => {
await PageObjects.upgradeAssistant.navigateToPage();
await PageObjects.upgradeAssistant.clickTab('indices');
expect(await PageObjects.upgradeAssistant.issueSummaryText()).to.be(
'You have no index issues.'
);
await retry.waitFor('Kibana deprecations table to be visible', async () => {
return testSubjects.exists('kibanaDeprecationsContent');
});
});
});
}
6 changes: 6 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,12 @@ export default async function ({ readConfigFile }) {
global_upgrade_assistant_role: {
elasticsearch: {
cluster: ['manage'],
indices: [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this was necessary in order to create the indices to trigger deprecations

{
names: ['*'],
privileges: ['view_index_metadata'],
},
],
},
kibana: [
{
Expand Down
Loading