Translate Cypress support comments and add command JSDoc
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
@@ -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);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user