{
  "stats": {
    "suites": 1,
    "tests": 1,
    "passes": 0,
    "pending": 0,
    "failures": 1,
    "start": "2025-11-08T20:15:45.658Z",
    "end": "2025-11-08T20:15:45.964Z",
    "duration": 306,
    "testsRegistered": 1,
    "passPercent": 0,
    "pendingPercent": 0,
    "other": 0,
    "hasOther": false,
    "skipped": 0,
    "hasSkipped": false
  },
  "results": [
    {
      "uuid": "7def9fd5-0897-49eb-8dd7-dad66cae5ea2",
      "title": "",
      "fullFile": "cypress\\e2e\\quotes_create_and_invite.cy.js",
      "file": "cypress\\e2e\\quotes_create_and_invite.cy.js",
      "beforeHooks": [],
      "afterHooks": [],
      "tests": [],
      "suites": [
        {
          "uuid": "858203b7-57b8-4704-b787-4211e2c2211c",
          "title": "Fluxo de criação de cotação e envio de convite",
          "fullFile": "",
          "file": "",
          "beforeHooks": [],
          "afterHooks": [],
          "tests": [
            {
              "title": "Preenche, cria cotação, envia convite e valida e-mail",
              "fullTitle": "Fluxo de criação de cotação e envio de convite Preenche, cria cotação, envia convite e valida e-mail",
              "timedOut": null,
              "duration": 209,
              "state": "failed",
              "speed": null,
              "pass": false,
              "fail": true,
              "pending": false,
              "context": null,
              "code": "// Login como admin padrão\ncy.login('admin@local', 'admin123');\n// Seed: fornecedor com e-mail desejado e produto\nlet supplier;\nlet product;\nlet quoteId;\ncy.seedSupplier({\n  name: 'Fornecedor Cypress QA',\n  email: supplierEmail\n}).then(s => {\n  supplier = s;\n});\ncy.seedProduct({\n  codigo: 'CYP-ITEM-001',\n  nome: 'Item Cypress QA',\n  preco: 42.9\n}).then(p => {\n  product = p;\n});\n// Abrir tela e modal\ncy.visit('/compras/cotacoes');\ncy.contains('button', 'Nova Cotação').should('be.visible').click();\ncy.get('#modal-new-quote').should('be.visible');\n// Preencher fornecedor principal\ncy.get('#newQuoteSupplier').should('be.visible').select(String(supplier.id));\n// Preencher campos gerais\nconst validade = new Date(Date.now() + 5 * 24 * 3600 * 1000).toISOString().slice(0, 10);\ncy.get('#newQuoteValidUntil').clear().type(validade);\ncy.get('#newQuoteStatus').select('open');\ncy.get('#fieldEmpresa').clear().type(campos.empresa);\ncy.get('#fieldDeposito').clear().type(campos.deposito);\ncy.get('#fieldFormaPg').clear().type(campos.formaPg);\ncy.get('#fieldDescricao').clear().type(campos.descricao);\ncy.get('#fieldRespEmail').clear().type(solicitante.email);\ncy.get('#fieldRespNome').clear().type(solicitante.nome);\ncy.get('#fieldRespTel').clear().type(solicitante.tel);\n// Adicionar item cotado (descrição via nome do produto, quantidade e specs técnicas implícitas no campo descrição)\ncy.get('#prodSearch').clear().type(product.nome);\ncy.get('#prodQty').clear().type('3');\ncy.get('#btnAddItem').click();\ncy.get('#newQuoteItems tr').should('have.length', 1);\n// Observações\ncy.get('#fieldObs').clear().type(campos.obs);\n// Criar cotação e capturar ID\ncy.intercept('POST', '/api/compras/cotacoes').as('createQuote');\ncy.get('#form-new-quote').submit();\ncy.wait('@createQuote').then(({\n  response\n}) => {\n  var _response$body;\n  expect(response.statusCode).to.be.oneOf([200, 201]);\n  quoteId = response === null || response === void 0 || (_response$body = response.body) === null || _response$body === void 0 || (_response$body = _response$body.data) === null || _response$body === void 0 ? void 0 : _response$body.id;\n  expect(quoteId, 'quote id').to.be.a('number').and.gt(0);\n});\n// Validar que listagem exibe a cotação\ncy.get('#tbl').should('be.visible');\ncy.get('#rows').contains('td', String(supplier.id)).should('exist');\n// Enviar convite ao fornecedor via botão da listagem\ncy.intercept('POST', `/api/compras/cotacoes/${quoteId}/enviar-convite`).as('sendInvite');\ncy.get(`#rows tr`).contains('td', String(quoteId)).parent().find('button[data-action=\"invite\"]').click();\ncy.wait('@sendInvite').its('response.statusCode').should('eq', 200);\ncy.get('#feedback').should('contain.text', 'Convite enviado');\n// Validar e-mail armazenado (.eml)\ncy.task('findEmailByRecipient', supplierEmail).then(eml => {\n  expect(eml, 'email .eml encontrado').to.not.be.null;\n  const content = eml.content || '';\n  expect(content).to.include(`To: ${supplierEmail}`);\n  expect(content).to.include(`Subject: Convite para responder cotação #${quoteId}`);\n  expect(content).to.include('/cotacoes/responder?token=');\n});\n// Validar persistência dos dados da cotação (metadata e itens)\ncy.wrap(null).then(() => {\n  return Cypress._.noop(), null;\n});\ncy.getCookie('auth_token').then(c => {\n  const headers = {\n    Authorization: `Bearer ${c.value}`,\n    'x-tenant-id': 'default'\n  };\n  cy.request({\n    method: 'GET',\n    url: `/api/compras/cotacoes/${quoteId}`,\n    headers\n  }).then(resp => {\n    var _resp$body;\n    expect(resp.status).to.eq(200);\n    const data = ((_resp$body = resp.body) === null || _resp$body === void 0 ? void 0 : _resp$body.data) || {};\n    const md = (data === null || data === void 0 ? void 0 : data.metadata) || {};\n    expect(md.responsavel_nome).to.eq(solicitante.nome);\n    expect(md.responsavel_email).to.eq(solicitante.email);\n    expect(md.responsavel_telefone).to.eq(solicitante.tel);\n    expect(md.forma_pagamento).to.eq(campos.formaPg);\n    expect(md.descricao).to.eq(campos.descricao);\n    expect(md.observacoes).to.eq(campos.obs);\n    const items = data.items || [];\n    expect(items.length).to.be.greaterThan(0);\n  });\n});",
              "err": {
                "message": "CypressError: `cy.task('clearEmails')` failed with the following error:\n\nThe 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task()\n\nFix this in your setupNodeEvents method here:\nC:\\Users\\Usuário.DESKTOP-FIEHKTG\\Documents\\trae_projects\\gestoreasy v3\\cypress.config.js\n\nhttps://on.cypress.io/api/task\n\nBecause this error occurred during a `before all` hook we are skipping the remaining tests in the current suite: `Fluxo de criação de cotação...`",
                "estack": "CypressError: `cy.task('clearEmails')` failed with the following error:\n\nThe 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task()\n\nFix this in your setupNodeEvents method here:\nC:\\Users\\Usuário.DESKTOP-FIEHKTG\\Documents\\trae_projects\\gestoreasy v3\\cypress.config.js\n\nhttps://on.cypress.io/api/task\n\nBecause this error occurred during a `before all` hook we are skipping the remaining tests in the current suite: `Fluxo de criação de cotação...`\n    at <unknown> (http://localhost:8002/__cypress/runner/cypress_runner.js:135115:72)\n    at tryCatcher (http://localhost:8002/__cypress/runner/cypress_runner.js:1830:23)\n    at Promise._settlePromiseFromHandler (http://localhost:8002/__cypress/runner/cypress_runner.js:1542:31)\n    at Promise._settlePromise (http://localhost:8002/__cypress/runner/cypress_runner.js:1599:18)\n    at Promise._settlePromise0 (http://localhost:8002/__cypress/runner/cypress_runner.js:1644:10)\n    at Promise._settlePromises (http://localhost:8002/__cypress/runner/cypress_runner.js:1720:18)\n    at _drainQueueStep (http://localhost:8002/__cypress/runner/cypress_runner.js:2430:12)\n    at _drainQueue (http://localhost:8002/__cypress/runner/cypress_runner.js:2423:9)\n    at Async._drainQueues (http://localhost:8002/__cypress/runner/cypress_runner.js:2439:5)\n    at Async.drainQueues (http://localhost:8002/__cypress/runner/cypress_runner.js:2309:14)\nFrom Your Spec Code:\n    at Context.eval (webpack://gestoreasy-v3/./cypress/e2e/quotes_create_and_invite.cy.js:17:7)",
                "diff": null
              },
              "uuid": "5dfb5e71-f500-4878-bc4b-9454ff7a7b3b",
              "parentUUID": "858203b7-57b8-4704-b787-4211e2c2211c",
              "isHook": false,
              "skipped": false
            }
          ],
          "suites": [],
          "passes": [],
          "failures": [
            "5dfb5e71-f500-4878-bc4b-9454ff7a7b3b"
          ],
          "pending": [],
          "skipped": [],
          "duration": 209,
          "root": false,
          "rootEmpty": false,
          "_timeout": 2000
        }
      ],
      "passes": [],
      "failures": [],
      "pending": [],
      "skipped": [],
      "duration": 0,
      "root": true,
      "rootEmpty": true,
      "_timeout": 2000
    }
  ],
  "meta": {
    "mocha": {
      "version": "7.0.1"
    },
    "mochawesome": {
      "options": {
        "quiet": true,
        "reportFilename": "mochawesome",
        "saveHtml": true,
        "saveJson": true,
        "consoleReporter": "spec",
        "useInlineDiffs": false,
        "code": true
      },
      "version": "7.1.4"
    },
    "marge": {
      "options": {
        "id": "default",
        "reportDir": "cypress/reports/mochawesome",
        "overwrite": false,
        "html": true,
        "json": true,
        "quiet": true
      },
      "version": "6.3.2"
    }
  }
}