Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
985a3ad
chore: initial setup
emmanuelmarcosdeoliveira Oct 28, 2025
db5799f
chore: initial configuration of the application layout
emmanuelmarcosdeoliveira Oct 28, 2025
c930ef4
style(component): created the initial header style
emmanuelmarcosdeoliveira Oct 28, 2025
8d5fd9e
chore: inserted the project assets
emmanuelmarcosdeoliveira Oct 29, 2025
a42b5cf
feat(component): created the initial structure of the Home page
emmanuelmarcosdeoliveira Oct 29, 2025
db95f67
feat: including the product route and featured products
emmanuelmarcosdeoliveira Oct 29, 2025
aaa8b90
feat: creating a Fetch Wrapper API
emmanuelmarcosdeoliveira Oct 29, 2025
f659619
chore: inserted a pattern with the Prettier
emmanuelmarcosdeoliveira Oct 29, 2025
c12c4b2
feat(component): Product fetch added to the Home page.
emmanuelmarcosdeoliveira Oct 29, 2025
5067632
chore: Caching has been applied to the Home route.
emmanuelmarcosdeoliveira Oct 30, 2025
bdd3a3a
chore: add tailwind-merge
emmanuelmarcosdeoliveira Oct 30, 2025
e779190
feat(component): Skeleton screen added to the Home page.
emmanuelmarcosdeoliveira Oct 30, 2025
0b74244
feat(components): Initial structure for the product page.
emmanuelmarcosdeoliveira Oct 30, 2025
18f0982
feat: The route and details page for each product have been created, …
emmanuelmarcosdeoliveira Oct 31, 2025
a7fdcdd
chore: A home folder was created to improve the visibility of the com…
emmanuelmarcosdeoliveira Oct 31, 2025
84bc866
feat: Generating SSG pages for build
emmanuelmarcosdeoliveira Oct 31, 2025
5df2911
feat(component): added cart provider
emmanuelmarcosdeoliveira Nov 2, 2025
1df4dd3
feat: Enhance product page with AddToCart button and OpenGraph image …
emmanuelmarcosdeoliveira Nov 6, 2025
da11386
feat: Implement search functionality with loading and display of resu…
emmanuelmarcosdeoliveira Nov 7, 2025
3d3c73c
chore: Cypress has been added for testing.
emmanuelmarcosdeoliveira Nov 9, 2025
60a7852
test(card): The test that verifies our cart has been created.
emmanuelmarcosdeoliveira Nov 9, 2025
1b48f0c
feat: A test was added to the application's search function, and cust…
emmanuelmarcosdeoliveira Nov 10, 2025
f58b23a
chore: build
emmanuelmarcosdeoliveira Nov 10, 2025
3123a0a
chore: Inserting a timeout within the tests to prevent potential errors.
emmanuelmarcosdeoliveira Nov 10, 2025
a7e2dd2
test: create cypress e2e workflow
emmanuelmarcosdeoliveira Nov 11, 2025
6878e91
fix: test workflow correction
emmanuelmarcosdeoliveira Nov 11, 2025
9c5ca66
chore: add client/server en variables boundary"
emmanuelmarcosdeoliveira Nov 11, 2025
25a1b8a
refactor: The application tests have been modified.
emmanuelmarcosdeoliveira Nov 12, 2025
5e18890
Merge branch 'main' into develop
emmanuelmarcosdeoliveira Nov 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/run-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: E2E Tests

on: [push, pull_request]

jobs:
cypress-run:
runs-on: ubuntu-latest

steps:
# 1️⃣ Faz o checkout do código
- name: Checkout repository
uses: actions/checkout@v4

# 2️⃣ Instala o pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false

# 3️⃣ Instala Node.js com cache do pnpm
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'

# 4️⃣ Instala dependências
- name: Install dependencies
run: pnpm install

# 5️⃣ Cache do binário do Cypress
- name: Cache Cypress binary
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}

# 6️⃣ Instala binário do Cypress
- name: Install Cypress binary
run: pnpm cypress install

# 7️⃣ Build do projeto — agora com as variáveis definidas
- name: Build project
run: pnpm build
env:
NODE_ENV: production
APP_URL: 'http://localhost:3000'
NEXT_PUBLIC_API_BASE_URL: 'https://devstore-api-lilac.vercel.app/'

# 8️⃣ Inicia o servidor em segundo plano
- name: Start Next.js server
run: pnpm start &
env:
NODE_ENV: production
APP_URL: 'http://localhost:3000'
NEXT_PUBLIC_API_BASE_URL: 'https://devstore-api-lilac.vercel.app/'

# 9️⃣ Aguarda o servidor estar disponível
- name: Wait for server to be ready
run: npx wait-on http://localhost:3000

# 🔟 Executa os testes E2E
- name: Run Cypress tests
run: pnpm cypress run
env:
APP_URL: 'http://localhost:3000'
NEXT_PUBLIC_API_BASE_URL: 'https://devstore-api-lilac.vercel.app/'
2 changes: 1 addition & 1 deletion cypress/e2e/add-to-product-to-cart.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('add product to cart', () => {
cy.contains('Cart(1)').should('exist')
})
it('should be able to search for a product and add it to the cart', () => {
cy.searchByQuery('moletom')
cy.get('input[name="q"]').type('moletom').parent('form').submit()
cy.get('a[href^="/product"]').first().click()
cy.location('pathname').should('include', '/product')
cy.contains('Adicionar ao carrinho').click()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/search.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('search products', () => {
it('should be able to search for products ', () => {
cy.visit('/')
cy.searchByQuery('moletom')
cy.get('input[name="q"]').type('moletom').parent('form').submit()
cy.location('pathname').should('include', '/search')
cy.location('search').should('include', 'q=moletom')
cy.get('a[href^="/product"]', { timeout: 10000 }).should('exist')
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "eslint"
},
"dependencies": {
"@t3-oss/env-nextjs": "^0.13.8",
"lucide-react": "^0.548.0",
"next": "16.0.0",
"react": "19.2.0",
Expand Down
49 changes: 49 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 13 additions & 10 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
ort { createEnv } from '@t3-oss/env-nextjs'
import { z } from 'zod'

const envSchema = z.object({
NEXT_PUBLIC_API_BASE_URL: z.url(),
APP_URL: z.url()
})
export const env = createEnv({
server: {
APP_URL: z.url()
},
client: {
NEXT_PUBLIC_API_BASE_URL: z.url()
},

const parseEnv = envSchema.safeParse(process.env)
runtimeEnv: {
APP_URL: process.env.APP_URL,
NEXT_PUBLIC_API_BASE_URL: process.env.NEXT_PUBLIC_API_BASE_URL
}
})

if (!parseEnv.success) {
console.error('Invalid environments variables', parseEnv.error)
throw new Error('Invalid environments variables')
}
export const env = parseEnv.data
18 changes: 14 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"compilerOptions": {
"target": "ES2017",
"types": ["cypress"],
"target": "es2022",

"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"module": "es
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"moduleResolution": "bundler",

"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
Expand All @@ -29,7 +34,12 @@
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts",
"**/*.mts"

"**/*.mts",
"cypress",
"cypress/**/*.ts",
"cypress/**/*.d.ts"

],
"exclude": ["node_modules"]
}
Loading