test: update E2E testing.

This commit is contained in:
chiayin
2023-12-15 12:26:32 +08:00
parent 90610c173f
commit cd2ab42125
3 changed files with 43 additions and 36 deletions

View File

@@ -8,10 +8,14 @@ describe('Save Log and Filter', ()=>{
// enter log
cy.url().should('include', 'files');
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
// cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
cy.get('table tr')
.filter(':contains("Log")') // 選擇 type Log
.filter(':contains("random")') // 選擇 random log 檔
.dblclick(); // 對選中的 tr 執行雙擊
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
cy.url().should('include', 'discover/map/log'); // 斷言在 discover/map/log/:id 路徑
cy.wait(3000)
cy.wait(2000)
cy.get('#iconFilter').click(); // 選取 Filter sidebar
});
@@ -25,9 +29,8 @@ describe('Save Log and Filter', ()=>{
.should('be.checked'); // confirm it's type radio (optional)
// No selected.
cy.contains('button', 'Apply').click();
cy.get('.v-toast__text').should('contain', 'Not selected');
cy.wait(3000);
cy.contains('button', 'Apply').should('be.disabled'); // 斷言按鈕為禁用狀態
cy.wait(2000);
// Clear selected item.
cy.get('.allCheckboxAct') // 選取 all select
@@ -38,14 +41,14 @@ describe('Save Log and Filter', ()=>{
.find('input')
.should('not.be.visible')
.should('not.be.checked')
cy.wait(3000);
cy.wait(2000);
// selected item
cy.get('table tr:nth-child(2) input[type="checkbox"]').check({force: true});
cy.contains('button', 'Apply').click();
cy.get('#tabFunnel').click();
cy.contains('p', 'Sequence');
cy.contains('span', 'Include');
cy.contains('span', 'include');
cy.contains('button', 'Apply All').click();
// make sure create map again.
@@ -68,22 +71,21 @@ describe('Save Log and Filter', ()=>{
.should('be.checked'); // confirm it's type radio (optional)
// No selected.
cy.contains('button', 'Apply').click();
cy.get('.v-toast__text').should('contain', 'Not selected');
cy.wait(3000);
cy.contains('button', 'Apply').should('be.disabled'); // 斷言按鈕為禁用狀態
cy.wait(2000);
// Clear selected item.
cy.get('table tr:nth-child(2) input[type="radio"]').check({force: true}); // 選取第二個
cy.contains('button', 'Clear').click();
cy.get('table tr:nth-child(2) input[type="radio"]').should('not.be.checked')
cy.wait(3000);
cy.wait(2000);
// selected item
cy.get('table tr:nth-child(2) input[type="radio"]').check({force: true});
cy.contains('button', 'Apply').click();
cy.get('#tabFunnel').click();
cy.contains('p', 'Sequence');
cy.contains('span', 'Start');
cy.contains('span', 'start');
cy.contains('button', 'Apply All').click();
//make sure create map again.
@@ -107,22 +109,21 @@ describe('Save Log and Filter', ()=>{
cy.get('input#End1').check({ force: true });
// No selected.
cy.contains('button', 'Apply').click();
cy.get('.v-toast__text').should('contain', 'Not selected');
cy.wait(3000);
cy.contains('button', 'Apply').should('be.disabled'); // 斷言按鈕為禁用狀態
cy.wait(2000);
// Clear selected item.
cy.get('table tr:nth-child(1) input[type="radio"]').check({force: true}); // 選取第一個
cy.contains('button', 'Clear').click();
cy.get('table tr:nth-child(1) input[type="radio"]').should('not.be.checked')
cy.wait(3000);
cy.wait(2000);
// selected item
cy.get('table tr:nth-child(2) input[type="radio"]').check({force: true});
cy.contains('button', 'Apply').click();
cy.get('#tabFunnel').click();
cy.contains('p', 'Sequence');
cy.contains('span', 'End');
cy.contains('span', 'end');
cy.contains('button', 'Apply All').click();
// make sure create map again.
@@ -146,9 +147,8 @@ describe('Save Log and Filter', ()=>{
cy.get('input[id="Start & End2"]').check({ force: true });
// No selected.
cy.contains('button', 'Apply').click();
cy.get('.v-toast__text').should('contain', 'Both Start and End must be selected');
cy.wait(3000);
cy.contains('button', 'Apply').should('be.disabled'); // 斷言按鈕為禁用狀態
cy.wait(2000);
// 選取 "start" 的 <table>
cy.contains('p', 'Start activity')
@@ -169,7 +169,7 @@ describe('Save Log and Filter', ()=>{
cy.contains('button', 'Clear').click();
cy.get('@startTable').find('tr:nth-child(1) input[type="radio"]').should('not.be.checked');
cy.get('@endTable').find('tr:nth-child(1) input[type="radio"]').should('not.be.checked');
cy.wait(3000);
cy.wait(2000);
// selected item
cy.get('@startTable').find('tr:nth-child(1) input[type="radio"]').check({ force: true });
@@ -177,9 +177,9 @@ describe('Save Log and Filter', ()=>{
cy.contains('button', 'Apply').click();
cy.get('#tabFunnel').click();
cy.contains('p', 'Sequence');
cy.contains('span', 'Start')
cy.contains('span', 'start')
.parent()
.contains('span', 'End'); // 斷言 text 是否包含 Start 和 End.
.contains('span', 'end'); // 斷言 text 是否包含 Start 和 End.
cy.contains('button', 'Apply All').click();
// make sure create map again.
@@ -201,9 +201,8 @@ describe('Save Log and Filter', ()=>{
.check({ force: true }); // 對該 <input> 元素進行勾選操作
// No selected.
cy.contains('button', 'Apply').click();
cy.get('.v-toast__text').should('contain', 'Select two or more');
cy.wait(3000);
cy.contains('button', 'Apply').should('be.disabled'); // 斷言按鈕為禁用狀態
cy.wait(2000);
// 使用 dblclick 選擇要拖曳的元素
cy.get('tbody tr[data-draggable="true"]').first().dblclick();
@@ -211,7 +210,7 @@ describe('Save Log and Filter', ()=>{
cy.contains('button', 'Clear').click();
cy.get('.listSequence').find('div[data-draggable="true"]').should('not.exist');
cy.get('.v-toast__text').should('contain', 'Filter cleared');
cy.wait(3000);
cy.wait(2000);
// 設定傳給後端的 listSequence
@@ -220,7 +219,7 @@ describe('Save Log and Filter', ()=>{
cy.contains('button', 'Apply').click();
cy.get('#tabFunnel').click();
cy.contains('p', 'Sequence');
cy.contains('span', 'Directly-follows');
cy.contains('span', 'directly follows');
cy.contains('button', 'Apply All').click();
// make sure create map again.
@@ -235,7 +234,7 @@ describe('Save Log and Filter', ()=>{
it('Trace', () => {
// select radio
cy.get('input#Trace2').check({ force: true }); // 選取 Radio 'Trace'
cy.wait(3000);
cy.wait(2000);
// click on Trace Number to show a table
cy.contains('td', '#1').click();
@@ -254,7 +253,7 @@ describe('Save Log and Filter', ()=>{
.trigger('mouseup');
cy.contains('button', 'Clear').click();
cy.get('.v-toast__text').should('contain', 'Filter cleared');
cy.wait(3000);
cy.wait(2000);
// selected item
cy.get('.p-slider-handle:nth-child(2)')
@@ -281,14 +280,14 @@ describe('Save Log and Filter', ()=>{
it('Timeframes', () => {
// select radio
cy.get('input#Timeframes3').check({ force: true }); // 選取 Radio 'Trace'
cy.wait(3000);
cy.wait(2000);
// Clear selected item
cy.get('#startCalendar').click();
cy.get('.p-datepicker td[aria-label="28"]').click({ multiple: true });
cy.contains('button', 'Clear').click();
cy.get('.v-toast__text').should('contain', 'Filter cleared');
cy.wait(3000);
cy.wait(2000);
// selected item
cy.get('#startCalendar').click();

View File

@@ -10,7 +10,11 @@ describe('Save Log and Filter', ()=>{
it('save log', () => {
// enter log
cy.url().should('include', 'files');
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
// cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
cy.get('table tr')
.filter(':contains("Log")') // 選擇 type Log
.filter(':contains("random")') // 選擇 random log 檔
.dblclick(); // 對選中的 tr 執行雙擊
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
cy.url().should('include', 'discover/map/log'); // 斷言在 discover/map/log/:id 路徑
cy.wait(3000)
@@ -91,7 +95,11 @@ describe('Save Log and Filter', ()=>{
it('no save log', () => {
// enter log
cy.url().should('include', 'files');
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
// cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
cy.get('table tr')
.filter(':contains("Log")') // 選擇 type Log
.filter(':contains("random")') // 選擇 random log 檔
.dblclick(); // 對選中的 tr 執行雙擊
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
cy.url().should('include', 'discover/map/log'); // 斷言在 discover/map/log/:id 路徑
cy.wait(3000)
@@ -118,8 +126,8 @@ describe('Save Log and Filter', ()=>{
cy.wait(3000)
cy.get('#backPage').click();
cy.contains('.swal2-title', 'LEAVE MAP');
cy.contains('button', 'OK').click();
cy.contains('.swal2-title', 'SAVE YOUR FILTER');
cy.contains('button', 'No').click();
cy.url().should('include', 'files');
})
});