playwright-zephyr
playwright-zephyr copied to clipboard
Problem with Bearer token
It is not possible to login using bearer token.
The token type is always BASIC https://github.com/elaichenkov/playwright-zephyr/blob/main/src/zephyr.service.ts#L40
this.password = options.password!;
let tokenType = 'Basic'
if (this.authorizationToken ){
tokenType = 'Bearer // <------ Bearer if authorizationToken
}
this.basicAuthToken = Buffer.from(`${this.user}:${this.password}`).toString('base64');
this.authorizationToken = options.authorizationToken ?? this.basicAuthToken;
this.projectKey = options.projectKey;
this.axios = axios.create({
baseURL: this.url,
headers: {
'Content-Type': 'application/json',
Authorization: `${tokenType} ${this.authorizationToken}`, <---------------
},
Hey,
The Basic
token is only for the Zephyr Server version. If you are using Cloud version, then you need to use cloud
reporter. For instance:
// playwright.config.ts
const config: PlaywrightTestConfig = {
reporter: [
['playwright-zephyr/lib/src/cloud', { // <-- Reporter for the Zephyr Scale cloud version
projectKey: 'JARV', // <-- Replace with your project key
authorizationToken: process.env.ZEPHYR_AUTH_TOKEN, // <-- Replace with your authorization token
}],
],
}