Skip to content

Commit 25f4b05

Browse files
committed
correcao-playwright
1 parent a3172c5 commit 25f4b05

File tree

1 file changed

+17
-64
lines changed

1 file changed

+17
-64
lines changed

playwright.config.ts

Lines changed: 17 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,43 @@
11
import { defineConfig, devices } from '@playwright/test';
22
import dotenv from 'dotenv';
3-
import path from 'path';
3+
44
if (!process.env.CI) {
55
dotenv.config();
66
}
7-
//dotenv.config({ path: path.resolve(__dirname, '.env') });
8-
9-
/**
10-
* Read environment variables from file.
11-
* https://github.com/motdotla/dotenv
12-
*/
13-
// import dotenv from 'dotenv';
14-
// import path from 'path';
15-
// dotenv.config({ path: path.resolve(__dirname, '.env') });
16-
17-
/**
18-
* See https://playwright.dev/docs/test-configuration.
19-
*/
207
export default defineConfig({
218
testDir: './tests',
22-
/* Run tests in files in parallel */
239
fullyParallel: true,
24-
/* Fail the build on CI if you accidentally left test.only in the source code. */
2510
forbidOnly: !!process.env.CI,
26-
/* Retry on CI only */
2711
retries: process.env.CI ? 2 : 0,
28-
/* Opt out of parallel tests on CI. */
2912
workers: process.env.CI ? 1 : undefined,
30-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
3113
reporter: 'html',
32-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
14+
15+
// Configurações globais (Trace e Screenshot)
3316
use: {
3417
trace: 'on-first-retry',
3518
screenshot: 'only-on-failure',
36-
extraHTTPHeaders: {
37-
Authorization: `Bearer ${process.env.GOREST_TOKEN}`,
38-
},
3919
},
4020

41-
/* Configure projects for major browsers */
4221
projects: [
4322
{
4423
name: 'API-Tests',
45-
testMatch: /.*\.api\.spec\.ts/, // Só arquivos de API
46-
use: { baseURL: 'https://gorest.co.in' },
24+
testMatch: /.*\.spec\.ts/,
25+
testDir: './tests/api', // Organização por pasta
26+
use: {
27+
baseURL: process.env.GOREST_BASE_URL, // Pega da Secret do GitHub
28+
extraHTTPHeaders: {
29+
Authorization: `Bearer ${process.env.GOREST_TOKEN}`, // Token isolado aqui
30+
},
31+
},
4732
},
4833
{
4934
name: 'E2E-Tests',
50-
testMatch: /.*\.e2e\.spec\.ts/, // Só arquivos de site
51-
use: { baseURL: 'https://www.saucedemo.com' },
52-
},
53-
{
54-
name: 'chromium',
55-
use: { ...devices['Desktop Chrome'] },
35+
testMatch: /.*\.spec\.ts/,
36+
testDir: './tests/e2e', // Organização por pasta
37+
use: {
38+
...devices['Desktop Chrome'],
39+
baseURL: 'https://www.saucedemo.com', // URL de UI
40+
},
5641
},
57-
58-
{
59-
name: 'firefox',
60-
use: { ...devices['Desktop Firefox'] },
61-
},
62-
63-
/* Test against mobile viewports. */
64-
// {
65-
// name: 'Mobile Chrome',
66-
// use: { ...devices['Pixel 5'] },
67-
// },
68-
// {
69-
// name: 'Mobile Safari',
70-
// use: { ...devices['iPhone 12'] },
71-
// },
72-
73-
/* Test against branded browsers. */
74-
// {
75-
// name: 'Microsoft Edge',
76-
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
77-
// },
78-
// {
79-
// name: 'Google Chrome',
80-
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
81-
// },
8242
],
83-
84-
/* Run your local dev server before starting the tests */
85-
// webServer: {
86-
// command: 'npm run start',
87-
// url: 'http://localhost:3000',
88-
// reuseExistingServer: !process.env.CI,
89-
// },
9043
});

0 commit comments

Comments
 (0)