I am new to Playwright , I need to extract sessionId in JiraXray RestAPI , but I am getting 403/401 , Basic credentials is not reaching request , can someone help me on Playwright Request for Basic Auth
curl -H "Accept: application/json" -u jira_username:jira_password https://jiraserver.example.com/rest/raven/1.0/api/test/CALC-1880/step
playwright.config.j
httpCredentials: {
username: "username",
password: "pwd123"
},
test.spec.js
const context = await browser.newContext({
httpCredentials: {username: 'username', password: 'pwd123'}
});
let sessionid= await context.request.get('https://jiraserver.example.com/rest/auth/1/session');
expect(sessionid).toBeTruthy();
getting 403 , username password is not passed
In works fine in Cypress as below
cy.request({
method: 'GET',
form: true,
url: 'https://jiraserver.example.com/rest/auth/1/session',
auth: {
username: 'username',
password: 'pwd123',
},
headers: {
'content-type': 'application/json',
}