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] Add a11y tests for es deprecation flyouts #110843

Merged
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 @@ -62,7 +62,9 @@ export const DefaultDeprecationFlyout = ({
<>
<EuiFlyoutHeader hasBorder>
<EuiTitle size="s" data-test-subj="flyoutTitle">
<h2>{message}</h2>
<h2 id="defaultDeprecationDetailsFlyoutTitle" className="eui-textBreakWord">
{message}
</h2>
</EuiTitle>
{index && (
<EuiText data-test-subj="flyoutDescription">
Expand All @@ -74,7 +76,7 @@ export const DefaultDeprecationFlyout = ({
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiText>
<p>{details}</p>
<p className="eui-textBreakWord">{details}</p>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

minor UX fix to prevent text from overflowing flyout

<p>
<EuiLink target="_blank" href={url}>
{i18nTexts.learnMoreLinkLabel}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const RemoveIndexSettingsFlyout = ({
<>
<EuiFlyoutHeader hasBorder>
<EuiTitle size="s" data-test-subj="flyoutTitle">
<h2>{message}</h2>
<h2 id="indexSettingsDetailsFlyoutTitle">{message}</h2>
</EuiTitle>
<EuiText>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const FixSnapshotsFlyout = ({
<>
<EuiFlyoutHeader hasBorder>
<EuiTitle size="s" data-test-subj="flyoutTitle">
<h2>{i18nTexts.flyoutTitle}</h2>
<h2 id="mlSnapshotDetailsFlyoutTitle">{i18nTexts.flyoutTitle}</h2>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const ReindexFlyout: React.FunctionComponent<ReindexFlyoutProps> = ({
<>
<EuiFlyoutHeader hasBorder>
<EuiTitle size="s" data-test-subj="flyoutTitle">
<h2>
<h2 id="reindexDetailsFlyoutTitle">
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.flyoutHeader"
defaultMessage="Reindex {index}"
Expand Down
86 changes: 68 additions & 18 deletions x-pack/test/accessibility/apps/upgrade_assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,31 @@ const translogSettingsIndexDeprecation: IndicesCreateRequest = {
},
};

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',
},
},
},
},
},
},
},
},
};

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['upgradeAssistant', 'common']);
const a11y = getService('a11y');
Expand All @@ -32,21 +57,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.upgradeAssistant.navigateToPage();

try {
// Create an index that will trigger a deprecation warning to test the ES deprecations page
// 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 index');
log.debug('[Setup error] Error creating indices');
throw e;
}
});

after(async () => {
try {
await es.indices.delete({
index: [translogSettingsIndexDeprecation.index],
index: [multiFieldsIndexDeprecation.index, translogSettingsIndexDeprecation.index],
});
} catch (e) {
log.debug('[Cleanup error] Error deleting index');
log.debug('[Cleanup error] Error deleting indices');
throw e;
}
});
Expand All @@ -58,22 +84,46 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot();
});

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

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

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

await a11y.testAppSnapshot();
it('Deprecations table', async () => {
await a11y.testAppSnapshot();
});

it('Index settings deprecation flyout', async () => {
await PageObjects.upgradeAssistant.clickEsDeprecation(
'indexSettings' // An index setting deprecation was added in the before() hook so should be guaranteed
);
await retry.waitFor('ES index settings deprecation flyout to be visible', async () => {
return testSubjects.exists('indexSettingsDetails');
});
await a11y.testAppSnapshot();
});

it('Default deprecation flyout', async () => {
await PageObjects.upgradeAssistant.clickEsDeprecation(
'default' // A default deprecation was added in the before() hook so should be guaranteed
);
await retry.waitFor('ES default deprecation flyout to be visible', async () => {
return testSubjects.exists('defaultDeprecationDetails');
});
await a11y.testAppSnapshot();
});
});

describe('Kibana deprecations page', () => {
Expand Down
13 changes: 13 additions & 0 deletions x-pack/test/functional/page_objects/upgrade_assistant_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,17 @@ export class UpgradeAssistantPageObject extends FtrService {
this.log.debug('Unable to find selected deprecation row');
}
}

async clickEsDeprecation(deprecationType: 'indexSettings' | 'default' | 'reindex' | 'ml') {
const table = await this.testSubjects.find('esDeprecationsTable');
const deprecationIssueLink = await (
await table.findByTestSubject(`${deprecationType}TableCell-message`)
).findByCssSelector('button');

if (deprecationIssueLink) {
await deprecationIssueLink.click();
} else {
this.log.debug('Unable to find selected deprecation');
}
}
}