fix: 搜索过滤、拼音匹配、清除图片、滑动切换、通知已读 #18
@@ -1,9 +1,11 @@
|
||||
// Helper: dismiss any CustomDialog that may appear (e.g. API errors in CI)
|
||||
function dismissDialog() {
|
||||
// Helper: dismiss any modal that may cover the detail overlay (login modal, error dialog)
|
||||
function dismissModals() {
|
||||
cy.get('body').then($body => {
|
||||
if ($body.find('.login-overlay').length) {
|
||||
cy.get('.login-overlay').click('topLeft') // click backdrop to close
|
||||
}
|
||||
if ($body.find('.dialog-overlay').length) {
|
||||
cy.get('.dialog-btn-primary').click()
|
||||
cy.get('.dialog-overlay').should('not.exist')
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -12,44 +14,44 @@ describe('Recipe Detail', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/')
|
||||
cy.get('.recipe-card', { timeout: 10000 }).should('have.length.gte', 1)
|
||||
dismissDialog()
|
||||
dismissModals()
|
||||
})
|
||||
|
||||
it('opens detail panel when clicking a recipe card', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
cy.get('.detail-overlay').should('be.visible')
|
||||
dismissModals()
|
||||
cy.get('.detail-overlay').should('exist')
|
||||
})
|
||||
|
||||
it('shows recipe name in detail view', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
cy.get('.detail-overlay').should('be.visible')
|
||||
dismissModals()
|
||||
cy.get('.detail-overlay').should('exist')
|
||||
})
|
||||
|
||||
it('shows ingredient info with drops', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
dismissModals()
|
||||
cy.contains('滴').should('exist')
|
||||
})
|
||||
|
||||
it('shows cost with ¥ symbol', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
dismissModals()
|
||||
cy.contains('¥').should('exist')
|
||||
})
|
||||
|
||||
it('closes detail panel when clicking close button', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
cy.get('.detail-overlay').should('be.visible')
|
||||
dismissModals()
|
||||
cy.get('.detail-overlay').should('exist')
|
||||
cy.get('button').contains(/✕|关闭/).first().click()
|
||||
cy.get('.recipe-card').should('be.visible')
|
||||
})
|
||||
|
||||
it('shows action buttons in detail', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
dismissModals()
|
||||
cy.get('.detail-overlay button').should('have.length.gte', 1)
|
||||
})
|
||||
|
||||
@@ -68,13 +70,13 @@ describe('Recipe Detail - Editor (Admin)', () => {
|
||||
}
|
||||
})
|
||||
cy.get('.recipe-card', { timeout: 10000 }).should('have.length.gte', 1)
|
||||
dismissDialog()
|
||||
dismissModals()
|
||||
})
|
||||
|
||||
it('shows editable ingredients table in editor tab', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
cy.get('.detail-overlay', { timeout: 5000 }).should('be.visible')
|
||||
dismissModals()
|
||||
cy.get('.detail-overlay', { timeout: 5000 }).should('exist')
|
||||
cy.get('.detail-overlay').then($el => {
|
||||
if ($el.find(':contains("编辑")').filter('button').length) {
|
||||
cy.contains('编辑').click()
|
||||
@@ -87,8 +89,8 @@ describe('Recipe Detail - Editor (Admin)', () => {
|
||||
|
||||
it('shows add ingredient button in editor tab', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
cy.get('.detail-overlay', { timeout: 5000 }).should('be.visible')
|
||||
dismissModals()
|
||||
cy.get('.detail-overlay', { timeout: 5000 }).should('exist')
|
||||
cy.get('.detail-overlay').then($el => {
|
||||
if ($el.find(':contains("编辑")').filter('button').length) {
|
||||
cy.contains('编辑').click()
|
||||
@@ -101,8 +103,8 @@ describe('Recipe Detail - Editor (Admin)', () => {
|
||||
|
||||
it('shows save image button', () => {
|
||||
cy.get('.recipe-card').first().click()
|
||||
dismissDialog()
|
||||
cy.get('.detail-overlay', { timeout: 5000 }).should('be.visible')
|
||||
dismissModals()
|
||||
cy.get('.detail-overlay', { timeout: 5000 }).should('exist')
|
||||
cy.contains('保存图片').should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user