Cypress: filterFunnel - testing done.

This commit is contained in:
chiayin
2023-06-12 09:59:02 +08:00
parent 77d6c6c56b
commit 0b2104f41b
3 changed files with 224 additions and 224 deletions

View File

@@ -15,181 +15,181 @@ describe('Save Log and Filter', ()=>{
cy.get('#iconFilter').click(); // 選取 Filter sidebar cy.get('#iconFilter').click(); // 選取 Filter sidebar
}); });
// it('Sequence, Have activity(s).', () => { it('Sequence, Have activity(s).', () => {
// // select radio // select radio
// cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence' cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
// cy.contains('label', 'Have activity(s)') // 選取 Radio 'Have activity(s)' cy.contains('label', 'Have activity(s)') // 選取 Radio 'Have activity(s)'
// .prev(2) .prev(2)
// .find('input') .find('input')
// .should('have.attr', 'type', 'radio') // select the previous element .should('have.attr', 'type', 'radio') // select the previous element
// .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').click();
// cy.get('.v-toast__text').should('contain', 'Not selected'); cy.get('.v-toast__text').should('contain', 'Not selected');
// cy.wait(3000); cy.wait(3000);
// // Clear selected item. // Clear selected item.
// cy.get('.allCheckboxAct') // 選取 all select cy.get('.allCheckboxAct') // 選取 all select
// .find('input') .find('input')
// .should('not.be.visible').check({ force: true}).should('be.checked'); // 打開隱藏項目並選取 .should('not.be.visible').check({ force: true}).should('be.checked'); // 打開隱藏項目並選取
// cy.contains('button', 'Clear').click(); cy.contains('button', 'Clear').click();
// cy.get('.allCheckboxAct') // 選取 all select cy.get('.allCheckboxAct') // 選取 all select
// .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(3000);
// // 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.
// cy.get('header').click(); cy.get('header').click();
// cy.get('#iconState').click(); cy.get('#iconState').click();
// cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容 cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
// const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
// expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化 expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
// }); });
// }); });
// it('Sequence, Start', () => { it('Sequence, Start', () => {
// // select radio // select radio
// cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence' cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
// cy.contains('label', 'Start activity / End activity') // 選取 Radio 'Have activity(s)' cy.contains('label', 'Start activity / End activity') // 選取 Radio 'Have activity(s)'
// .prev(2) .prev(2)
// .find('input') .find('input')
// .should('have.attr', 'type', 'radio') // select the previous element .should('have.attr', 'type', 'radio') // select the previous element
// .check({ force: true }) .check({ force: true })
// .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').click();
// cy.get('.v-toast__text').should('contain', 'Not selected'); cy.get('.v-toast__text').should('contain', 'Not selected');
// cy.wait(3000); 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(3000);
// // 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.
// cy.get('header').click(); cy.get('header').click();
// cy.get('#iconState').click(); cy.get('#iconState').click();
// cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容 cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
// const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
// expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化 expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
// }); });
// }); });
// it('Sequence, End', () => { it('Sequence, End', () => {
// // select radio // select radio
// cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence' cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
// cy.contains('label', 'Start activity / End activity') // 選取 Radio 'Have activity(s)' cy.contains('label', 'Start activity / End activity') // 選取 Radio 'Have activity(s)'
// .prev(2) .prev(2)
// .find('input') .find('input')
// .should('have.attr', 'type', 'radio') // select the previous element .should('have.attr', 'type', 'radio') // select the previous element
// .check({ force: true }) .check({ force: true })
// .should('be.checked'); // confirm it's type radio (optional) .should('be.checked'); // confirm it's type radio (optional)
// 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').click();
// cy.get('.v-toast__text').should('contain', 'Not selected'); cy.get('.v-toast__text').should('contain', 'Not selected');
// cy.wait(3000); 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(3000);
// // 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.
// cy.get('header').click(); cy.get('header').click();
// cy.get('#iconState').click(); cy.get('#iconState').click();
// cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容 cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
// const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
// expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化 expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
// }); });
// }); });
// it('Sequence, Start & End', () => { it('Sequence, Start & End', () => {
// // select radio // select radio
// cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence' cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
// cy.contains('label', 'Start activity / End activity') // 選取 Radio 'Have activity(s)' cy.contains('label', 'Start activity / End activity') // 選取 Radio 'Have activity(s)'
// .prev(2) .prev(2)
// .find('input') .find('input')
// .should('have.attr', 'type', 'radio') // select the previous element .should('have.attr', 'type', 'radio') // select the previous element
// .check({ force: true }) .check({ force: true })
// .should('be.checked'); // confirm it's type radio (optional) .should('be.checked'); // confirm it's type radio (optional)
// 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').click();
// cy.get('.v-toast__text').should('contain', 'Both Start and End must be selected'); cy.get('.v-toast__text').should('contain', 'Both Start and End must be selected');
// cy.wait(3000); cy.wait(3000);
// // 選取 "start" 的 <table> // 選取 "start" 的 <table>
// cy.contains('p', 'Start activity') cy.contains('p', 'Start activity')
// .parents('div') // 回到 p 的父層 div .parents('div') // 回到 p 的父層 div
// .eq(1) // 同階層的第二個 div .eq(1) // 同階層的第二個 div
// .find('table') // 向下找 table .find('table') // 向下找 table
// .as('startTable'); // 將選取的元素命名,使用 @startTable 來操作 .as('startTable'); // 將選取的元素命名,使用 @startTable 來操作
// // 選取 "end" 的 <table> // 選取 "end" 的 <table>
// cy.contains('p', 'End activity') cy.contains('p', 'End activity')
// .parents('div') .parents('div')
// .eq(1) .eq(1)
// .find('table') .find('table')
// .as('endTable'); // 使用 @endTable 來操作 .as('endTable'); // 使用 @endTable 來操作
// // Clear selected item. // Clear 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 });
// cy.get('@endTable').find('tr:nth-child(1) input[type="radio"]').check({ force: true }); cy.get('@endTable').find('tr:nth-child(1) input[type="radio"]').check({ force: true });
// 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(3000);
// // 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 });
// cy.get('@endTable').find('tr:nth-child(1) input[type="radio"]').check({ force: true }); cy.get('@endTable').find('tr:nth-child(1) 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')
// .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.
// cy.get('header').click(); cy.get('header').click();
// cy.get('#iconState').click(); cy.get('#iconState').click();
// cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容 cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
// const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
// expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化 expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
// }); });
// }); });
it('Sequence, Sequence', () => { it('Sequence, Sequence', () => {
// select radio // select radio
@@ -201,9 +201,9 @@ 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').click();
// cy.get('.v-toast__text').should('contain', 'Select two or more'); cy.get('.v-toast__text').should('contain', 'Select two or more');
// cy.wait(3000); cy.wait(3000);
// 使用 dblclick 選擇要拖曳的元素 // 使用 dblclick 選擇要拖曳的元素
cy.get('tbody tr[data-draggable="true"]').first().dblclick(); cy.get('tbody tr[data-draggable="true"]').first().dblclick();
@@ -232,79 +232,79 @@ 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(3000);
// // 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();
// cy.wait(1000); cy.wait(1000);
// cy.get('#cyTrace').scrollIntoView().should('be.visible'); // 視窗滾到右邊 cy.get('#cyTrace').scrollIntoView().should('be.visible'); // 視窗滾到右邊
// cy.wait(1000); cy.wait(1000);
// cy.get('.p-chart').scrollIntoView(); // 視窗拉回來 cy.get('.p-chart').scrollIntoView(); // 視窗拉回來
// // Clear selected item // Clear selected item
// cy.get('.p-slider-handle:nth-child(2)') cy.get('.p-slider-handle:nth-child(2)')
// .click() .click()
// .trigger('mousedown', { which: 1 }) .trigger('mousedown', { which: 1 })
// .trigger('mousemove', { clientX: 250 }) .trigger('mousemove', { clientX: 250 })
// .xpath('//span[contains(@class, "p-slider-handle")][2]') .xpath('//span[contains(@class, "p-slider-handle")][2]')
// .click() .click()
// .trigger('mouseup'); .trigger('mouseup');
// cy.contains('button', 'Clear').click(); cy.contains('button', 'Clear').click();
// cy.get('.v-toast__text').should('contain', 'Reset Success'); cy.get('.v-toast__text').should('contain', 'Reset Success');
// cy.wait(3000); cy.wait(3000);
// // selected item // selected item
// cy.get('.p-slider-handle:nth-child(2)') cy.get('.p-slider-handle:nth-child(2)')
// .click() .click()
// .trigger('mousedown', { which: 1 }) .trigger('mousedown', { which: 1 })
// .trigger('mousemove', { clientX: 250 }) .trigger('mousemove', { clientX: 250 })
// .xpath('//span[contains(@class, "p-slider-handle")][2]') .xpath('//span[contains(@class, "p-slider-handle")][2]')
// .click() .click()
// .trigger('mouseup'); .trigger('mouseup');
// cy.contains('button', 'Apply').click(); cy.contains('button', 'Apply').click();
// cy.get('#tabFunnel').click(); cy.get('#tabFunnel').click();
// cy.contains('p', 'Trace'); cy.contains('p', 'Trace');
// cy.contains('button', 'Apply All').click(); cy.contains('button', 'Apply All').click();
// // make sure create map again. // make sure create map again.
// cy.get('header').click(); cy.get('header').click();
// cy.get('#iconState').click(); cy.get('#iconState').click();
// cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容 cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
// const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
// expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化 expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
// }); });
// }); });
// 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(3000);
// // 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', 'Reset Success'); cy.get('.v-toast__text').should('contain', 'Reset Success');
// cy.wait(3000); cy.wait(3000);
// // selected item // 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', 'Apply').click(); cy.contains('button', 'Apply').click();
// cy.get('#tabFunnel').click(); cy.get('#tabFunnel').click();
// cy.contains('p', 'Timeframe'); cy.contains('p', 'Timeframe');
// cy.contains('button', 'Apply All').click(); cy.contains('button', 'Apply All').click();
// // make sure create map again. // make sure create map again.
// cy.get('header').click(); cy.get('header').click();
// cy.get('#iconState').click(); cy.get('#iconState').click();
// cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容 cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
// const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
// expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化 expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
// }); });
// }); });
}); });