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 --
|
// -- This is a parent command --
|
||||||
import '@4tw/cypress-drag-drop'
|
import '@4tw/cypress-drag-drop'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets authentication cookies to simulate a logged-in user.
|
||||||
|
*
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
Cypress.Commands.add('login', () => {
|
Cypress.Commands.add('login', () => {
|
||||||
cy.setCookie('luciaToken', 'fake-access-token-for-testing');
|
cy.setCookie('luciaToken', 'fake-access-token-for-testing');
|
||||||
cy.setCookie('isLuciaLoggedIn', 'true');
|
cy.setCookie('isLuciaLoggedIn', 'true');
|
||||||
});
|
});
|
||||||
// 呼叫方式: cy.login()
|
// Usage: cy.login()
|
||||||
// -- This is a child command --
|
// -- 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', () => {
|
Cypress.Commands.add('closePopup', () => {
|
||||||
// 點擊 body 以外的區域,使用 force: true 強制觸發點擊
|
// Trigger a forced click to close modal overlays consistently.
|
||||||
cy.get('body').click({ position: 'topLeft'});
|
cy.get('body').click({ position: 'topLeft'});
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -27,4 +27,4 @@ Cypress.on('uncaught:exception', (err, runnable) => {
|
|||||||
|
|
||||||
// Alternatively you can use CommonJS syntax:
|
// Alternatively you can use CommonJS syntax:
|
||||||
// require('./commands')
|
// require('./commands')
|
||||||
require('cypress-xpath') // 順利執行.trigger('mouseup')
|
require('cypress-xpath') // Enables xpath helpers used in pointer event checks.
|
||||||
|
|||||||
Reference in New Issue
Block a user