diff --git a/tests/ui-testing/pages/generalPages/dateTimePickerPage.js b/tests/ui-testing/pages/generalPages/dateTimePickerPage.js index a27f93c638..5b3ca8f745 100644 --- a/tests/ui-testing/pages/generalPages/dateTimePickerPage.js +++ b/tests/ui-testing/pages/generalPages/dateTimePickerPage.js @@ -69,11 +69,12 @@ export class DateTimePickerPage { this.customPeriodTrigger = this.customRow.locator('[role="combobox"]'); // ==================== Expected toast messages ==================== - // Values of common.dateRangeCopied / dateRangePasted / dateRangePasteError + // Values of common.dateRangeCopied / dateRangePasted / dateRangePasteError / dateRangePasteEmpty // in web/src/locales/languages/en-US.json. this.copiedToastMessage = 'Date range copied'; this.pastedToastMessage = 'Date range pasted'; this.pasteErrorToastMessage = 'Could not parse date range'; + this.pasteEmptyToastMessage = 'Clipboard is empty. Copy a date range first.'; } // ==================== Locator factories ==================== @@ -250,6 +251,11 @@ export class DateTimePickerPage { await expect(this.toastByMessage(this.pasteErrorToastMessage)).toBeVisible(); } + async expectPasteEmptyToast() { + await expect(this.toastByMessage(this.pasteEmptyToastMessage)).toBeVisible(); + await expect(this.toastByMessage(this.pasteErrorToastMessage)).toHaveCount(0); + } + // ==================== Value readers ==================== async getStartTimeValue() { diff --git a/tests/ui-testing/playwright-tests/GeneralTests/datetime-picker-copy-paste.spec.js b/tests/ui-testing/playwright-tests/GeneralTests/datetime-picker-copy-paste.spec.js index e7417d96ca..c97eeb5b16 100644 --- a/tests/ui-testing/playwright-tests/GeneralTests/datetime-picker-copy-paste.spec.js +++ b/tests/ui-testing/playwright-tests/GeneralTests/datetime-picker-copy-paste.spec.js @@ -276,19 +276,21 @@ test.describe("DateTime Picker Copy Paste testcases", () => { }); // TC-12 - test("should show the parse error toast when the clipboard is empty", { + test("should say the clipboard is empty when pasting an empty clipboard", { tag: ['@datetime-picker', '@all', '@P2'] }, async () => { testLogger.info('Pasting with an empty clipboard'); await pm.dateTimePickerPage.selectRelativePeriod('15-m'); + const labelBeforePaste = await pm.dateTimePickerPage.getTriggerLabel(); await pm.dateTimePickerPage.seedClipboard(''); await pm.dateTimePickerPage.clickPaste(); - await pm.dateTimePickerPage.expectPasteErrorToast(); + await pm.dateTimePickerPage.expectPasteEmptyToast(); await pm.dateTimePickerPage.expectRelativePanelActive(); + expect(await pm.dateTimePickerPage.getTriggerLabel()).toBe(labelBeforePaste); - testLogger.info('Empty clipboard rejected with the parse error toast'); + testLogger.info('Empty clipboard rejected with the empty-clipboard toast'); }); });