I want to send slack notification for my test result.
here is my Array
TestCase Name : [Test 1,Test 2,Test 3r]
TestCase Status : [true,false,false]
How do i create this string using javascript.
Here is my JsonString i Want using javascript
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "WebDriverIO Automation Status .\n\n *Following are details:*"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Test 1"
},
{
"type": "mrkdwn",
"text": " :negative_squared_cross_mark: "
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Test 2"
},
{
"type": "mrkdwn",
"text": " :x: "
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Test 3r"
},
{
"type": "mrkdwn",
"text": " :x: "
}
]
}
]
}
Slack Webhook:
axios.post(
"hook url",
{
text: `${asJSON}`,
}
);