跳至主要內容

Google Chat 服務

@qajonatasmartins/wdio-google-chat-service 是一個第三方套件,如需更多資訊,請參閱 GitHub | npm

Webdriverio 函式庫,用於將測試結果作為通知/訊息傳送到 Google Chat 空間。

安裝

npm install wdio-google-chat-service --save-dev

yarn add wdio-google-chat-service

設定

首先,將服務匯入到 wdio 設定檔 wdio.conf.js

// wdio.conf.js
const GoogleChatService = require('wdio-google-chat-service');

若要使用此服務,您需要有 Google Chat webhook URL 來傳送通知,並將 URL 新增至 'webhook' 中

範例

services: [[GoogleChatService, {
webhookUrl: 'https://chat.googleapis.com/v1/spaces/xxxxxxxxx/messages?key=xxxxxxxx&token=xxxxxxxxx',
notifyOnlyOnFailure: false //Send notification only in case of test failure
}]
],

取得 Google Chat webhook

注意:Google Chat 僅為企業帳戶提供 webhook。如果您使用個人帳戶,則不應有 webhook 選項。

  1. 在 Google Chat 上建立空間
  2. 按一下聊天空間名稱上的箭頭
  3. 按一下 [管理 Webhook]
  4. 新增一個或複製顯示的 webhook URL。
  5. 將 webhook 的 URL 貼到服務中 'webhookUrl' 選項內,如上方範例所示。

功能

  • 支援 mocha 執行器
  • 錯誤詳細資訊
  • 僅在測試失敗時傳送通知

結果

Test pass and fail

歡迎!我能為您做些什麼?

WebdriverIO AI Copilot