Skip to content

Commit

Permalink
[Upgrade Assistant] Enable functional and a11y tests (elastic#109909)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth authored and sabarasaba committed Oct 26, 2021
1 parent 755eef8 commit df4c3af
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,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
115 changes: 63 additions & 52 deletions x-pack/test/accessibility/apps/upgrade_assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,81 +5,92 @@
* 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');

describe.skip('Upgrade Assistant', () => {
before(async () => {
await PageObjects.upgradeAssistant.navigateToPage();
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('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,
}
);

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

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.skip('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
110 changes: 72 additions & 38 deletions x-pack/test/functional/apps/upgrade_assistant/upgrade_assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,75 +5,109 @@
* 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 retry = getService('retry');
const testSubjects = getService('testSubjects');
const es = getService('es');
const security = getService('security');
const log = getService('log');
const retry = getService('retry');

// Updated for the hiding of the UA UI.
describe.skip('Upgrade Checkup', 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.skip('allows user to navigate to upgrade checkup', 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('overview');
});
});

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');
});
it('renders the Elasticsearch deprecations page', async () => {
await PageObjects.upgradeAssistant.navigateToPage();
await PageObjects.upgradeAssistant.clickEsDeprecationsPanel();

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');
});
});
});
}
8 changes: 7 additions & 1 deletion x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,13 @@ export default async function ({ readConfigFile }) {
// using this role even for remote clusters
global_ccr_role: {
elasticsearch: {
cluster: ['manage', 'manage_ccr'],
cluster: ['manage'],
indices: [
{
names: ['*'],
privileges: ['view_index_metadata'],
},
],
},
kibana: [
{
Expand Down
Loading

0 comments on commit df4c3af

Please sign in to comment.