Rewrite old E2E tests to use fixture-based API mocking, eliminating need for real credentials

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 00:31:16 +08:00
parent dc0a98f819
commit 905f546227
12 changed files with 371 additions and 458 deletions

View File

@@ -10,22 +10,9 @@
// -- This is a parent command --
import '@4tw/cypress-drag-drop'
const loginApiUrl = Cypress.env('loginApiUrl');
Cypress.Commands.add('login', () => {
cy.request({
method: 'POST',
url: loginApiUrl,
form: true,
body: {
username: Cypress.env('user').username,
password: Cypress.env('user').password,
grant_type: 'password',
}
}).then(response => {
const token = response.body.access_token;
cy.setCookie('luciaToken', token);
})
cy.setCookie('luciaToken', 'fake-access-token-for-testing');
cy.setCookie('isLuciaLoggedIn', 'true');
});
// 呼叫方式: cy.login()
// -- This is a child command --