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