diff --git a/cypress/e2e/toast.spec.cy.ts b/cypress/e2e/toast.spec.cy.ts new file mode 100644 index 0000000..d43570a --- /dev/null +++ b/cypress/e2e/toast.spec.cy.ts @@ -0,0 +1,14 @@ +describe('toast', () => { + it('show toast when add ticker', () => { + cy.visit('/') + cy.acceptTermsOfUse() + + cy.addTicker('XPLG11') + + const toast = + '.Toastify .Toastify__toast-container > .Toastify__toast--success' + + cy.get(toast).should('be.visible') + cy.get(toast).should('not.be.visible') + }) +}) diff --git a/src/actions/tickersActions.ts b/src/actions/tickersActions.ts index 3dec840..3f48cbd 100644 --- a/src/actions/tickersActions.ts +++ b/src/actions/tickersActions.ts @@ -1,14 +1,12 @@ import { Ticker } from '@/@types/TickersTypes' import { uniqWith } from 'lodash' import { config } from '@/config' -import { toast } from 'react-toastify' export const tickersActions = { insert: (state: Ticker[], { tickersList, portfoliosList }: any): Ticker[] => { const newTickers: Ticker[] = [] portfoliosList.forEach((portfolioId: string) => { tickersList.forEach((ticker: string) => { - toast(`${ticker} adicionado com sucesso!`, { type: 'success' }) newTickers.push({ ...config.defaults.ticker, ticker, portfolioId }) }) }) @@ -21,8 +19,6 @@ export const tickersActions = { }, remove: (state: Ticker[], { ticker, portfolioId }: any): Ticker[] => { - toast(`${ticker} removido com sucesso!`, { type: 'success' }) - const tickers = state.filter( (i) => i.ticker !== ticker || i.portfolioId !== portfolioId, ) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 5b5158b..9dffdcb 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,6 +1,6 @@ import { ReactNode, Suspense } from 'react' import { Inter } from 'next/font/google' -import { ToastContainer, ToastContainerProps } from 'react-toastify' +import { ToastContainer } from 'react-toastify' import 'react-toastify/dist/ReactToastify.css' @@ -23,19 +23,6 @@ const inter = Inter({ export const metadata = config.app.metadata -const toastConfig: ToastContainerProps = { - position: 'bottom-right', - autoClose: 3000, - hideProgressBar: false, - newestOnTop: false, - rtl: false, - pauseOnFocusLoss: true, - draggable: true, - closeOnClick: true, - pauseOnHover: true, - theme: 'light', -} - export default function RootLayout({ children }: { children: ReactNode }) { return (
}>{children} -