From 7c48faaa3dcae4505731a938896ce03db6e5d9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 8 Mar 2026 11:57:58 +0800 Subject: [PATCH] Translate Cypress support comments and add command JSDoc Co-Authored-By: Codex --- cypress/support/commands.js | 16 +++++++++++++--- cypress/support/e2e.js | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index f93cdfb..791df0b 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -16,15 +16,25 @@ // -- This is a parent command -- import '@4tw/cypress-drag-drop' +/** + * Sets authentication cookies to simulate a logged-in user. + * + * @returns {void} + */ Cypress.Commands.add('login', () => { cy.setCookie('luciaToken', 'fake-access-token-for-testing'); cy.setCookie('isLuciaLoggedIn', 'true'); }); -// 呼叫方式: cy.login() +// Usage: cy.login() // -- This is a child command -- -// 點擊空白區關閉 Modal,cy.closePopup() +// Click a blank area to close an opened modal: cy.closePopup() +/** + * Closes the active popup by clicking the top-left area of the page. + * + * @returns {void} + */ Cypress.Commands.add('closePopup', () => { - // 點擊 body 以外的區域,使用 force: true 強制觸發點擊 + // Trigger a forced click to close modal overlays consistently. cy.get('body').click({ position: 'topLeft'}); cy.wait(1000); }) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index 45bc455..549bc56 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -27,4 +27,4 @@ Cypress.on('uncaught:exception', (err, runnable) => { // Alternatively you can use CommonJS syntax: // require('./commands') -require('cypress-xpath') // 順利執行.trigger('mouseup') +require('cypress-xpath') // Enables xpath helpers used in pointer event checks.