From 42faf2253a5d96438eaed152bbca8e9fc6853a0c Mon Sep 17 00:00:00 2001
From: John Dorlus
Date: Thu, 4 Feb 2021 04:43:00 -0500
Subject: [PATCH 1/3] Added overview a11y test. Added data test subjects to the
tabs in the app.
---
.../public/application/components/tabs.tsx | 3 ++
.../components/tabs/checkup/checkup_tab.tsx | 1 +
.../components/tabs/overview/index.tsx | 2 +-
.../accessibility/apps/upgrade_assistant.ts | 36 +++++++++++++++++++
4 files changed, 41 insertions(+), 1 deletion(-)
create mode 100644 x-pack/test/accessibility/apps/upgrade_assistant.ts
diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/tabs.tsx
index 110eff36e3df9..9b83b606d5b57 100644
--- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs.tsx
+++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs.tsx
@@ -189,6 +189,7 @@ export class UpgradeAssistantTabs extends React.Component {
return [
{
id: 'overview',
+ 'data-test-subj': 'upgradeAssistantOverviewTab',
name: i18n.translate('xpack.upgradeAssistant.overviewTab.overviewTabTitle', {
defaultMessage: 'Overview',
}),
@@ -196,6 +197,7 @@ export class UpgradeAssistantTabs extends React.Component {
},
{
id: 'cluster',
+ 'data-test-subj': 'upgradeAssistantClusterTab',
name: i18n.translate('xpack.upgradeAssistant.checkupTab.clusterTabLabel', {
defaultMessage: 'Cluster',
}),
@@ -212,6 +214,7 @@ export class UpgradeAssistantTabs extends React.Component {
},
{
id: 'indices',
+ 'data-test-subj': 'upgradeAssistantIndicesTab',
name: i18n.translate('xpack.upgradeAssistant.checkupTab.indicesTabLabel', {
defaultMessage: 'Indices',
}),
diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.tsx
index 4fa4dafb55ff5..000fa28186b21 100644
--- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.tsx
+++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.tsx
@@ -102,6 +102,7 @@ export const CheckupTab: FunctionComponent = ({
strongCheckupLabel: {checkupLabel},
nextEsVersion: `${nextMajor}.x`,
}}
+ data-test-subj="upgradeAssistant{checkupLabel}tabDetail"
/>
diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/overview/index.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/overview/index.tsx
index d7a30bf2e6a5e..98e4c0f072f36 100644
--- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/overview/index.tsx
+++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/overview/index.tsx
@@ -30,7 +30,7 @@ export const OverviewTab: FunctionComponent = (props)
<>
-
+
{
+ before(async () => {
+ await PageObjects.upgradeAssistant.navigateToPage();
+ });
+
+ it('Overview', async () => {
+ await retry.waitFor('Upgrade Assistant overview tab to be visible', async () => {
+ return testSubjects.exists('upgradeAssistantOverviewTabDetail') ? true : false;
+ });
+ await a11y.testAppSnapshot();
+ });
+
+ it('List View', async () => {
+ await testSubjects.click('upgradeAssistantClusterTab');
+ await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
+ return testSubjects.exists('upgradeAssistantOverviewTab') ? true : false;
+ });
+ return testSubjects.isDisplayed('pipelineDetails') ? true : false;
+ await a11y.testAppSnapshot();
+ });
+ });
+}
From be068519e92b7915c9b00b9056f9b011df5aca51 Mon Sep 17 00:00:00 2001
From: John Dorlus
Date: Thu, 4 Feb 2021 19:48:39 -0500
Subject: [PATCH 2/3] Added data test subjects for all tabs and the detail
panel on the indidual pages. Updated tests to wait for detail panel to be
visible before taking snapshot.
---
.../components/tabs/checkup/checkup_tab.tsx | 7 +++++--
.../accessibility/apps/upgrade_assistant.ts | 17 ++++++++++++-----
x-pack/test/accessibility/config.ts | 1 +
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.tsx
index 000fa28186b21..45f55ac307e2e 100644
--- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.tsx
+++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.tsx
@@ -94,7 +94,11 @@ export const CheckupTab: FunctionComponent = ({
<>
-
+
= ({
strongCheckupLabel: {checkupLabel},
nextEsVersion: `${nextMajor}.x`,
}}
- data-test-subj="upgradeAssistant{checkupLabel}tabDetail"
/>
diff --git a/x-pack/test/accessibility/apps/upgrade_assistant.ts b/x-pack/test/accessibility/apps/upgrade_assistant.ts
index 2b434e78f27cf..4f37310cddbfa 100644
--- a/x-pack/test/accessibility/apps/upgrade_assistant.ts
+++ b/x-pack/test/accessibility/apps/upgrade_assistant.ts
@@ -17,19 +17,26 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.upgradeAssistant.navigateToPage();
});
- it('Overview', async () => {
+ it('Overview Tab', async () => {
await retry.waitFor('Upgrade Assistant overview tab to be visible', async () => {
- return testSubjects.exists('upgradeAssistantOverviewTabDetail') ? true : false;
+ return testSubjects.exists('upgradeAssistantOverviewTabDetail');
});
await a11y.testAppSnapshot();
});
- it('List View', async () => {
+ it('Cluster Tab', async () => {
await testSubjects.click('upgradeAssistantClusterTab');
await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
- return testSubjects.exists('upgradeAssistantOverviewTab') ? true : false;
+ return testSubjects.exists('upgradeAssistantClusterTabDetail');
+ });
+ await a11y.testAppSnapshot();
+ });
+
+ it('Indices Tab', async () => {
+ await testSubjects.click('upgradeAssistantIndicesTab');
+ await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
+ return testSubjects.exists('upgradeAssistantIndexTabDetail');
});
- return testSubjects.isDisplayed('pipelineDetails') ? true : false;
await a11y.testAppSnapshot();
});
});
diff --git a/x-pack/test/accessibility/config.ts b/x-pack/test/accessibility/config.ts
index 67bfdd7a07b9d..4c702ea6c1431 100644
--- a/x-pack/test/accessibility/config.ts
+++ b/x-pack/test/accessibility/config.ts
@@ -30,6 +30,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/index_lifecycle_management'),
require.resolve('./apps/ml'),
require.resolve('./apps/lens'),
+ require.resolve('./apps/upgrade_assistant'),
],
pageObjects,
From 50332ba81565b8bb0ac19a7d103c86271a005b12 Mon Sep 17 00:00:00 2001
From: John Dorlus
Date: Fri, 5 Feb 2021 01:24:28 -0500
Subject: [PATCH 3/3] Updated snapshot for upgrade assistant jest tests.
---
.../checkup/__snapshots__/checkup_tab.test.tsx.snap | 12 +++++++++---
x-pack/test/accessibility/apps/upgrade_assistant.ts | 5 +++--
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap
index 5aa4a469e4f02..bac67bf722ea7 100644
--- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap
+++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap
@@ -6,7 +6,9 @@ exports[`CheckupTab render with deprecations 1`] = `
-
+
-
+
-
+