Skip to content

Commit

Permalink
Fix "Copy to space" functional tests
Browse files Browse the repository at this point in the history
These were unskipped in #74907, but the copy-to-space flyout has
changed. Updated the tests to use new test subject selectors, and
also updated some of the i18n keys to be more consistent.
  • Loading branch information
jportner committed Aug 19, 2020
1 parent c16abc2 commit 1fe5760
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const CopyToSpaceFlyoutFooter = (props: Props) => {
</EuiFlexItem>
<EuiFlexItem>
<EuiStat
data-test-subj={`cts-summary-overwrite-count`}
data-test-subj={`cts-summary-pending-count`}
title={summarizedResults.pendingCount}
titleSize="s"
titleColor={summarizedResults.pendingCount > 0 ? 'primary' : 'subdued'}
Expand All @@ -173,15 +173,15 @@ export const CopyToSpaceFlyoutFooter = (props: Props) => {
</EuiFlexItem>
<EuiFlexItem>
<EuiStat
data-test-subj={`cts-summary-conflict-count`}
data-test-subj={`cts-summary-skipped-count`}
title={summarizedResults.skippedCount}
titleSize="s"
titleColor={summarizedResults.skippedCount > 0 ? 'primary' : 'subdued'}
isLoading={!initialCopyFinished}
textAlign="center"
description={
<FormattedMessage
id="xpack.spaces.management.copyToSpaceFlyoutFooter.conflictCount"
id="xpack.spaces.management.copyToSpaceFlyoutFooter.skippedCount"
defaultMessage="Skipped"
/>
}
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -17934,7 +17934,6 @@
"xpack.spaces.management.copyToSpace.overwriteLabel": "保存されたオブジェクトを自動的に上書きしています",
"xpack.spaces.management.copyToSpace.resolveCopyErrorTitle": "保存されたオブジェクトの矛盾の解決中にエラーが発生",
"xpack.spaces.management.copyToSpace.spacesLoadErrorTitle": "利用可能なスペースを読み込み中にエラーが発生",
"xpack.spaces.management.copyToSpaceFlyoutFooter.conflictCount": "スキップ",
"xpack.spaces.management.copyToSpaceFlyoutFooter.errorCount": "エラー",
"xpack.spaces.management.copyToSpaceFlyoutFooter.pendingCount": "保留中",
"xpack.spaces.management.copyToSpaceFlyoutFooter.successCount": "コピー完了",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -17941,7 +17941,6 @@
"xpack.spaces.management.copyToSpace.overwriteLabel": "正在自动覆盖已保存对象",
"xpack.spaces.management.copyToSpace.resolveCopyErrorTitle": "解决已保存对象冲突时出错",
"xpack.spaces.management.copyToSpace.spacesLoadErrorTitle": "加载可用工作区时出错",
"xpack.spaces.management.copyToSpaceFlyoutFooter.conflictCount": "已跳过",
"xpack.spaces.management.copyToSpaceFlyoutFooter.errorCount": "错误",
"xpack.spaces.management.copyToSpaceFlyoutFooter.pendingCount": "待处理",
"xpack.spaces.management.copyToSpaceFlyoutFooter.successCount": "已复制",
Expand Down
16 changes: 8 additions & 8 deletions x-pack/test/functional/apps/spaces/copy_saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ export default function spaceSelectorFunctonalTests({
const summaryCounts = await PageObjects.copySavedObjectsToSpace.getSummaryCounts();

expect(summaryCounts).to.eql({
copied: 3,
success: 3,
pending: 0,
skipped: 0,
errors: 0,
overwrite: undefined,
});

await PageObjects.copySavedObjectsToSpace.finishCopy();
Expand All @@ -93,23 +93,23 @@ export default function spaceSelectorFunctonalTests({
const summaryCounts = await PageObjects.copySavedObjectsToSpace.getSummaryCounts();

expect(summaryCounts).to.eql({
copied: 2,
success: 0,
pending: 2,
skipped: 1,
errors: 0,
overwrite: undefined,
});

// Mark conflict for overwrite
await testSubjects.click(`cts-space-result-${destinationSpaceId}`);
await testSubjects.click(`cts-overwrite-conflict-logstash-*`);
await testSubjects.click(`cts-overwrite-conflict-index-pattern:logstash-*`);

// Verify summary changed
const updatedSummaryCounts = await PageObjects.copySavedObjectsToSpace.getSummaryCounts(true);
const updatedSummaryCounts = await PageObjects.copySavedObjectsToSpace.getSummaryCounts();

expect(updatedSummaryCounts).to.eql({
copied: 2,
success: 0,
pending: 3,
skipped: 0,
overwrite: 1,
errors: 0,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export function CopySavedObjectsToSpacePageProvider({
destinationSpaceId: string;
}) {
if (!overwrite) {
await testSubjects.click('cts-form-overwrite');
const radio = await testSubjects.find('cts-copyModeControl-overwriteRadioGroup');
// a radio button consists of a div tag that contains an input, a div, and a label
// we can't click the input directly, need to go up one level and click the parent div
const div = await radio.findByXpath("//div[input[@id='overwriteDisabled']]");
await div.click();
}
await testSubjects.click(`cts-space-selector-row-${destinationSpaceId}`);
},
Expand All @@ -49,31 +53,25 @@ export function CopySavedObjectsToSpacePageProvider({
await testSubjects.waitForDeleted('copy-to-space-flyout');
},

async getSummaryCounts(includeOverwrite: boolean = false) {
const copied = extractCountFromSummary(
async getSummaryCounts() {
const success = extractCountFromSummary(
await testSubjects.getVisibleText('cts-summary-success-count')
);
const pending = extractCountFromSummary(
await testSubjects.getVisibleText('cts-summary-pending-count')
);
const skipped = extractCountFromSummary(
await testSubjects.getVisibleText('cts-summary-conflict-count')
await testSubjects.getVisibleText('cts-summary-skipped-count')
);
const errors = extractCountFromSummary(
await testSubjects.getVisibleText('cts-summary-error-count')
);

let overwrite;
if (includeOverwrite) {
overwrite = extractCountFromSummary(
await testSubjects.getVisibleText('cts-summary-overwrite-count')
);
} else {
await testSubjects.missingOrFail('cts-summary-overwrite-count', { timeout: 250 });
}

return {
copied,
success,
pending,
skipped,
errors,
overwrite,
};
},
};
Expand Down

0 comments on commit 1fe5760

Please sign in to comment.