8
n8n 中文网amn8n.com

使用GPT-4从Figma设计生成QA测试用例到Google Sheets

中级

这是一个Engineering, AI Summarization领域的自动化工作流,包含 14 个节点。主要使用 Code, HttpRequest, GoogleSheets, ManualTrigger, Agent 等节点。 使用GPT-4o-mini从Figma设计生成QA测试用例到Google Sheets

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "gILrUPCbGHiFohxP",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 GPT-4 从 Figma 设计生成 QA 测试用例到 Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "dc0b7549-a744-4aa6-9d81-6570eae6acdb",
      "name": "工作流概览",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1616,
        -320
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 540,
        "content": "## 🎨 Figma 到测试用例生成器"
      },
      "typeVersion": 1
    },
    {
      "id": "ef9db14b-34a0-497f-82c4-e0eb0d0fc498",
      "name": "设置指南",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -560
      ],
      "parameters": {
        "color": 2,
        "width": 360,
        "height": 500,
        "content": "## ⚙️ 设置说明"
      },
      "typeVersion": 1
    },
    {
      "id": "39541f14-cfd3-4c11-89b9-8e6aedc363fc",
      "name": "Figma API 说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -480
      ],
      "parameters": {
        "color": 2,
        "width": 300,
        "height": 428,
        "content": "## 📌 Figma API 配置"
      },
      "typeVersion": 1
    },
    {
      "id": "b24caffc-87cf-458e-aecb-bf00ca9309be",
      "name": "AI 处理详情",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -448
      ],
      "parameters": {
        "color": 2,
        "width": 280,
        "height": 368,
        "content": "## 🤖 AI 测试生成"
      },
      "typeVersion": 1
    },
    {
      "id": "be300909-97ca-4d0c-b7f5-077cddc16f8f",
      "name": "代码逻辑详情",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        96
      ],
      "parameters": {
        "color": 2,
        "width": 280,
        "height": 260,
        "content": "## 📊 数据提取"
      },
      "typeVersion": 1
    },
    {
      "id": "8aee5f1a-9b28-4951-a8c1-3438119266e9",
      "name": "Sheets 配置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -560
      ],
      "parameters": {
        "color": 2,
        "width": 300,
        "height": 476,
        "content": "## 📝 Google Sheets 导出"
      },
      "typeVersion": 1
    },
    {
      "id": "f2dee891-a0a2-4426-9f3e-b818a11b1e40",
      "name": "手动启动",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -960,
        -48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a5cb1f68-d567-46f3-8aea-b462cede73c9",
      "name": "获取 Figma 设计数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -736,
        -48
      ],
      "parameters": {
        "url": "=https://api.figma.com/v1/files/{{ $json.figmaFileId }}",
        "options": {
          "timeout": 30000,
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "json"
            }
          }
        },
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "depth",
              "value": "1"
            },
            {
              "name": "geometry",
              "value": "paths"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "VzF0MtEE87bk9mIH",
          "name": "Figma token"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "96587a6a-4e70-4c6d-a9a8-a1da7e87e7a4",
      "name": "OpenAI GPT-4o-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -512,
        192
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {
          "maxTokens": 4000,
          "temperature": 0.7
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "5Kzt6hGSZ1JHZqWN",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1b3d7d55-f24f-4d95-a098-7128696e7e87",
      "name": "解析和格式化测试用例",
      "type": "n8n-nodes-base.code",
      "position": [
        -48,
        -48
      ],
      "parameters": {
        "jsCode": "// Extract test cases from AI agent output\nconst aiOutput = $json.output;\n\n// Safely extract test cases array\nconst testCases = aiOutput?.test_cases || [];\n\n// Validate and map to Google Sheets format\nif (!Array.isArray(testCases) || testCases.length === 0) {\n  console.log('No test cases generated');\n  return [];\n}\n\n// Transform to structured output\nreturn testCases.map(tc => ({\n  json: {\n    title: tc.title || 'Untitled Test Case',\n    steps: tc.steps || 'No steps provided'\n  }\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "1efaa8c3-a934-4702-9783-7da965178a27",
      "name": "导出到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        176,
        -48
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "steps",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "steps",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": []
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Test Cases"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Configure Figma File ID').item.json.googleSheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "f3e20439-3b50-414a-a67f-2dd3d0324365",
      "name": "JSON 输出模式",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -256,
        192
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"test_cases\": [\n    {\n      \"title\": \"Test case title\",\n      \"steps\": \"Step 1: Action\\nStep 2: Verification\\nStep 3: Expected result\"\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "52e4bce6-4656-4658-833a-1d461fb743e5",
      "name": "对话记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -384,
        192
      ],
      "parameters": {
        "sessionKey": "=\"figma_test_generation_\" & $('Configure Figma File ID').item.json.figmaFileId",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0a245b2b-7d42-4dc4-9393-f07af71321f6",
      "name": "AI 测试用例生成器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -464,
        -48
      ],
      "parameters": {
        "text": "=Here is the Figma design data:\n\n{{ JSON.stringify($json, null, 2) }}\n\n**Generate 5-10 comprehensive test cases covering:**\n\n1. **UI Elements & Interactions**\n   - Button states and actions\n   - Form field validations\n   - Navigation flows\n\n2. **User Flows**\n   - Primary user journeys\n   - Alternative paths\n   - Error scenarios\n\n3. **Edge Cases**\n   - Empty states\n   - Maximum character limits\n   - Invalid inputs\n\n4. **Accessibility**\n   - Keyboard navigation\n   - Screen reader compatibility\n   - Color contrast (WCAG 2.1 AA)\n\n5. **Responsive Design**\n   - Mobile viewport behavior\n   - Tablet adjustments\n   - Desktop optimization\n\n**Return ONLY valid JSON in this exact structure:**\n\n```json\n{\n  \"test_cases\": [\n    {\n      \"title\": \"Descriptive test case title\",\n      \"steps\": \"Step 1: Detailed action\\nStep 2: Expected behavior\\nStep 3: Verification criteria\"\n    }\n  ]\n}\n```\n\n**Important:** Ensure each test case has clear, actionable steps.",
        "options": {
          "systemMessage": "You are an expert QA engineer and UX analyst specializing in test case generation.\n\n**Your expertise includes:**\n- Analyzing Figma design files and extracting testable elements\n- Creating comprehensive test scenarios for web and mobile applications\n- Identifying edge cases and accessibility requirements\n- Following industry-standard QA practices (ISTQB, Agile QA)\n\n**Your task:**\nReceive Figma file data as JSON and generate detailed, actionable test cases that cover:\n- Functional requirements\n- User experience flows\n- Accessibility compliance (WCAG 2.1)\n- Cross-browser/device compatibility\n- Edge cases and error handling\n\n**Output requirements:**\n- Return ONLY valid JSON matching the provided schema\n- Each test case must have a clear title and numbered steps\n- Steps should be specific, measurable, and executable\n- Include expected results in each step\n- Prioritize critical user paths first"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "00a00b80-93a1-44c8-be7b-3cd1f78686fb",
  "connections": {
    "Manual Start": {
      "main": [
        [
          {
            "node": "Fetch Figma Design Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JSON Output Schema": {
      "ai_outputParser": [
        [
          {
            "node": "AI Test Case Generator",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI GPT-4o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "AI Test Case Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Test Case Generator",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Test Case Generator": {
      "main": [
        [
          {
            "node": "Parse and Format Test Cases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Figma Design Data": {
      "main": [
        [
          {
            "node": "AI Test Case Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse and Format Test Cases": {
      "main": [
        [
          {
            "node": "Export to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 工程, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量14
分类2
节点类型9
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Rahul Joshi

Rahul Joshi

@rahul08

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

外部链接
在 n8n.io 查看

分享此工作流