The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/tests/pageobjects/settings.js

46 lines
1002 B

import supertest from 'supertest';
import { adminUsername, adminPassword } from '../data/user.js';
const request = supertest('http://localhost:3000');
const prefix = '/api/v1/';
const login = {
user: adminUsername,
password: adminPassword,
};
function api(path) {
return prefix + path;
}
export async function getSettingValue(name) {
let credentials = {
'X-Auth-Token': undefined,
'X-User-Id': undefined,
};
// login
const reponseLogin = await request.post(api('login'))
.send(login)
.expect('Content-Type', 'application/json')
.expect(200);
credentials = {
'X-Auth-Token': reponseLogin.body.data.authToken,
'X-User-Id': reponseLogin.body.data.userId,
};
const responseGetSetting = await request.get(api(`settings/${ name }`))
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(200);
await request.post(api('logout'))
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(200);
return responseGetSetting.body.value;
}