From 767c68eaf19794080891050e91fcbe6f37cd2d67 Mon Sep 17 00:00:00 2001 From: Anssi Juvonen Date: Fri, 13 Dec 2024 20:18:08 +0200 Subject: [PATCH] Hide toasts in CI fast --- e2e/log.spec.ts | 6 ------ e2e/stats.spec.ts | 4 ---- src/components/ToastMessage.vue | 4 ++-- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/e2e/log.spec.ts b/e2e/log.spec.ts index ce545eb..825151f 100644 --- a/e2e/log.spec.ts +++ b/e2e/log.spec.ts @@ -17,12 +17,6 @@ test('logs veggies', async ({page}) => { 'This Week 2 Veggies', ); - const elements = await page.getByTestId('toast-message').all(); - for (const element of elements) { - await element.click(); - } - - await expect(page.getByTestId('toast-message')).toBeHidden(); await page.getByTestId('navbar-link-settings').click(); await page.getByTestId('navbar-link-log').click(); await expect(page.getByTestId('category-status-chart-center-label')).toHaveText( diff --git a/e2e/stats.spec.ts b/e2e/stats.spec.ts index 02817a3..49007e9 100644 --- a/e2e/stats.spec.ts +++ b/e2e/stats.spec.ts @@ -7,10 +7,6 @@ test("shows current week's veggies", async ({page}) => { await page.getByText(/^apple$/).click(); await page.getByText('Apricot').click(); await page.getByText('Avocado').click(); - const elements = await page.getByTestId('toast-message').all(); - for (const element of elements) { - await element.click(); - } await page.getByTestId('navbar-link-stats').click(); await expect(page.getByTestId('tag-apple')).toBeVisible(); await expect(page.getByTestId('tag-apricot')).toBeVisible(); diff --git a/src/components/ToastMessage.vue b/src/components/ToastMessage.vue index cd2210c..eec6817 100644 --- a/src/components/ToastMessage.vue +++ b/src/components/ToastMessage.vue @@ -10,8 +10,8 @@ defineProps<{ const emit = defineEmits(['close']); const toastMessage = ref(null); - -const {start, stop} = useTimeout(5500, { +const toastTimeout = import.meta.env.MODE === 'staging' ? 100 : 5500; +const {start, stop} = useTimeout(toastTimeout, { callback: () => emit('close'), controls: true, });