diff --git a/.github/workflows/trigger-cypress-tests.yml b/.github/workflows/trigger-cypress-tests.yml new file mode 100644 index 0000000..411c0e4 --- /dev/null +++ b/.github/workflows/trigger-cypress-tests.yml @@ -0,0 +1,23 @@ +# name: Trigger Cypress Tests + +# on: +# pull_request: +# branches: +# - main + +# jobs: +# trigger-tests: +# runs-on: ubuntu-latest + +# permissions: +# contents: write +# actions: write + +# steps: +# - name: Trigger Cypress Tests in Another Repo +# run: | +# curl -X POST \ +# -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ +# -H "Accept: application/vnd.github.v3+json" \ +# https://api.github.com/repos/vinicioscst/newsletter-tests/actions/workflows/cypress-tests.yml/dispatches \ +# -d '{"ref":"main"}' diff --git a/components/ArticleCard.vue b/components/ArticleCard.vue index cc61cca..3ffe739 100644 --- a/components/ArticleCard.vue +++ b/components/ArticleCard.vue @@ -55,22 +55,18 @@ export default { }, computed: { formattedDate() { - if (!this.articleData.publishedAt) return '' - - const articleDate = new Date(this.articleData.publishedAt) + const articleDate = new Date(this.articleData.createdAt) const today = new Date() const millisecondsDiff = today.getTime() - articleDate.getTime() const daysDiff = Math.round(millisecondsDiff / (24 * 60 * 60 * 1000)) + const dateText = new Intl.RelativeTimeFormat('pt-br', { + style: 'short', + }).format(daysDiff * -1, 'day') - return new Intl.RelativeTimeFormat('pt-br', { style: 'short' }).format( - daysDiff * -1, - 'day' - ) + return `Gerado ${dateText}` }, formattedDateTitle() { - if (!this.articleData.publishedAt) return '' - - const articleDate = new Date(this.articleData.publishedAt) + const articleDate = new Date(this.articleData.createdAt) return new Intl.DateTimeFormat('pt-BR').format(articleDate) }, diff --git a/components/LoginForm.vue b/components/LoginForm.vue index ba95d31..ddb7290 100644 --- a/components/LoginForm.vue +++ b/components/LoginForm.vue @@ -13,6 +13,7 @@ name="email" label="Email" outlined + data-test="login-form-email" /> Acessar diff --git a/plugins/axios.js b/plugins/axios.js index 71d0cd9..0b71814 100644 --- a/plugins/axios.js +++ b/plugins/axios.js @@ -6,9 +6,13 @@ export default function ({ $axios, $toast }) { 'Ocorreu um erro inesperado. Por favor, tente novamente.' if (process.client) { - $toast.error(message) + $toast.error(message, { + timeout: false, + }) } else { - $toast.error('Erro de rede ou servidor não está respondendo.') + $toast.error('Erro de rede ou servidor não está respondendo.', { + timeout: false, + }) } return Promise.reject(error) diff --git a/store/index.js b/store/index.js index f833990..ba15fe8 100644 --- a/store/index.js +++ b/store/index.js @@ -96,7 +96,7 @@ export const actions = { }, }) - toast.success('Notícias geradas com sucesso!') + toast.success('Notícias geradas com sucesso!', { timeout: false }) commit('setPage', 1) commit('setPerPage', 4) @@ -138,7 +138,7 @@ export const actions = { }, }) - toast.success('Notícia alterada com sucesso!') + toast.success('Notícia alterada com sucesso!', { timeout: false }) await dispatch('loadArticles') await dispatch('loadTopics') @@ -158,7 +158,7 @@ export const actions = { }, }) - toast.success('Notícia deletada com sucesso!') + toast.success('Notícia deletada com sucesso!', { timeout: false }) await dispatch('loadArticles') await dispatch('loadTopics') diff --git a/store/user.js b/store/user.js index 7146975..7dbdef2 100644 --- a/store/user.js +++ b/store/user.js @@ -62,7 +62,7 @@ export const actions = { cookies.setAll(allCookies) - toast.success('Login realizado com sucesso!') + toast.success('Login realizado com sucesso!', { timeout: false }) router.push('/admin') } catch (error) { @@ -94,7 +94,7 @@ export const actions = { }, }) - toast.success('Usuário alterado com sucesso!') + toast.success('Usuário alterado com sucesso!', { timeout: false }) commit('setUser', data) } catch (error) { @@ -103,7 +103,7 @@ export const actions = { }, logoutUser({ commit }, { cookies, toast, router }) { - toast.success('Logout realizado com sucesso!') + toast.success('Logout realizado com sucesso!', { timeout: false }) setTimeout(() => { router.push('/login')