diff --git a/cypress/e2e/performance.cy.js b/cypress/e2e/performance.cy.js index 3ca3047..2aa497e 100644 --- a/cypress/e2e/performance.cy.js +++ b/cypress/e2e/performance.cy.js @@ -4,7 +4,7 @@ describe('Performance', ()=>{ cy.login(); cy.visit('https://REDACTED-HOST/files'); }); - // Anchor + // it('Enter Log', () => { // // enter Map // cy.url().should('include', 'files'); @@ -39,20 +39,44 @@ describe('Performance', ()=>{ // cy.get('canvas').should('have.length', 8); // }); - it('Enter Rule', () => { + // it('Enter Rule', () => { + // // enter Map + // cy.url().should('include', 'files'); + // cy.get('table tr') + // .filter(':contains("Rule")') + // .first() + // .dblclick(); + // cy.contains('h2', 'DISCOVER'); + // cy.url().should('include', 'conformance'); + // cy.wait(2000); + // // enter Performance + // cy.contains('li', 'PERFORMANCE').click(); + // cy.url().should('include', 'discover/performance'); + // // 斷言頁面中有八個 canvas 元素 + // cy.get('canvas').should('have.length', 8); + // }); + + it('Anchor', () => { // enter Map cy.url().should('include', 'files'); cy.get('table tr') - .filter(':contains("Rule")') - .first() + .filter(':contains("Log")') + .first() // 選擇集合中第一個元素 .dblclick(); cy.contains('h2', 'DISCOVER'); - cy.url().should('include', 'conformance'); + cy.url().should('include', 'discover/map/log'); cy.wait(2000); // enter Performance cy.contains('li', 'PERFORMANCE').click(); - cy.url().should('include', 'discover/performance'); - // 斷言頁面中有八個 canvas 元素 - cy.get('canvas').should('have.length', 8); + cy.url().should('include', 'discover/performance/log'); + // Anchor 網頁不會捲動到錨點位置是因為 Cypress 是模擬使用者行為而非準確瀏覽器行為 + cy.get('aside li a[href="#cycleTime"]').click(); + cy.url().should('include', '#cycleTime'); + cy.get('aside li a[href="#processingTime"]').click(); + cy.url().should('include', '#processingTime'); + cy.get('aside li a[href="#waitingTime"]').click(); + cy.url().should('include', '#waitingTime'); + cy.get('aside li a[href="#cases"]').click(); + cy.url().should('include', '#cases'); }); })