In the playwright.config.ts you can add the Authorization, That will be available for all the requests ``` import { defineConfig, devices } from '@playwright/test'; export default defineConfig({ testDir: './tests', expect: { timeout: 5000 }, /* Run tests in files in parallel */ fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: 'html', use: { baseURL:'localhost:5000', /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ actionTimeout: 0, /* Base URL to use in actions like `await page.goto('/')`. */ // baseURL: 'localhost:3000', trace: 'on-first-retry', 'Authorization': __value_here__, extraHTTPHeaders:{ } }, }); ```
Good video brother ❤
Thank you so much for sharing this video. This is really helpful for beginners
How do I pass basic authentication in POST request?
In the playwright.config.ts you can add the Authorization, That will be available for all the requests
```
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
expect: {
timeout: 5000
},
/* Run tests in files in parallel */
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
baseURL:'localhost:5000',
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'localhost:3000',
trace: 'on-first-retry',
'Authorization': __value_here__,
extraHTTPHeaders:{
}
},
});
```
what do you do when you have 2 baseURL for the same env, like baseURL1 and baseURL2?
Can u convert this test into an API test in cucumber format it will be helpful
Thanks
would you please attach link to git repo for this
github.com/JayaramachandranAugustin/EmployeeManagementService