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,104 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('GoogleAnalyticsV2', () => {
|
||||
const credentials = {
|
||||
googleAnalyticsOAuth2: {
|
||||
scope: '',
|
||||
oauthTokenData: {
|
||||
access_token: 'ACCESSTOKEN',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
describe('Report Resource - GA4 Get Operation', () => {
|
||||
beforeAll(() => {
|
||||
const mock = nock('https://analyticsdata.googleapis.com');
|
||||
|
||||
mock.post('/v1beta/properties/123456789:runReport').reply(200, {
|
||||
dimensionHeaders: [{ name: 'date' }],
|
||||
metricHeaders: [{ name: 'totalUsers', type: 'TYPE_INTEGER' }],
|
||||
rows: [
|
||||
{
|
||||
dimensionValues: [{ value: '20240101' }],
|
||||
metricValues: [{ value: '100' }],
|
||||
},
|
||||
],
|
||||
rowCount: 1,
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['report-ga4-get.workflow.json'],
|
||||
});
|
||||
});
|
||||
|
||||
describe('Report Resource - Universal Analytics Get Operation', () => {
|
||||
beforeAll(() => {
|
||||
const mock = nock('https://analyticsreporting.googleapis.com');
|
||||
|
||||
mock.post('/v4/reports:batchGet').reply(200, {
|
||||
reports: [
|
||||
{
|
||||
columnHeader: {
|
||||
dimensions: ['ga:date'],
|
||||
metricHeader: {
|
||||
metricHeaderEntries: [
|
||||
{ name: 'ga:users', type: 'INTEGER' },
|
||||
{ name: 'ga:sessions', type: 'INTEGER' },
|
||||
],
|
||||
},
|
||||
},
|
||||
data: {
|
||||
rows: [
|
||||
{
|
||||
dimensions: ['20240101'],
|
||||
metrics: [{ values: ['100', '50'] }],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['report-universal-get.workflow.json'],
|
||||
});
|
||||
});
|
||||
|
||||
describe('UserActivity Resource - Search Operation', () => {
|
||||
beforeAll(() => {
|
||||
const mock = nock('https://analyticsreporting.googleapis.com');
|
||||
|
||||
mock.post('/v4/userActivity:search').reply(200, {
|
||||
sessions: [
|
||||
{
|
||||
sessionId: 'session123',
|
||||
deviceCategory: 'desktop',
|
||||
platform: 'web',
|
||||
dataSource: 'web',
|
||||
activities: [
|
||||
{
|
||||
activityTime: '2024-01-01T10:00:00Z',
|
||||
source: 'web',
|
||||
medium: 'organic',
|
||||
channelGrouping: 'Organic Search',
|
||||
campaign: 'spring_sale',
|
||||
keyword: 'analytics',
|
||||
hostname: 'example.com',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['useractivity-search.workflow.json'],
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "Google Analytics GA4 Report Test Workflow",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "report",
|
||||
"operation": "get",
|
||||
"propertyType": "ga4",
|
||||
"propertyId": {
|
||||
"mode": "id",
|
||||
"value": "123456789"
|
||||
},
|
||||
"dateRange": "last7days",
|
||||
"metricsGA4": {
|
||||
"metricValues": [
|
||||
{
|
||||
"listName": "totalUsers"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dimensionsGA4": {
|
||||
"dimensionValues": [
|
||||
{
|
||||
"listName": "date"
|
||||
}
|
||||
]
|
||||
},
|
||||
"returnAll": false,
|
||||
"limit": 10,
|
||||
"simple": true
|
||||
},
|
||||
"type": "n8n-nodes-base.googleAnalytics",
|
||||
"typeVersion": 2,
|
||||
"position": [200, 0],
|
||||
"id": "ga4-report-node",
|
||||
"name": "GA4 Report",
|
||||
"credentials": {
|
||||
"googleAnalyticsOAuth2": {
|
||||
"id": "ga-oauth-cred-id",
|
||||
"name": "Google Analytics OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"GA4 Report": [
|
||||
{
|
||||
"json": {
|
||||
"date": "20240101",
|
||||
"totalUsers": "100"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "GA4 Report",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"name": "Google Analytics Universal Report Test Workflow",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "report",
|
||||
"operation": "get",
|
||||
"propertyType": "universal",
|
||||
"viewId": {
|
||||
"mode": "id",
|
||||
"value": "123456789"
|
||||
},
|
||||
"dateRange": "last7days",
|
||||
"metricsUA": {
|
||||
"metricValues": [
|
||||
{
|
||||
"listName": "ga:users"
|
||||
},
|
||||
{
|
||||
"listName": "ga:sessions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dimensionsUA": {
|
||||
"dimensionValues": [
|
||||
{
|
||||
"listName": "ga:date"
|
||||
}
|
||||
]
|
||||
},
|
||||
"returnAll": false,
|
||||
"limit": 10
|
||||
},
|
||||
"type": "n8n-nodes-base.googleAnalytics",
|
||||
"typeVersion": 2,
|
||||
"position": [200, 0],
|
||||
"id": "universal-report-node",
|
||||
"name": "Universal Report",
|
||||
"credentials": {
|
||||
"googleAnalyticsOAuth2": {
|
||||
"id": "ga-oauth-cred-id",
|
||||
"name": "Google Analytics OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Universal Report": [
|
||||
{
|
||||
"json": {
|
||||
"ga:date": "20240101",
|
||||
"ga:users": "100",
|
||||
"ga:sessions": "50"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Universal Report",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "Google Analytics UserActivity Search Test Workflow",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "userActivity",
|
||||
"operation": "search",
|
||||
"viewId": "123456789",
|
||||
"userId": "user123",
|
||||
"returnAll": false,
|
||||
"limit": 100,
|
||||
"additionalFields": {
|
||||
"activityTypes": ["PAGEVIEW", "EVENT"]
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleAnalytics",
|
||||
"typeVersion": 2,
|
||||
"position": [200, 0],
|
||||
"id": "useractivity-search-node",
|
||||
"name": "UserActivity Search",
|
||||
"credentials": {
|
||||
"googleAnalyticsOAuth2": {
|
||||
"id": "ga-oauth-cred-id",
|
||||
"name": "Google Analytics OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"UserActivity Search": [
|
||||
{
|
||||
"json": {
|
||||
"sessionId": "session123",
|
||||
"deviceCategory": "desktop",
|
||||
"platform": "web",
|
||||
"dataSource": "web",
|
||||
"activities": [
|
||||
{
|
||||
"activityTime": "2024-01-01T10:00:00Z",
|
||||
"source": "web",
|
||||
"medium": "organic",
|
||||
"channelGrouping": "Organic Search",
|
||||
"campaign": "spring_sale",
|
||||
"keyword": "analytics",
|
||||
"hostname": "example.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "UserActivity Search",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user