Skip to content

Commit

Permalink
[Upgrade Assistant] Enable functional and a11y tests (#109909)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth authored Aug 31, 2021
1 parent c1b30eb commit 0f451a5
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 151 deletions.
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 @@ -58,7 +58,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');
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: [
{
names: ['*'],
privileges: ['view_index_metadata'],
},
],
},
kibana: [
{
Expand Down
Loading

0 comments on commit 0f451a5

Please sign in to comment.