mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
test(datetime): expect the empty-clipboard toast in the paste E2E test
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user