- Replace single-file 8441-line HTML with Vue 3 SPA - Pinia stores: auth, oils, recipes, diary, ui - Composables: useApi, useDialog, useSmartPaste, useOilTranslation - 6 shared components: RecipeCard, RecipeDetailOverlay, TagPicker, etc. - 9 page views: RecipeSearch, RecipeManager, Inventory, OilReference, etc. - 14 Cypress E2E test specs (113 tests), all passing - Multi-stage Dockerfile (Node build + Python runtime) - Demo video generation scripts (TTS + subtitles + screen recording) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
describe('Admin Flow', () => {
|
|
beforeEach(() => {
|
|
const token = Cypress.env('ADMIN_TOKEN')
|
|
if (!token) {
|
|
cy.log('ADMIN_TOKEN not set, skipping admin tests')
|
|
return
|
|
}
|
|
cy.visit('/', {
|
|
onBeforeLoad(win) {
|
|
win.localStorage.setItem('oil_auth_token', token)
|
|
}
|
|
})
|
|
// Wait for app to load with admin privileges
|
|
cy.get('.nav-tab', { timeout: 10000 }).should('have.length.gte', 6)
|
|
})
|
|
|
|
it('shows admin-only tabs', () => {
|
|
if (!Cypress.env('ADMIN_TOKEN')) return
|
|
cy.get('.nav-tab').contains('操作日志').should('be.visible')
|
|
cy.get('.nav-tab').contains('Bug').should('be.visible')
|
|
cy.get('.nav-tab').contains('用户管理').should('be.visible')
|
|
})
|
|
|
|
it('can access manage recipes page', () => {
|
|
if (!Cypress.env('ADMIN_TOKEN')) return
|
|
cy.get('.nav-tab').contains('管理配方').click()
|
|
cy.url().should('include', '/manage')
|
|
})
|
|
|
|
it('can access audit log page', () => {
|
|
if (!Cypress.env('ADMIN_TOKEN')) return
|
|
cy.get('.nav-tab').contains('操作日志').click()
|
|
cy.url().should('include', '/audit')
|
|
cy.contains('操作日志').should('be.visible')
|
|
})
|
|
|
|
it('can access user management page', () => {
|
|
if (!Cypress.env('ADMIN_TOKEN')) return
|
|
cy.get('.nav-tab').contains('用户管理').click()
|
|
cy.url().should('include', '/users')
|
|
cy.contains('用户管理').should('be.visible')
|
|
})
|
|
|
|
it('can access bug tracker page', () => {
|
|
if (!Cypress.env('ADMIN_TOKEN')) return
|
|
cy.get('.nav-tab').contains('Bug').click()
|
|
cy.url().should('include', '/bugs')
|
|
cy.contains('Bug').should('be.visible')
|
|
})
|
|
})
|