first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
const API_RESPONSE = {
|
||||
ok: true,
|
||||
channel: 'C08514ZPKB8',
|
||||
message_timestamp: '1734322671.726339',
|
||||
};
|
||||
|
||||
describe('Test SlackV2, message => delete', () => {
|
||||
nock('https://slack.com').post('/api/chat.delete').reply(200, API_RESPONSE);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['delete.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"name": "slack tests",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e679c883-1839-47dc-9511-8f7dc370e6b0",
|
||||
"name": "When clicking ‘Execute workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "delete",
|
||||
"select": "channel",
|
||||
"channelId": {
|
||||
"__rl": true,
|
||||
"value": "C08514ZPKB8",
|
||||
"mode": "list",
|
||||
"cachedResultName": "test-002"
|
||||
},
|
||||
"timestamp": 1734322671.726339
|
||||
},
|
||||
"id": "2e1937a6-4c8f-4cd1-ae42-11b2bd12cc4c",
|
||||
"name": "Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"typeVersion": 2.3,
|
||||
"position": [1040, 360],
|
||||
"webhookId": "04c5e584-45f4-48d0-bcd2-0ecacecb0f53",
|
||||
"credentials": {
|
||||
"slackApi": {
|
||||
"id": "Bg0bWXf8apAimCqJ",
|
||||
"name": "Slack account 2"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "06652908-6b8e-443a-9508-ab229b011b73",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1260, 360]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"ok": true,
|
||||
"channel": "C08514ZPKB8",
|
||||
"message_timestamp": "1734322671.726339"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Slack": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "cf10cd01-6650-48ca-b4a2-ec07be9d026c",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
|
||||
},
|
||||
"id": "qJdEfiBgYLdfYOTs",
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
const API_RESPONSE = {
|
||||
ok: true,
|
||||
permalink: 'https://myspace-qhg7381.slack.com/archives/C08514ZPKB8/p1734322671726339',
|
||||
channel: 'C08514ZPKB8',
|
||||
};
|
||||
|
||||
describe('Test SlackV2, message => getPermalink', () => {
|
||||
nock('https://slack.com')
|
||||
.get('/api/chat.getPermalink?channel=C08514ZPKB8&message_ts=1734322671.726339')
|
||||
.reply(200, API_RESPONSE);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['getPermalink.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"name": "slack tests",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e679c883-1839-47dc-9511-8f7dc370e6b0",
|
||||
"name": "When clicking ‘Execute workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "getPermalink",
|
||||
"channelId": {
|
||||
"__rl": true,
|
||||
"value": "C08514ZPKB8",
|
||||
"mode": "list",
|
||||
"cachedResultName": "test-002"
|
||||
},
|
||||
"timestamp": 1734322671.726339
|
||||
},
|
||||
"id": "2e1937a6-4c8f-4cd1-ae42-11b2bd12cc4c",
|
||||
"name": "Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"typeVersion": 2.3,
|
||||
"position": [1040, 360],
|
||||
"webhookId": "04c5e584-45f4-48d0-bcd2-0ecacecb0f53",
|
||||
"credentials": {
|
||||
"slackApi": {
|
||||
"id": "Bg0bWXf8apAimCqJ",
|
||||
"name": "Slack account 2"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "06652908-6b8e-443a-9508-ab229b011b73",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1260, 360]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"ok": true,
|
||||
"permalink": "https://myspace-qhg7381.slack.com/archives/C08514ZPKB8/p1734322671726339",
|
||||
"channel": "C08514ZPKB8"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Slack": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "64c251c3-afe5-4636-a3fc-de769f8a9ea0",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
|
||||
},
|
||||
"id": "qJdEfiBgYLdfYOTs",
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
const API_RESPONSE = {
|
||||
ok: true,
|
||||
channel: 'C08514ZPKB8',
|
||||
message: {
|
||||
user: 'U0362BXQYJW',
|
||||
type: 'message',
|
||||
ts: '1734322671.726339',
|
||||
bot_id: 'B0382SHFM46',
|
||||
app_id: 'A037UTP0Z39',
|
||||
text: 'test message',
|
||||
team: 'T0364MSFHV2',
|
||||
bot_profile: {
|
||||
id: 'B0382SHFM46',
|
||||
app_id: 'A037UTP0Z39',
|
||||
name: 'blocks-test',
|
||||
icons: {
|
||||
image_36: 'https://a.slack-edge.com/80588/img/plugins/app/bot_36.png',
|
||||
image_48: 'https://a.slack-edge.com/80588/img/plugins/app/bot_48.png',
|
||||
image_72: 'https://a.slack-edge.com/80588/img/plugins/app/service_72.png',
|
||||
},
|
||||
deleted: false,
|
||||
updated: 1648028754,
|
||||
team_id: 'T0364MSFHV2',
|
||||
},
|
||||
blocks: [
|
||||
{
|
||||
type: 'rich_text',
|
||||
block_id: 't02Ox',
|
||||
elements: [
|
||||
{
|
||||
type: 'rich_text_section',
|
||||
elements: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'test message',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
message_timestamp: '1734322671.726339',
|
||||
};
|
||||
|
||||
describe('Test SlackV2, message => post', () => {
|
||||
nock('https://slack.com')
|
||||
.post('/api/chat.postMessage', {
|
||||
channel: 'C08514ZPKB8',
|
||||
icon_emoji: '😁',
|
||||
includeLinkToWorkflow: false,
|
||||
link_names: true,
|
||||
mrkdwn: true,
|
||||
text: 'test message',
|
||||
unfurl_links: true,
|
||||
unfurl_media: true,
|
||||
})
|
||||
.reply(200, API_RESPONSE);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['post.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,143 @@
|
||||
{
|
||||
"name": "slack tests",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e679c883-1839-47dc-9511-8f7dc370e6b0",
|
||||
"name": "When clicking ‘Execute workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"select": "channel",
|
||||
"channelId": {
|
||||
"__rl": true,
|
||||
"value": "C08514ZPKB8",
|
||||
"mode": "list",
|
||||
"cachedResultName": "test-002"
|
||||
},
|
||||
"text": "test message",
|
||||
"otherOptions": {
|
||||
"includeLinkToWorkflow": false,
|
||||
"botProfile": {
|
||||
"imageValues": {
|
||||
"profilePhotoType": "emoji",
|
||||
"icon_emoji": "😁"
|
||||
}
|
||||
},
|
||||
"link_names": true,
|
||||
"mrkdwn": true,
|
||||
"unfurl_links": true,
|
||||
"unfurl_media": true
|
||||
}
|
||||
},
|
||||
"id": "2e1937a6-4c8f-4cd1-ae42-11b2bd12cc4c",
|
||||
"name": "Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"typeVersion": 2.3,
|
||||
"position": [1040, 360],
|
||||
"webhookId": "04c5e584-45f4-48d0-bcd2-0ecacecb0f53",
|
||||
"credentials": {
|
||||
"slackApi": {
|
||||
"id": "Bg0bWXf8apAimCqJ",
|
||||
"name": "Slack account 2"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "06652908-6b8e-443a-9508-ab229b011b73",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1260, 360]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"ok": true,
|
||||
"channel": "C08514ZPKB8",
|
||||
"message": {
|
||||
"user": "U0362BXQYJW",
|
||||
"type": "message",
|
||||
"ts": "1734322671.726339",
|
||||
"bot_id": "B0382SHFM46",
|
||||
"app_id": "A037UTP0Z39",
|
||||
"text": "test message",
|
||||
"team": "T0364MSFHV2",
|
||||
"bot_profile": {
|
||||
"id": "B0382SHFM46",
|
||||
"app_id": "A037UTP0Z39",
|
||||
"name": "blocks-test",
|
||||
"icons": {
|
||||
"image_36": "https://a.slack-edge.com/80588/img/plugins/app/bot_36.png",
|
||||
"image_48": "https://a.slack-edge.com/80588/img/plugins/app/bot_48.png",
|
||||
"image_72": "https://a.slack-edge.com/80588/img/plugins/app/service_72.png"
|
||||
},
|
||||
"deleted": false,
|
||||
"updated": 1648028754,
|
||||
"team_id": "T0364MSFHV2"
|
||||
},
|
||||
"blocks": [
|
||||
{
|
||||
"type": "rich_text",
|
||||
"block_id": "t02Ox",
|
||||
"elements": [
|
||||
{
|
||||
"type": "rich_text_section",
|
||||
"elements": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "test message"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message_timestamp": "1734322671.726339"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Slack": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "2bc19572-58f0-4cb9-91c3-78b4b3e0cd95",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
|
||||
},
|
||||
"id": "qJdEfiBgYLdfYOTs",
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
const API_RESPONSE = {
|
||||
ok: true,
|
||||
query: 'test in:test-002',
|
||||
messages: {
|
||||
total: 3,
|
||||
pagination: {
|
||||
total_count: 3,
|
||||
page: 1,
|
||||
per_page: 2,
|
||||
page_count: 1,
|
||||
first: 1,
|
||||
last: 3,
|
||||
},
|
||||
paging: {
|
||||
count: 2,
|
||||
total: 3,
|
||||
page: 1,
|
||||
pages: 1,
|
||||
},
|
||||
matches: [
|
||||
{
|
||||
iid: 'a60ff37e-5653-4c53-8a44-783ea4315476',
|
||||
team: 'T0364MSFHV2',
|
||||
score: 0,
|
||||
channel: {
|
||||
id: 'C08514ZPKB8',
|
||||
is_channel: true,
|
||||
is_group: false,
|
||||
is_im: false,
|
||||
is_mpim: false,
|
||||
is_shared: false,
|
||||
is_org_shared: false,
|
||||
is_ext_shared: false,
|
||||
is_private: false,
|
||||
name: 'test-002',
|
||||
pending_shared: [],
|
||||
is_pending_ext_shared: false,
|
||||
},
|
||||
type: 'message',
|
||||
user: 'U0362BXQYJW',
|
||||
username: 'michael.k',
|
||||
ts: '1734322597.935429',
|
||||
blocks: [
|
||||
{
|
||||
type: 'rich_text',
|
||||
block_id: '+bc',
|
||||
elements: [
|
||||
{
|
||||
type: 'rich_text_section',
|
||||
elements: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'test message\n',
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
text: 'Automated with this ',
|
||||
style: {
|
||||
italic: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'link',
|
||||
url: 'http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd',
|
||||
text: 'n8n workflow',
|
||||
style: {
|
||||
italic: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
text: 'test message\n_Automated with this <http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd|n8n workflow>_',
|
||||
permalink: 'https://myspace-qhg7381.slack.com/archives/C08514ZPKB8/p1734322597935429',
|
||||
no_reactions: true,
|
||||
},
|
||||
{
|
||||
iid: '96ee0d2e-1a7d-40bf-b4b2-71ee15f004a8',
|
||||
team: 'T0364MSFHV2',
|
||||
score: 0,
|
||||
channel: {
|
||||
id: 'C08514ZPKB8',
|
||||
is_channel: true,
|
||||
is_group: false,
|
||||
is_im: false,
|
||||
is_mpim: false,
|
||||
is_shared: false,
|
||||
is_org_shared: false,
|
||||
is_ext_shared: false,
|
||||
is_private: false,
|
||||
name: 'test-002',
|
||||
pending_shared: [],
|
||||
is_pending_ext_shared: false,
|
||||
},
|
||||
type: 'message',
|
||||
user: 'U0362BXQYJW',
|
||||
username: 'michael.k',
|
||||
ts: '1734322341.161179',
|
||||
blocks: [
|
||||
{
|
||||
type: 'rich_text',
|
||||
block_id: 'FGAKN',
|
||||
elements: [
|
||||
{
|
||||
type: 'rich_text_section',
|
||||
elements: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'test message\n',
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
text: 'Automated with this ',
|
||||
style: {
|
||||
italic: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'link',
|
||||
url: 'http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd',
|
||||
text: 'n8n workflow',
|
||||
style: {
|
||||
italic: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
text: 'test message\n_Automated with this <http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd|n8n workflow>_',
|
||||
permalink: 'https://myspace-qhg7381.slack.com/archives/C08514ZPKB8/p1734322341161179',
|
||||
no_reactions: true,
|
||||
},
|
||||
{
|
||||
iid: '72f79902-65f7-4bf3-b64b-3fd0b0c3746c',
|
||||
team: 'T0364MSFHV2',
|
||||
score: 0,
|
||||
channel: {
|
||||
id: 'C08514ZPKB8',
|
||||
is_channel: true,
|
||||
is_group: false,
|
||||
is_im: false,
|
||||
is_mpim: false,
|
||||
is_shared: false,
|
||||
is_org_shared: false,
|
||||
is_ext_shared: false,
|
||||
is_private: false,
|
||||
name: 'test-002',
|
||||
pending_shared: [],
|
||||
is_pending_ext_shared: false,
|
||||
},
|
||||
type: 'message',
|
||||
user: 'U0362BXQYJW',
|
||||
username: 'michael.k',
|
||||
ts: '1734321960.507649',
|
||||
blocks: [
|
||||
{
|
||||
type: 'rich_text',
|
||||
block_id: 'fnjm',
|
||||
elements: [
|
||||
{
|
||||
type: 'rich_text_section',
|
||||
elements: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'test message\n',
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
text: 'Automated with this ',
|
||||
style: {
|
||||
italic: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'link',
|
||||
url: 'http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd',
|
||||
text: 'n8n workflow',
|
||||
style: {
|
||||
italic: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
text: 'test message\n_Automated with this <http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd|n8n workflow>_',
|
||||
permalink: 'https://myspace-qhg7381.slack.com/archives/C08514ZPKB8/p1734321960507649',
|
||||
no_reactions: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
describe('Test SlackV2, message => search', () => {
|
||||
nock('https://slack.com')
|
||||
.post('/api/search.messages?query=test%20in%3Atest-002&sort=timestamp&sort_dir=desc&count=2')
|
||||
.reply(200, API_RESPONSE);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['search.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,262 @@
|
||||
{
|
||||
"name": "slack tests",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e679c883-1839-47dc-9511-8f7dc370e6b0",
|
||||
"name": "When clicking ‘Execute workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "search",
|
||||
"query": "test",
|
||||
"limit": 2,
|
||||
"options": {
|
||||
"searchChannel": ["test-002"]
|
||||
}
|
||||
},
|
||||
"id": "2e1937a6-4c8f-4cd1-ae42-11b2bd12cc4c",
|
||||
"name": "Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"typeVersion": 2.3,
|
||||
"position": [1040, 360],
|
||||
"webhookId": "04c5e584-45f4-48d0-bcd2-0ecacecb0f53",
|
||||
"credentials": {
|
||||
"slackApi": {
|
||||
"id": "Bg0bWXf8apAimCqJ",
|
||||
"name": "Slack account 2"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "06652908-6b8e-443a-9508-ab229b011b73",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1260, 360]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"iid": "a60ff37e-5653-4c53-8a44-783ea4315476",
|
||||
"team": "T0364MSFHV2",
|
||||
"score": 0,
|
||||
"channel": {
|
||||
"id": "C08514ZPKB8",
|
||||
"is_channel": true,
|
||||
"is_group": false,
|
||||
"is_im": false,
|
||||
"is_mpim": false,
|
||||
"is_shared": false,
|
||||
"is_org_shared": false,
|
||||
"is_ext_shared": false,
|
||||
"is_private": false,
|
||||
"name": "test-002",
|
||||
"pending_shared": [],
|
||||
"is_pending_ext_shared": false
|
||||
},
|
||||
"type": "message",
|
||||
"user": "U0362BXQYJW",
|
||||
"username": "michael.k",
|
||||
"ts": "1734322597.935429",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "rich_text",
|
||||
"block_id": "+bc",
|
||||
"elements": [
|
||||
{
|
||||
"type": "rich_text_section",
|
||||
"elements": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "test message\n"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Automated with this ",
|
||||
"style": {
|
||||
"italic": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"url": "http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd",
|
||||
"text": "n8n workflow",
|
||||
"style": {
|
||||
"italic": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"text": "test message\n_Automated with this <http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd|n8n workflow>_",
|
||||
"permalink": "https://myspace-qhg7381.slack.com/archives/C08514ZPKB8/p1734322597935429",
|
||||
"no_reactions": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"iid": "96ee0d2e-1a7d-40bf-b4b2-71ee15f004a8",
|
||||
"team": "T0364MSFHV2",
|
||||
"score": 0,
|
||||
"channel": {
|
||||
"id": "C08514ZPKB8",
|
||||
"is_channel": true,
|
||||
"is_group": false,
|
||||
"is_im": false,
|
||||
"is_mpim": false,
|
||||
"is_shared": false,
|
||||
"is_org_shared": false,
|
||||
"is_ext_shared": false,
|
||||
"is_private": false,
|
||||
"name": "test-002",
|
||||
"pending_shared": [],
|
||||
"is_pending_ext_shared": false
|
||||
},
|
||||
"type": "message",
|
||||
"user": "U0362BXQYJW",
|
||||
"username": "michael.k",
|
||||
"ts": "1734322341.161179",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "rich_text",
|
||||
"block_id": "FGAKN",
|
||||
"elements": [
|
||||
{
|
||||
"type": "rich_text_section",
|
||||
"elements": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "test message\n"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Automated with this ",
|
||||
"style": {
|
||||
"italic": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"url": "http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd",
|
||||
"text": "n8n workflow",
|
||||
"style": {
|
||||
"italic": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"text": "test message\n_Automated with this <http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd|n8n workflow>_",
|
||||
"permalink": "https://myspace-qhg7381.slack.com/archives/C08514ZPKB8/p1734322341161179",
|
||||
"no_reactions": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"iid": "72f79902-65f7-4bf3-b64b-3fd0b0c3746c",
|
||||
"team": "T0364MSFHV2",
|
||||
"score": 0,
|
||||
"channel": {
|
||||
"id": "C08514ZPKB8",
|
||||
"is_channel": true,
|
||||
"is_group": false,
|
||||
"is_im": false,
|
||||
"is_mpim": false,
|
||||
"is_shared": false,
|
||||
"is_org_shared": false,
|
||||
"is_ext_shared": false,
|
||||
"is_private": false,
|
||||
"name": "test-002",
|
||||
"pending_shared": [],
|
||||
"is_pending_ext_shared": false
|
||||
},
|
||||
"type": "message",
|
||||
"user": "U0362BXQYJW",
|
||||
"username": "michael.k",
|
||||
"ts": "1734321960.507649",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "rich_text",
|
||||
"block_id": "fnjm",
|
||||
"elements": [
|
||||
{
|
||||
"type": "rich_text_section",
|
||||
"elements": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "test message\n"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Automated with this ",
|
||||
"style": {
|
||||
"italic": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"url": "http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd",
|
||||
"text": "n8n workflow",
|
||||
"style": {
|
||||
"italic": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"text": "test message\n_Automated with this <http://localhost:5678/workflow/qJdEfiBgYLdfYOTs?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.slack_be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd|n8n workflow>_",
|
||||
"permalink": "https://myspace-qhg7381.slack.com/archives/C08514ZPKB8/p1734321960507649",
|
||||
"no_reactions": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Slack": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "0ea58133-0522-40ae-ab51-ec3c1eced057",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
|
||||
},
|
||||
"id": "qJdEfiBgYLdfYOTs",
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
const API_RESPONSE = {
|
||||
ok: true,
|
||||
channel: 'C08514ZPKB8',
|
||||
text: 'updated message',
|
||||
message: {
|
||||
user: 'U0362BXQYJW',
|
||||
type: 'message',
|
||||
edited: {
|
||||
user: 'B0382SHFM46',
|
||||
ts: '1734324905.000000',
|
||||
},
|
||||
bot_id: 'B0382SHFM46',
|
||||
app_id: 'A037UTP0Z39',
|
||||
text: 'updated message',
|
||||
team: 'T0364MSFHV2',
|
||||
bot_profile: {
|
||||
id: 'B0382SHFM46',
|
||||
app_id: 'A037UTP0Z39',
|
||||
name: 'blocks-test',
|
||||
icons: {
|
||||
image_36: 'https://a.slack-edge.com/80588/img/plugins/app/bot_36.png',
|
||||
image_48: 'https://a.slack-edge.com/80588/img/plugins/app/bot_48.png',
|
||||
image_72: 'https://a.slack-edge.com/80588/img/plugins/app/service_72.png',
|
||||
},
|
||||
deleted: false,
|
||||
updated: 1648028754,
|
||||
team_id: 'T0364MSFHV2',
|
||||
},
|
||||
blocks: [
|
||||
{
|
||||
type: 'rich_text',
|
||||
block_id: 'Akc',
|
||||
elements: [
|
||||
{
|
||||
type: 'rich_text_section',
|
||||
elements: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'updated message',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
message_timestamp: '1734321960.507649',
|
||||
};
|
||||
|
||||
describe('Test SlackV2, message => update', () => {
|
||||
nock('https://slack.com')
|
||||
.post('/api/chat.update', {
|
||||
channel: 'C08514ZPKB8',
|
||||
link_names: true,
|
||||
parse: 'none',
|
||||
text: 'updated message',
|
||||
ts: '1734321960.507649',
|
||||
})
|
||||
.reply(200, API_RESPONSE);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['update.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,142 @@
|
||||
{
|
||||
"name": "slack tests",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e679c883-1839-47dc-9511-8f7dc370e6b0",
|
||||
"name": "When clicking ‘Execute workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "update",
|
||||
"channelId": {
|
||||
"__rl": true,
|
||||
"value": "C08514ZPKB8",
|
||||
"mode": "list",
|
||||
"cachedResultName": "test-002"
|
||||
},
|
||||
"ts": 1734321960.507649,
|
||||
"text": "updated message",
|
||||
"updateFields": {
|
||||
"link_names": true,
|
||||
"parse": "none"
|
||||
},
|
||||
"otherOptions": {
|
||||
"includeLinkToWorkflow": false
|
||||
}
|
||||
},
|
||||
"id": "2e1937a6-4c8f-4cd1-ae42-11b2bd12cc4c",
|
||||
"name": "Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"typeVersion": 2.3,
|
||||
"position": [1040, 360],
|
||||
"webhookId": "04c5e584-45f4-48d0-bcd2-0ecacecb0f53",
|
||||
"credentials": {
|
||||
"slackApi": {
|
||||
"id": "Bg0bWXf8apAimCqJ",
|
||||
"name": "Slack account 2"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "06652908-6b8e-443a-9508-ab229b011b73",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1260, 360]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"ok": true,
|
||||
"channel": "C08514ZPKB8",
|
||||
"text": "updated message",
|
||||
"message": {
|
||||
"user": "U0362BXQYJW",
|
||||
"type": "message",
|
||||
"edited": {
|
||||
"user": "B0382SHFM46",
|
||||
"ts": "1734324905.000000"
|
||||
},
|
||||
"bot_id": "B0382SHFM46",
|
||||
"app_id": "A037UTP0Z39",
|
||||
"text": "updated message",
|
||||
"team": "T0364MSFHV2",
|
||||
"bot_profile": {
|
||||
"id": "B0382SHFM46",
|
||||
"app_id": "A037UTP0Z39",
|
||||
"name": "blocks-test",
|
||||
"icons": {
|
||||
"image_36": "https://a.slack-edge.com/80588/img/plugins/app/bot_36.png",
|
||||
"image_48": "https://a.slack-edge.com/80588/img/plugins/app/bot_48.png",
|
||||
"image_72": "https://a.slack-edge.com/80588/img/plugins/app/service_72.png"
|
||||
},
|
||||
"deleted": false,
|
||||
"updated": 1648028754,
|
||||
"team_id": "T0364MSFHV2"
|
||||
},
|
||||
"blocks": [
|
||||
{
|
||||
"type": "rich_text",
|
||||
"block_id": "Akc",
|
||||
"elements": [
|
||||
{
|
||||
"type": "rich_text_section",
|
||||
"elements": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "updated message"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message_timestamp": "1734321960.507649"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Slack": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "27133240-8ff6-4115-b330-9cbc9aa95b25",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
|
||||
},
|
||||
"id": "qJdEfiBgYLdfYOTs",
|
||||
"tags": []
|
||||
}
|
||||
Reference in New Issue
Block a user