Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
danitseitlin committed Sep 27, 2024
1 parent 13ded79 commit 164e18e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class API {

async getItems(projectName, launchId) {
try {
const response = await this.client.get(`/v1/${projectName}/item?filter.eq.launchId=${launchId}&isLatest=false&launchesLimit=0`)//filter.eq.launchId=${launchId}&isLatest=false&launchesLimit=0`);
const response = await this.client.get(`/v1/${projectName}/item?filter.eq.launchId=${launchId}&isLatest=false&launchesLimit=0`);
return this.handleResponse(response).content;
}
catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ exports['default'] = () => {
async reportLogs(testId, level, message, time, attachment) {
if(message !== undefined) {
const isJSON = this.reporter.client.isJSON(message) || Array.isArray(message);
const isException = isJSON && JSON.parse(message).errMsg !== undefined
const isException = isJSON && JSON.parse(message).errMsg !== undefined;
//If the log is a stacktrace, and we want to focus on printing the error message itself.
if(isException) message = JSON.parse(message).errMsg;
//If the log is a JS Object
Expand Down
13 changes: 4 additions & 9 deletions src/uat.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ class UAT {
});
const token = Buffer.from('ui:uiman').toString('base64');
this.setUiToken(token);
const response = await this.client.post(`/sso/oauth/token?${encodedURI}`);
console.log(response);
const response = await this.client.post(`uat/sso/oauth/token?${encodedURI}`);
return this.handleResponse(response);
}
catch (error) {
console.log(error);
return this.handleError(error);
}
}
Expand All @@ -79,20 +77,18 @@ class UAT {
async generateApiToken(token) {
this.setApiToken(token);
try {
const response = await this.client.post('/sso/me/apitoken?authenticated=true');
const response = await this.client.post('uat/sso/me/apitoken?authenticated=true');
return this.handleResponse(response);
}
catch(error) {
console.log(error);
return this.handleError(error);
}
}

async getApiKeys(token, userId) {
try {
this.setApiToken(token);
const response = await this.client.get(`api/users/${userId}/api-keys`)
console.log(response);
const response = await this.client.get(`uat/api/users/${userId}/api-keys`);
return this.handleResponse(response).items;
}
catch (error) {
Expand All @@ -103,8 +99,7 @@ class UAT {
async createApiToken(token, userId, name) {
try {
this.setApiToken(token);
const response = await this.client.post(`api/users/${userId}/api-keys`, {name: name})
console.log(response);
const response = await this.client.post(`api/users/${userId}/api-keys`, {name: name});
return this.handleResponse(response);
}
catch (error) {
Expand Down
10 changes: 1 addition & 9 deletions tests/integration/integration.executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,13 @@ describe('Performing Integration testing', async function() {
before(async () => {
loadArguments();
let client = new UAT({
protocol: 'http',
domain: 'localhost:8080',
apiPath: '/uat',
});
const token = await client.getApiToken('default', '1q2w3e');
console.log(`Got the following token: ${JSON.stringify(token)}`)
client = new UAT({
protocol: 'http',
domain: 'localhost:8080',
apiPath: '/',
});
const token = await client.getApiToken('default', '1q2w3e');
const apiToken = await client.createApiToken(token.access_token, 1, 'testing'+new Date().getTime() );
console.log(`Generated the following report portal token: ${JSON.stringify(apiToken)}`)
cliArguments.rtoken = apiToken.api_key;
console.log(`List of arguments: ${JSON.stringify(cliArguments)}`)
testcafeServer = await createTestCafe('localhost', 1337, 1338);
});

Expand Down

0 comments on commit 164e18e

Please sign in to comment.