cypress-saveLogAndFilter: save filter & no save done.
This commit is contained in:
@@ -49,22 +49,77 @@ describe('Save Log and Filter', ()=>{
|
|||||||
cy.url().should('include', 'files');
|
cy.url().should('include', 'files');
|
||||||
cy.contains('.fileName', 'random-E2Etesting');
|
cy.contains('.fileName', 'random-E2Etesting');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('save filter', () => {
|
||||||
|
// enter log
|
||||||
|
cy.url().should('include', 'files');
|
||||||
|
cy.contains('.fileName', 'random-E2Etesting').dblclick(); // 選取 'random' log 檔
|
||||||
|
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
||||||
|
cy.url().should('include', 'discover/filters'); // 斷言在 discover/logs/:id 路徑
|
||||||
|
cy.wait(3000)
|
||||||
|
|
||||||
|
// Delete All
|
||||||
|
cy.get('#iconFilter').click(); // 選取 Filter sidebar
|
||||||
|
cy.get('#tabFunnel').click();
|
||||||
|
cy.contains('button', 'Delete All').click();
|
||||||
|
|
||||||
|
// select radio
|
||||||
|
cy.get('#tabFilter').click();
|
||||||
|
cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
|
||||||
|
cy.contains('label', 'Have activity(s)') // 選取 Radio 'Have activity(s)'
|
||||||
|
.prev(2)
|
||||||
|
.find('input')
|
||||||
|
.should('have.attr', 'type', 'radio') // select the previous element
|
||||||
|
.should('be.checked'); // confirm it's type radio (optional)
|
||||||
|
|
||||||
|
// select table item
|
||||||
|
cy.get('.allCheckboxAct') // 選取 all select
|
||||||
|
.find('input')
|
||||||
|
.should('not.be.visible').check({ force: true}).should('be.checked'); // 打開隱藏項目並選取
|
||||||
|
|
||||||
|
// click Alpay and click Alppy All
|
||||||
|
cy.contains('button', 'Apply').click();
|
||||||
|
cy.get('#tabFunnel').click();
|
||||||
|
cy.contains('.p-timeline', 'Sequence');
|
||||||
|
cy.contains('button', 'Apply All').click();
|
||||||
|
|
||||||
|
// save filter
|
||||||
|
cy.contains('button', 'Save').click();
|
||||||
|
cy.contains('#swal2-html-container', 'random-E2Etesting');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('no save log', () => {
|
||||||
|
// enter log
|
||||||
|
cy.url().should('include', 'files');
|
||||||
|
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
|
||||||
|
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
||||||
|
cy.url().should('include', 'discover/logs'); // 斷言在 discover/logs/:id 路徑
|
||||||
|
cy.wait(3000)
|
||||||
|
|
||||||
// 進入 fils 頁
|
// select radio
|
||||||
// 點擊 log / 點擊 filter
|
cy.get('#iconFilter').click(); // 選取 Filter sidebar
|
||||||
// 斷言: 編寫程式碼時,我們總是會做出一些假設,斷言就是用於在程式碼中捕捉這些假設。使用時機在該表達式值為真時使用。
|
cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
|
||||||
// 沒有操作
|
cy.contains('label', 'Have activity(s)') // 選取 Radio 'Have activity(s)'
|
||||||
// 有操作沒存檔
|
.prev(2)
|
||||||
// 有操作有存檔
|
.find('input')
|
||||||
// 有操作重複存檔
|
.should('have.attr', 'type', 'radio') // select the previous element
|
||||||
// 有重複操作 沒有存檔
|
.should('be.checked'); // confirm it's type radio (optional)
|
||||||
// Funnle 規則檢查
|
|
||||||
|
|
||||||
// dbclick() 雙擊
|
// select table item
|
||||||
// 多選 單選
|
cy.get('.allCheckboxAct') // 選取 all select
|
||||||
// npx cypress run --spec "cypress/e2e/saveLogAndFilter.cy.js"
|
.find('input')
|
||||||
// 分 無頭模式/瀏覽器介面模式,無頭模式更快,因為不用渲染瀏覽器介面
|
.should('not.be.visible').check({ force: true}).should('be.checked'); // 打開隱藏項目並選取
|
||||||
// 上傳文件
|
|
||||||
// $npm install --save cypress-file-upload
|
// click Alpay and click Alppy All
|
||||||
|
cy.contains('button', 'Apply').click();
|
||||||
|
cy.get('#tabFunnel').click();
|
||||||
|
cy.contains('.p-timeline', 'Sequence');
|
||||||
|
cy.contains('button', 'Apply All').click();
|
||||||
|
cy.wait(3000)
|
||||||
|
|
||||||
|
cy.get('#backPage').click();
|
||||||
|
cy.contains('.swal2-title', 'LEAVE MAP');
|
||||||
|
cy.contains('button', 'OK').click();
|
||||||
|
cy.url().should('include', 'files');
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user