Skip to content

Commit e2426fd

Browse files
Merge pull request #31 from Programou-io/develop
🔀 Atualizando a main
2 parents 94c15a3 + f212e74 commit e2426fd

File tree

9 files changed

+429
-1
lines changed

9 files changed

+429
-1
lines changed

.github/workflows/playwright.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Playwright Tests
2+
3+
on:
4+
push:
5+
branches: [ main]
6+
pull_request:
7+
types: [synchronize]
8+
branches: [main]
9+
10+
jobs:
11+
test:
12+
timeout-minutes: 8
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: lts/*
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Install Playwright Browsers
25+
run: npx playwright install --with-deps
26+
27+
- name: Run Playwright tests
28+
run: npx playwright test
29+
30+
- uses: actions/upload-artifact@v4
31+
if: always()
32+
with:
33+
name: playwright-report
34+
path: playwright-report/
35+
retention-days: 1

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ yarn-error.log*
3333
# typescript
3434
*.tsbuildinfo
3535
next-env.d.ts
36+
/test-results/
37+
/playwright-report/
38+
/blob-report/
39+
/playwright/.cache/

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Dockerfile
2+
3+
# Stage 1: Build
4+
FROM node:18 AS builder
5+
6+
# Define working directory
7+
WORKDIR /app
8+
9+
# Copy package.json and package-lock.json to the working directory
10+
COPY package*.json ./
11+
12+
# Install dependencies
13+
RUN npm ci
14+
15+
# Copy the rest of the application code
16+
COPY . .
17+
18+
# Build the application
19+
RUN npm run build
20+
21+
# Stage 2: Run
22+
FROM node:18-alpine
23+
24+
# Define working directory
25+
WORKDIR /app
26+
27+
# Copy the build output and node_modules from the builder stage
28+
COPY --from=builder /app/.next ./.next
29+
COPY --from=builder /app/node_modules ./node_modules
30+
COPY --from=builder /app/package.json ./package.json
31+
#COPY --from=builder /app/public ./public
32+
33+
# Expose port
34+
EXPOSE 3000
35+
36+
# Start the application
37+
CMD ["npm", "start"]

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3.8'
2+
3+
services:
4+
app:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
ports:
9+
- "3000:3000"
10+
volumes:
11+
- ./:/app
12+
networks:
13+
- app-network
14+
15+
networks:
16+
app-network:
17+
driver: bridge

package-lock.json

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "next lint",
10+
"test:e2e": "npx playwright test",
11+
"test:e2e-ui": "npx playwright test --ui",
12+
"test:2e2-report": "npx playwright show-report"
1013
},
1114
"dependencies": {
1215
"@next/font": "^13.4.1",
@@ -26,6 +29,7 @@
2629
"typescript": "5.0.4"
2730
},
2831
"devDependencies": {
32+
"@playwright/test": "^1.44.1",
2933
"@rocketseat/eslint-config": "^1.2.0"
3034
}
3135
}

playwright.config.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { defineConfig, devices } from '@playwright/test'
2+
3+
/**
4+
* Read environment variables from file.
5+
* https://github.com/motdotla/dotenv
6+
*/
7+
// require('dotenv').config();
8+
9+
/**
10+
* See https://playwright.dev/docs/test-configuration.
11+
*/
12+
export default defineConfig({
13+
testDir: './tests',
14+
/* Run tests in files in parallel */
15+
fullyParallel: true,
16+
/* Fail the build on CI if you accidentally left test.only in the source code. */
17+
forbidOnly: !!process.env.CI,
18+
/* Retry on CI only */
19+
retries: process.env.CI ? 2 : 0,
20+
/* Opt out of parallel tests on CI. */
21+
workers: process.env.CI ? 1 : undefined,
22+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
23+
reporter: 'html',
24+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
25+
use: {
26+
/* Base URL to use in actions like `await page.goto('/')`. */
27+
// baseURL: 'http://127.0.0.1:3000',
28+
29+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
30+
trace: 'on-first-retry',
31+
},
32+
33+
/* Configure projects for major browsers */
34+
projects: [
35+
{
36+
name: 'chromium',
37+
use: { ...devices['Desktop Chrome'] },
38+
},
39+
40+
// {
41+
// name: 'firefox',
42+
// use: { ...devices['Desktop Firefox'] },
43+
// },
44+
45+
// {
46+
// name: 'webkit',
47+
// use: { ...devices['Desktop Safari'] },
48+
// },
49+
//
50+
/* Test against mobile viewports. */
51+
// {
52+
// name: 'Mobile Chrome',
53+
// use: { ...devices['Pixel 5'] },
54+
// },
55+
// {
56+
// name: 'Mobile Safari',
57+
// use: { ...devices['iPhone 12'] },
58+
// },
59+
60+
/* Test against branded browsers. */
61+
// {
62+
// name: 'Microsoft Edge',
63+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
64+
// },
65+
// {
66+
// name: 'Google Chrome',
67+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
68+
// },
69+
],
70+
71+
/* Run your local dev server before starting the tests */
72+
// webServer: {
73+
// command: 'npm run start',
74+
// url: 'http://127.0.0.1:3000',
75+
// reuseExistingServer: !process.env.CI,
76+
// },
77+
})

0 commit comments

Comments
 (0)