describe('Oil Reference Smart Paste', () => { let adminToken before(() => { cy.getAdminToken().then(token => { adminToken = token }) }) beforeEach(() => { cy.visit('/oils', { onBeforeLoad(win) { win.localStorage.setItem('oil_auth_token', adminToken) } }) cy.get('.oil-chip, .oils-grid', { timeout: 10000 }).should('exist') }) it('smart paste fills product form fields', () => { cy.contains('button', '+ 新增').click() cy.contains('button', '🪄 智能识别').click() const sample = [ '优惠顾客价:¥310PT:41', '', '零售价:¥465', '', '点数:37 规格:100毫升', '', '花样年华焕颜精华水 Salubelle Rejuvenating Essence', ].join('\n') cy.get('textarea').type(sample, { parseSpecialCharSequences: false, delay: 0 }) cy.contains('button', '识别并填入').click() cy.get('.add-type-tab.active').should('contain', '其他') cy.get('input[placeholder="产品名称"]').should('have.value', '花样年华焕颜精华水') cy.get('input[placeholder="英文名"]').should('have.value', 'Salubelle Rejuvenating Essence') cy.get('input[placeholder="会员价 ¥"]').should('have.value', '310') cy.get('input[placeholder="零售价 ¥"]').should('have.value', '465') cy.get('input[placeholder="容量"]').should('have.value', '100') }) it('smart paste detects standard ml volume as essential oil', () => { cy.contains('button', '+ 新增').click() cy.contains('button', '🪄 智能识别').click() const sample = '会员价:¥200\n零售价:¥267\n规格:15毫升\n薰衣草测试 LavenderTest' cy.get('textarea').type(sample, { parseSpecialCharSequences: false, delay: 0 }) cy.contains('button', '识别并填入').click() cy.get('.add-type-tab.active').should('contain', '精油') cy.get('input[placeholder="精油名称"]').should('have.value', '薰衣草测试') }) })