diff --git a/example.env.local b/example.env.local
index 078bd0d..0be16f0 100644
--- a/example.env.local
+++ b/example.env.local
@@ -7,5 +7,6 @@ NEXT_PUBLIC_PRIMARY_MAIN = "#1b4332"
NEXT_PUBLIC_SECONDARY_MAIN = "#800e13"
NEXT_PUBLIC_BASE_URL = "https://crm.witel.ir"
+NEXT_PUBLIC_POWERED_BY_URL = "https://witel.ir"
NODE_ENV = "development"
\ No newline at end of file
diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json
index dd72e71..e813849 100644
--- a/public/locales/fa/app.json
+++ b/public/locales/fa/app.json
@@ -2,6 +2,7 @@
"app_name": "سامانه CRM",
"app_short_name": "سامانه CRM",
"dashboard": "داشبورد",
+ "powered_by_witel": "توسعه یافته توسط وایتل",
"first_page": "خوش آمدید",
"login": "ورود",
"login_expert": "ورود کارشناس",
diff --git a/src/components/first/__tests__/index.test.js b/src/components/first/__tests__/index.test.js
index 7e60576..6710f8c 100644
--- a/src/components/first/__tests__/index.test.js
+++ b/src/components/first/__tests__/index.test.js
@@ -1,42 +1,61 @@
+import {render, screen, waitFor} from "@testing-library/react";
import FirstComponent from "@/components/first";
-import {render, screen} from "@testing-library/react";
import MockAppWithProviders from "../../../../mocks/AppWithProvider";
import {server} from "../../../../mocks/server";
import {rest} from "msw";
import {GET_USER_ROUTE} from "@/core/data/apiRoutes";
-describe('First page component', () => {
- describe('Rendering', () => {
- it('Should see app name text', () => {
- render(, {wrapper: MockAppWithProviders})
- const appNameElement = screen.getByTestId('app-name')
- expect(appNameElement).toHaveTextContent('سامانه CRM')
+describe("First Component From First Page", () => {
+ describe("Rendering", () => {
+ it("App Name Text Rendered", () => {
+ render();
+ const appNameElement = screen.queryByText(/سامانه CRM/i);
+ expect(appNameElement).toBeInTheDocument()
+ });
+ it("App version Text Rendered", () => {
+ render();
+ const versionControler = screen.queryByText(process.env.NEXT_PUBLIC_API_VERSION, {exact: false});
+ expect(versionControler).toBeInTheDocument()
+ });
+ it("Powered By Rendered With Currect URL", () => {
+ render();
+ const linkElement = screen.queryByText('توسعه یافته توسط وایتل');
+ expect(linkElement).toBeInTheDocument()
+ expect(linkElement).toHaveAttribute('href', process.env.NEXT_PUBLIC_POWERED_BY_URL);
});
});
- describe('behavior', () => {
- it('Should see login button when is not auth', async () => {
- render(, {wrapper: MockAppWithProviders})
- const buttonLoginOrDashboard = await screen.findByTestId('button-login-or-dashboard')
- expect(buttonLoginOrDashboard).toHaveTextContent('ورود کارشناس')
- expect(buttonLoginOrDashboard).not.toHaveTextContent('داشبورد')
+ describe("Behavioral", () => {
+ it("Show Login Button And Do Not Show Dashboard Button When User Is Not Authenticated", async () => {
+ render();
+ await waitFor(() => {
+ const authenticationButtonLogin = screen.queryByText(/ورود کارشناس/i)
+ const authenticationButtonDashboard = screen.queryByText(/داشبورد/i)
+ expect(authenticationButtonLogin).toBeInTheDocument()
+ expect(authenticationButtonDashboard).not.toBeInTheDocument()
+ })
});
- it('Should see dashboard button when is auth', async () => {
+ it("Show Dashboard Button And Do Not Show Login Button When User Is Authenticated", async () => {
localStorage.setItem("_token", 'token');
- render(, {wrapper: MockAppWithProviders})
- const buttonLoginOrDashboard = await screen.findByTestId('button-login-or-dashboard')
- expect(buttonLoginOrDashboard).not.toHaveTextContent('ورود کارشناس')
- expect(buttonLoginOrDashboard).toHaveTextContent('داشبورد')
+ render();
+ await waitFor(() => {
+ const authenticationButtonLogin = screen.queryByText(/ورود کارشناس/i)
+ const authenticationButtonDashboard = screen.queryByText(/داشبورد/i)
+ expect(authenticationButtonLogin).not.toBeInTheDocument()
+ expect(authenticationButtonDashboard).toBeInTheDocument()
+ })
});
- it('Should see login button when token expire', async () => {
+ it("Show Login Button And Do Not Show Dashboard Button When User Authentication Is Expired", async () => {
localStorage.setItem("_token", 'token');
server.use([rest.get(GET_USER_ROUTE, (req, res, ctx) => {
return res(ctx.status(403))
})])
- render(, {wrapper: MockAppWithProviders})
- const buttonLoginOrDashboard = await screen.findByTestId('button-login-or-dashboard')
- expect(buttonLoginOrDashboard).toHaveTextContent('ورود کارشناس')
- expect(buttonLoginOrDashboard).not.toHaveTextContent('داشبورد')
+ render();
+ await waitFor(() => {
+ const authenticationButtonLogin = screen.queryByText(/ورود کارشناس/i)
+ const authenticationButtonDashboard = screen.queryByText(/داشبورد/i)
+ expect(authenticationButtonLogin).toBeInTheDocument()
+ expect(authenticationButtonDashboard).not.toBeInTheDocument()
+ })
});
-
});
});
\ No newline at end of file
diff --git a/src/components/first/index.jsx b/src/components/first/index.jsx
index 786f25f..1d7166d 100644
--- a/src/components/first/index.jsx
+++ b/src/components/first/index.jsx
@@ -1,4 +1,4 @@
-import {NextLinkComposed} from "@/core/components/LinkRouting";
+import LinkRouting, {NextLinkComposed} from "@/core/components/LinkRouting";
import CenterLayout from "@/layouts/CenterLayout";
import FullPageLayout from "@/layouts/FullPageLayout";
import useUser from "@/lib/app/hooks/useUser";
@@ -14,7 +14,7 @@ const FirstComponent = () => {
-
+
{t("app_name")}
+ }}
+ >
+ v{process.env.NEXT_PUBLIC_API_VERSION}
+
+
+
+
+ {t("powered_by_witel")}
+
);
diff --git a/src/components/login-expert/index.jsx b/src/components/login-expert/index.jsx
index 9f22a5b..45d897b 100644
--- a/src/components/login-expert/index.jsx
+++ b/src/components/login-expert/index.jsx
@@ -140,7 +140,7 @@ const LoginComponent = () => {
backUrlDecodedPath ? decodeURIComponent(backUrlDecodedPath) : "/"
}
>
- {t("LoginPage.link_routing_back_to")}{" "}
+ {t("LoginPage.link_routing_back_to")}{"Witel"}
{backUrlDecodedPath
? t("LoginPage.link_routing_previuos_page")
: t("LoginPage.link_routing_main_page")}