Skip to content

Commit

Permalink
bomb commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bush1D3v committed Sep 16, 2024
1 parent 0c27430 commit 36f9055
Show file tree
Hide file tree
Showing 118 changed files with 2,963 additions and 432 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ CONTRIBUTING.md
LICENSE
README.md
SECURITY.md
test-results
playwright-report
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ yarn.lock
pnpm-lock.yaml

*storybook.log
test-results
playwright-report
32 changes: 15 additions & 17 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import type {StorybookConfig} from "@storybook/vue3-vite";
import type { StorybookConfig } from "@storybook/vue3-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/vue3-vite",
options: {},
},
docs: {
autodocs: "tag",
},
staticDirs: ["../public"],
stories: [ "../stories/**/*.stories.ts" ],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/vue3-vite",
options: {},
},
docs: {},
staticDirs: [ "../public" ],
};
export default config;
2 changes: 1 addition & 1 deletion .storybook/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ addons.setConfig({
theme: create({
base: "dark",
textColor: "white",
appPreviewBg: "#333333",
appPreviewBg: "#0f101d",
brandTitle: "NEI Market Analytics",
brandUrl: "https://bush1d3v-portfolio.vercel.app/",
brandImage: "logo.svg",
Expand Down
16 changes: 13 additions & 3 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const preview: Preview = {
values: [
{
name: "dark",
value: "#333333",
value: "#0f101d",
},
{
name: "light",
Expand All @@ -29,8 +29,18 @@ const preview: Preview = {
],
},
},
tags: ["autodocs"],
decorators: [withActions],
tags: ["autodocs", "autodocs"],
decorators: [
withActions,
(story) => ({
components: {story},
template: `
<div style="display: flex; justify-content: center; align-items: center; width: 50dvw; height: 50dvh;">
<story />
</div>
`,
}),
],
};

export default preview;
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ FROM node:20

RUN apt-get update && apt-get install -y \
xdg-utils \
git-all
git-all \
libevent-2.1-7 \
libgstreamer-plugins-bad1.0-0

WORKDIR /app

Expand All @@ -14,4 +16,6 @@ EXPOSE 5173

EXPOSE 6006

EXPOSE 9323

CMD ["npm", "run", "dev"]
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ O **NEI Market Analytics** é um projeto de código aberto projetado para fornec
<img align='center' height='70' width='70' title='Docker' alt='docker' src='https://github.com/devicons/devicon/blob/master/icons/docker/docker-plain.svg' /> &nbsp;
<img align='center' height='60' width='50' title='Vitest' alt='vitest' src='https://github.com/bush1D3v/tsbank_api/assets/133554156/74803ee6-3f6e-4335-9f56-cb887a4285ff' /> &nbsp;&nbsp;
<img align='center' height='54' width='44' title='Storybook-js' alt='storybook-js' src='https://github.com/bush1D3v/my_portfolio/assets/133554156/213c8aa4-ce24-4b30-8e07-dceb476e8589' /> &nbsp;&nbsp;&nbsp;
<img align='center' height='50' width='50' title='VueUse' alt='vueuse' src='https://github.com/user-attachments/assets/c4eb21ad-858d-4f28-a2c7-1dd0c23342c1' /> &nbsp;
<img align='center' height='50' width='50' title='VueUse' alt='vueuse' src='https://github.com/user-attachments/assets/c4eb21ad-858d-4f28-a2c7-1dd0c23342c1' /> &nbsp;&nbsp;
<img align='center' height='50' width='60' title='Playwright' alt='playwright' src='https://github.com/user-attachments/assets/1ce5b208-a75b-48e0-bd5c-e663f4e02302' /> &nbsp;
<img align='center' height='50' width='60' title='Biomejs' alt='biomejs' src='https://github.com/user-attachments/assets/b3d8a249-e17f-4e64-9608-4a4783b7bbc0' /> &nbsp;
<img align='center' height='50' width='50' title='Chromatic' alt='chromatic' src='https://github.com/user-attachments/assets/6edd5832-5db7-4e2a-a8e4-4bbe7b8e7208' /> &nbsp;
</div>
Expand Down Expand Up @@ -73,7 +74,13 @@ bun build
### Executar testes de unidade com [Vitest](https://vitest.dev/)

```sh
bun tests
bun test:unit
```

### Executar testes de ponta a ponta com [Playwright](https://playwright.dev/)

```sh
bun test:e2e
```

Isso executa os testes de ponta a ponta no servidor de desenvolvimento Vite.
Expand Down Expand Up @@ -109,7 +116,8 @@ The **NEI Market Analytics** is an open-source project designed to provide compr
<img align='center' height='70' width='70' title='Docker' alt='docker' src='https://github.com/devicons/devicon/blob/master/icons/docker/docker-plain.svg' /> &nbsp;
<img align='center' height='54' width='44' title='Vitest' alt='vitest' src='https://github.com/bush1D3v/tsbank_api/assets/133554156/74803ee6-3f6e-4335-9f56-cb887a4285ff' /> &nbsp;&nbsp;
<img align='center' height='54' width='44' title='Storybook-js' alt='storybook-js' src='https://github.com/bush1D3v/my_portfolio/assets/133554156/213c8aa4-ce24-4b30-8e07-dceb476e8589' /> &nbsp;&nbsp;&nbsp;
<img align='center' height='50' width='50' title='VueUse' alt='vueuse' src='https://github.com/user-attachments/assets/c4eb21ad-858d-4f28-a2c7-1dd0c23342c1' /> &nbsp;
<img align='center' height='50' width='50' title='VueUse' alt='vueuse' src='https://github.com/user-attachments/assets/c4eb21ad-858d-4f28-a2c7-1dd0c23342c1' /> &nbsp;&nbsp;
<img align='center' height='50' width='60' title='Playwright' alt='playwright' src='https://github.com/user-attachments/assets/1ce5b208-a75b-48e0-bd5c-e663f4e02302' /> &nbsp;
<img align='center' height='50' width='60' title='Biomejs' alt='biomejs' src='https://github.com/user-attachments/assets/b3d8a249-e17f-4e64-9608-4a4783b7bbc0' /> &nbsp;
<img align='center' height='50' width='50' title='Chromatic' alt='chromatic' src='https://github.com/user-attachments/assets/6edd5832-5db7-4e2a-a8e4-4bbe7b8e7208' /> &nbsp;
</div>
Expand Down Expand Up @@ -155,5 +163,11 @@ bun build
### Run Unit Tests with [Vitest](https://vitest.dev/)

```sh
bun tests
bun test:unit
```

### Run E2E Tests with [Playwright](https://playwright.dev/)

```sh
bun test:e2e
```
16 changes: 12 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ services:
volumes:
- .:/app
working_dir: /app
environment:
- GIT_USER_EMAIL=${GIT_USER_EMAIL}
- GIT_USER_NAME=${GIT_USER_NAME}
command: sh -c "git config --global user.email \"$GIT_USER_EMAIL\" && git config --global user.name \"$GIT_USER_NAME\" && git config --global --add safe.directory /app && npm run dev"
command: npm run dev
ports:
- "5173:5173"

Expand All @@ -26,3 +23,14 @@ services:
- "6006:6006"
depends_on:
- vue

playwright:
image: node:20
volumes:
- .:/app
working_dir: /app
command: sh -c "npx playwright install-deps && npx playwright install chromium && npx playwright install firefox && apt-get install -y xvfb xauth && xvfb-run -- npx playwright test --ui"
ports:
- "9323:9323"
depends_on:
- vue
45 changes: 45 additions & 0 deletions e2e/about-us.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { test, expect } from "@playwright/test";

test.describe("About Us Page Tests", () => {
test("Visits the about-us page and checks content", async ({ page }) => {
await page.goto("/about-us");

const mainContent = page.locator("main.container");
await expect(mainContent).toBeVisible();

const h1 = mainContent.locator("h1");
await expect(h1).toHaveText("Impulsionando o Futuro Juntos");

const h2 = mainContent.locator("h2");
await expect(h2).toHaveText("Colaborando para um amanhã mais tecnológico.");

const p = mainContent.locator("p");
await expect(p).toHaveText("Por Trás dos Códigos");

const header = page.locator("header");
await expect(header).toBeVisible();

const footer = page.locator("footer");
await expect(footer).toBeVisible();
});

test("Checks visibility of Accordion and Badges components", async ({ page }) => {
await page.goto("/about-us");

const accordion = page.locator("[data-testid='Accordion']");
await expect(accordion).toBeVisible();

const badges = page.locator("[data-testid='Badges']");
await expect(badges).toBeVisible();
});

// test("Checks navigation back to home", async ({ page }) => {
// await page.goto("/about-us");

// const homeLink = page.locator("a[href='/']");
// await expect(homeLink).toBeVisible();
// await homeLink.click();

// await expect(page).toHaveURL("/");
// });
});
35 changes: 35 additions & 0 deletions e2e/home.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { test, expect } from "@playwright/test";

test.describe("Home Page Tests", () => {
test("Visits the app root url and checks main content", async ({ page }) => {
await page.goto("/");

const mainContainer = page.locator("main.container");
await expect(mainContainer).toBeVisible();
await expect(mainContainer).toHaveText("NEI Market Analytics");
});

test("Checks visibility of header", async ({ page }) => {
await page.goto("/");

const header = page.locator("header");
await expect(header).toBeVisible();
});

test("Checks visibility of footer", async ({ page }) => {
await page.goto("/");

const footer = page.locator("footer");
await expect(footer).toBeVisible();
});

test("Checks clickable text and navigation to about-us", async ({ page }) => {
await page.goto("/");

const clickableText = page.locator("main.container >> text=NEI Market Analytics");
await expect(clickableText).toBeVisible();
await clickableText.click();

await expect(page).toHaveURL("/about-us");
});
});
4 changes: 4 additions & 0 deletions e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"include": ["./**/*"]
}
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<meta name="theme-color" content="#ffffff">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="30">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet">
<link rel="canonical" href="http://localhost:5173">
<link rel="icon" href="/favicon.ico">
<title>NEI Market Analytics</title>
Expand Down
9 changes: 9 additions & 0 deletions mocks/components/HoverCard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type {HoverCardProps} from "@/components/HoverCard.vue";

export const HoverCardMock: HoverCardProps = {
title: "John Doe",
description: "Creator of Radix UI and Figma's design system",
startDate: "February 2022",
avatarSrc: "https://avatars.githubusercontent.com/u/11473738?v=4",
avatarFallback: "JD",
};
9 changes: 9 additions & 0 deletions mocks/components/tags/Image.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type {ImageProps} from "@/tags/Image.vue";

export const ImageMock: ImageProps = {
alt: "image",
height: "80",
width: "80",
src: "https://via.placeholder.com/80",
class: "w-20 h-20 rounded-full",
};
7 changes: 7 additions & 0 deletions mocks/components/tags/Link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type {LinkProps} from "@/tags/Link.vue";

export const LinkMock: LinkProps = {
href: "https://www.google.com",
target: "_blank",
class: "font-bold underline",
};
37 changes: 20 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@
"license": "MIT",
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"builds": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"tests": "vitest",
"test:unit": "vitest",
"test:e2e": "playwright test",
"test:report": "bunx playwright show-report",
"test:e2e-ui": "bunx playwright test --ui",
"storybook": "storybook dev -p 6006",
"lint": "npx @biomejs/biome format --write ./",
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"build-storybook": "storybook build",
"docker-build": "docker-compose build",
"docker-run": "docker build -t nei_market_analytics .",
"docker-up": "docker-compose up",
"docker-clean": "docker-compose down",
"build-storybook": "storybook build"
"docker-clean": "docker-compose down"
},
"dependencies": {
"@radix-icons/vue": "^1.0.0",
Expand All @@ -33,18 +36,19 @@
"vue-router": "^4.3.3"
},
"devDependencies": {
"@playwright/test": "^1.44.1",
"@biomejs/biome": "^1.8.3",
"@chromatic-com/storybook": "^1.9.0",
"@storybook/addon-essentials": "^8.2.9",
"@storybook/addon-interactions": "^8.2.9",
"@storybook/addon-links": "^8.2.9",
"@storybook/addon-onboarding": "^8.2.9",
"@storybook/blocks": "^8.2.9",
"@storybook/manager-api": "^8.2.9",
"@storybook/test": "^8.2.9",
"@storybook/theming": "^8.2.9",
"@storybook/vue3": "^8.2.9",
"@storybook/vue3-vite": "^8.2.9",
"@chromatic-com/storybook": "^2.0.2",
"@storybook/addon-essentials": "^8.3.0",
"@storybook/addon-interactions": "^8.3.0",
"@storybook/addon-links": "^8.3.0",
"@storybook/addon-onboarding": "^8.3.0",
"@storybook/blocks": "^8.3.0",
"@storybook/manager-api": "^8.3.0",
"@storybook/test": "^8.3.0",
"@storybook/theming": "^8.3.0",
"@storybook/vue3": "^8.3.0",
"@storybook/vue3-vite": "^8.3.0",
"@testing-library/vue": "^8.1.0",
"@tsconfig/node20": "^20.1.4",
"@types/jsdom": "^21.1.7",
Expand All @@ -56,9 +60,8 @@
"autoprefixer": "^10.4.20",
"jsdom": "^25.0.0",
"npm-run-all2": "^6.2.0",
"shadcn-nuxt": "^0.10.4",
"start-server-and-test": "^2.0.4",
"storybook": "^8.2.9",
"storybook": "^8.3.0",
"typescript": "~5.5.4",
"vite": "^5.3.1",
"vite-plugin-vue-devtools": "^7.3.1",
Expand Down
Loading

0 comments on commit 36f9055

Please sign in to comment.