ocket8888 commented on code in PR #6805:
URL: https://github.com/apache/trafficcontrol/pull/6805#discussion_r868428754
##########
experimental/traffic-portal/nightwatch/globals/globals.ts:
##########
@@ -21,11 +53,97 @@ export interface GlobalConfig extends NightwatchGlobals {
adminPass: string;
adminUser: string;
trafficOpsURL: string;
+ apiVersion: string;
}
-const config = {
+const globals = {
adminPass: "twelve12",
adminUser: "admin",
+ apiVersion: "4.0",
+ before: async (done: () => void): Promise<void> => {
+ const apiUrl =
`${globals.trafficOpsURL}/api/${globals.apiVersion}`;
+ const client = axios.create({
+ httpsAgent: new https.Agent({
+ rejectUnauthorized: false
+ })
+ });
+ let accessToken = "";
+ const loginReq: LoginRequest = {
+ p: globals.adminPass,
+ u: globals.adminUser
+ };
+ try {
+ const resp = await client.post(`${apiUrl}/user/login`,
JSON.stringify(loginReq));
+ if(resp.headers["set-cookie"]) {
+ for (const cookie of
resp.headers["set-cookie"]) {
+ if(cookie.indexOf("access_token") > -1)
{
+ accessToken = cookie;
+ break;
+ }
+ }
+ }
+ } catch (e) {
+ console.error((e as AxiosError).message);
+ return Promise.reject();
Review Comment:
> without the manual log, nothing is output and the process exits
That's truly insane
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]