簡體   English   中英

黃瓜休息

[英]Restler with Cucumber

我對量角器/黃瓜和restler完全陌生。 我正在使用打字稿。 下面是我用來點擊端點 url 並獲得響應的代碼

Given('Hit the {string}', async (string) => {
  browser.quit()
  var data: any = get(string.replace(/\s+/g, ''));
  console.log("In method:" + string.replace(/\s+/g, ''));
  console.log(data.response);
});

這將打印以下內容:

在方法中:端點 URL

不明確的

我想要打印響應和響應代碼。

感謝您的回復。 下面的代碼有效

Given('Hit the {string}', async (endpointUrl) => {
    await get(endpointUrl).on('complete', async (result, response) => {
        console.log(response.statusCode);
    });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM