test: Upload Page, rename, reset, back to page. Done.
This commit is contained in:
5
cypress/fixtures/csv/big5.csv
Normal file
5
cypress/fixtures/csv/big5.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
時間,案號,居住區域,學區,事件名稱,事件序號,狀態 ,時段,溫度,數量,未知,完成,預期時間
|
||||
2022/05/13 09:25:21,案一,63,富山,事件甲,事件一,Start,早上,95,27,,TRUE,2022/5/14 09:25:21
|
||||
2022/05/13 09:25:21,案一,,,事件甲,事件一,Complete,中午,135,442,,false,2022/5/14 09:25:21
|
||||
2022/05/13 09:30:01,案一,,仁德,事件乙,事件四,Start,中午,110.6,-6, ,,2022/5/14 09:30:01
|
||||
2022/05/13 09:30:01,案一,,,事件乙,事件四,Complete,晚上,-65,4,,true ,2022/5/14 09:30:01
|
||||
|
BIN
cypress/fixtures/csv/corrupted.csv
Normal file
BIN
cypress/fixtures/csv/corrupted.csv
Normal file
Binary file not shown.
|
1
cypress/fixtures/csv/empty.csv
Normal file
1
cypress/fixtures/csv/empty.csv
Normal file
@@ -0,0 +1 @@
|
||||
timestamp,case id,name,instance,status
|
||||
|
BIN
cypress/fixtures/csv/favicon.ico
Normal file
BIN
cypress/fixtures/csv/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
9
cypress/fixtures/csv/insufficient-columns.csv
Normal file
9
cypress/fixtures/csv/insufficient-columns.csv
Normal file
@@ -0,0 +1,9 @@
|
||||
timestamp,case id,name,status
|
||||
2022/05/13 09:25:21,c1,a,1,start
|
||||
2022/05/13 09:25:21,c1,a,1,complete
|
||||
2022/05/13 09:30:01,c1,b,2,start
|
||||
2022/05/13 09:30:01,c1,b,2,complete
|
||||
2022/05/13 09:48:33,c2,a,6,start
|
||||
2022/05/13 09:48:33,c2,a,6,complete
|
||||
2022/05/13 09:54:27,c2,c,7,start
|
||||
2022/05/13 09:54:27,c2,c,7,complete
|
||||
|
30
cypress/fixtures/csv/rightFile.csv
Normal file
30
cypress/fixtures/csv/rightFile.csv
Normal file
@@ -0,0 +1,30 @@
|
||||
CaseID,Activity,Timestamp,Status,Activity_Instance
|
||||
CID_1,檢傷,2023-01-12 15:32:31,start,1
|
||||
CID_1,檢傷,2023-01-12 15:32:31,complete,1
|
||||
CID_1,第一次醫囑,2023-01-12 15:49:01,start,2
|
||||
CID_1,第一次醫囑,2023-01-12 15:49:01,complete,2
|
||||
CID_1,出院,2023-01-13 03:32:00,start,3
|
||||
CID_1,出院,2023-01-13 03:32:00,complete,3
|
||||
CID_2,檢傷,2023-07-26 08:44:17,start,4
|
||||
CID_2,檢傷,2023-07-26 08:44:17,complete,4
|
||||
CID_2,第一次醫囑,2023-07-26 08:48:05,start,5
|
||||
CID_2,第一次醫囑,2023-07-26 08:48:05,complete,5
|
||||
CID_2,出院,2023-07-26 17:00:49,start,6
|
||||
CID_2,出院,2023-07-26 17:00:49,complete,6
|
||||
CID_3,檢傷,2023-11-27 06:20:48,start,7
|
||||
CID_3,檢傷,2023-11-27 06:20:48,complete,7
|
||||
CID_3,第一次醫囑,2023-11-27 06:40:30,start,8
|
||||
CID_3,第一次醫囑,2023-11-27 06:40:30,complete,8
|
||||
CID_3,出院,2023-11-27 07:21:53,start,9
|
||||
CID_3,出院,2023-11-27 07:21:53,complete,9
|
||||
CID_4,檢傷,2023-11-01 01:20:19,start,10
|
||||
CID_4,檢傷,2023-11-01 01:20:19,complete,10
|
||||
CID_4,第一次醫囑,2023-11-01 01:34:54,start,11
|
||||
CID_4,第一次醫囑,2023-11-01 01:34:54,complete,11
|
||||
CID_4,住院,2023-11-02 06:36:36,start,12
|
||||
CID_4,住院,2023-11-10 02:35:39,complete,12
|
||||
CID_4,出院,2023-11-10 02:35:39,start,13
|
||||
CID_4,出院,2023-11-10 02:35:39,complete,13
|
||||
CID_5,檢傷,2023-07-13 02:49:36,start,14
|
||||
CID_5,檢傷,2023-07-13 02:49:36,complete,14
|
||||
CID_5,第一次醫囑,2023-07-13 03:07:01,start,15
|
||||
|
9
cypress/fixtures/csv/worngFile.csv
Normal file
9
cypress/fixtures/csv/worngFile.csv
Normal file
@@ -0,0 +1,9 @@
|
||||
timestamp,case id,name,instance,status
|
||||
2022/05/13 09:25:21,c1,a,1,start
|
||||
2022/05/13 09:25:21,c1,a,1,
|
||||
2022/05/13 09:30:01,c1,b,2,begin
|
||||
2022/05/13 09:30:01,c1,b,,complete
|
||||
2022/05/13 09:48:33,,,6,start
|
||||
2022;05;13 09;48;33,c2,a,6,complete
|
||||
2022/05/13 09:54:27,c2,c,7,start
|
||||
,c2,c,7,complete
|
||||
|
309
cypress/fixtures/doneTesting/filterFunnel.cy.js
Normal file
309
cypress/fixtures/doneTesting/filterFunnel.cy.js
Normal file
@@ -0,0 +1,309 @@
|
||||
// 每一 describe 就是一個測試套件
|
||||
// 每一 it 就是一個測試命令
|
||||
describe('Save Log and Filter', ()=>{
|
||||
beforeEach(() => {
|
||||
cy.visit('https://REDACTED-HOST/files');
|
||||
cy.login();
|
||||
cy.visit('https://REDACTED-HOST/files');
|
||||
|
||||
// enter log
|
||||
cy.url().should('include', 'files');
|
||||
// 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(2000)
|
||||
cy.get('#iconFilter').click(); // 選取 Filter sidebar
|
||||
});
|
||||
|
||||
it('Sequence, Have activity(s).', () => {
|
||||
// select radio
|
||||
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)
|
||||
|
||||
// No selected.
|
||||
cy.contains('button', 'Apply').should('be.disabled'); // 斷言按鈕為禁用狀態
|
||||
cy.wait(2000);
|
||||
|
||||
// Clear selected item.
|
||||
cy.get('.allCheckboxAct') // 選取 all select
|
||||
.find('input')
|
||||
.should('not.be.visible').check({ force: true}).should('be.checked'); // 打開隱藏項目並選取
|
||||
cy.contains('button', 'Clear').click();
|
||||
cy.get('.allCheckboxAct') // 選取 all select
|
||||
.find('input')
|
||||
.should('not.be.visible')
|
||||
.should('not.be.checked')
|
||||
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('button', 'Apply All').click();
|
||||
|
||||
// make sure create map again.
|
||||
cy.get('header').click();
|
||||
cy.get('#iconState').click();
|
||||
cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
|
||||
const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
|
||||
expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
|
||||
});
|
||||
});
|
||||
|
||||
it('Sequence, Start', () => {
|
||||
// select radio
|
||||
cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
|
||||
cy.contains('label', 'Start & End') // 選取 Radio 'Have activity(s)'
|
||||
.prev(2)
|
||||
.find('input')
|
||||
.should('have.attr', 'type', 'radio') // select the previous element
|
||||
.check({ force: true })
|
||||
.should('be.checked'); // confirm it's type radio (optional)
|
||||
|
||||
// No selected.
|
||||
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(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('button', 'Apply All').click();
|
||||
|
||||
//make sure create map again.
|
||||
cy.get('header').click();
|
||||
cy.get('#iconState').click();
|
||||
cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
|
||||
const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
|
||||
expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
|
||||
});
|
||||
});
|
||||
|
||||
it('Sequence, End', () => {
|
||||
// select radio
|
||||
cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
|
||||
cy.contains('label', 'Start & End') // 選取 Radio 'Have activity(s)'
|
||||
.prev(2)
|
||||
.find('input')
|
||||
.should('have.attr', 'type', 'radio') // select the previous element
|
||||
.check({ force: true })
|
||||
.should('be.checked'); // confirm it's type radio (optional)
|
||||
cy.get('input#End1').check({ force: true });
|
||||
|
||||
// No selected.
|
||||
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(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('button', 'Apply All').click();
|
||||
|
||||
// make sure create map again.
|
||||
cy.get('header').click();
|
||||
cy.get('#iconState').click();
|
||||
cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
|
||||
const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
|
||||
expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
|
||||
});
|
||||
});
|
||||
|
||||
it('Sequence, Start & End', () => {
|
||||
// select radio
|
||||
cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
|
||||
cy.contains('label', 'Start & End') // 選取 Radio 'Have activity(s)'
|
||||
.prev(2)
|
||||
.find('input')
|
||||
.should('have.attr', 'type', 'radio') // select the previous element
|
||||
.check({ force: true })
|
||||
.should('be.checked'); // confirm it's type radio (optional)
|
||||
cy.get('input[id="Start & End2"]').check({ force: true });
|
||||
|
||||
// No selected.
|
||||
cy.contains('button', 'Apply').should('be.disabled'); // 斷言按鈕為禁用狀態
|
||||
cy.wait(2000);
|
||||
|
||||
// 選取 "start" 的 <table>
|
||||
cy.contains('p', 'Start activity')
|
||||
.parents('div') // 回到 p 的父層 div
|
||||
.eq(1) // 同階層的第二個 div
|
||||
.find('table') // 向下找 table
|
||||
.as('startTable'); // 將選取的元素命名,使用 @startTable 來操作
|
||||
// 選取 "end" 的 <table>
|
||||
cy.contains('p', 'End activity')
|
||||
.parents('div')
|
||||
.eq(1)
|
||||
.find('table')
|
||||
.as('endTable'); // 使用 @endTable 來操作
|
||||
|
||||
// Clear selected item.
|
||||
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.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(2000);
|
||||
|
||||
// selected item
|
||||
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.contains('button', 'Apply').click();
|
||||
cy.get('#tabFunnel').click();
|
||||
cy.contains('p', 'Sequence');
|
||||
cy.contains('span', 'start')
|
||||
.parent()
|
||||
.contains('span', 'end'); // 斷言 text 是否包含 Start 和 End.
|
||||
cy.contains('button', 'Apply All').click();
|
||||
|
||||
// make sure create map again.
|
||||
cy.get('header').click();
|
||||
cy.get('#iconState').click();
|
||||
cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
|
||||
const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
|
||||
expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
|
||||
});
|
||||
});
|
||||
|
||||
it('Sequence, Sequence', () => {
|
||||
// select radio
|
||||
cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
|
||||
cy.contains('p', 'Activity Sequence') // 選取包含指定文字的元素
|
||||
.nextAll() // 選取所有後續相鄰元素
|
||||
.eq(2) // 選取索引為 2 , 下 3 個相鄰元素
|
||||
.find('input#Sequence2') // 在下一個相鄰元素中尋找指定的 <input> 元素
|
||||
.check({ force: true }); // 對該 <input> 元素進行勾選操作
|
||||
|
||||
// No selected.
|
||||
cy.contains('button', 'Apply').should('be.disabled'); // 斷言按鈕為禁用狀態
|
||||
cy.wait(2000);
|
||||
|
||||
// 使用 dblclick 選擇要拖曳的元素
|
||||
cy.get('tbody tr[data-draggable="true"]').first().dblclick();
|
||||
cy.get('.listSequence').find('div[data-draggable="true"]').should('exist');
|
||||
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(2000);
|
||||
|
||||
|
||||
// 設定傳給後端的 listSequence
|
||||
cy.get('tbody tr[data-draggable="true"]').eq(0).dblclick(); // 第 1 個 tr
|
||||
cy.get('tbody tr[data-draggable="true"]').eq(1).dblclick(); // 第 2 個 tr
|
||||
cy.contains('button', 'Apply').click();
|
||||
cy.get('#tabFunnel').click();
|
||||
cy.contains('p', 'Sequence');
|
||||
cy.contains('span', 'directly follows');
|
||||
cy.contains('button', 'Apply All').click();
|
||||
|
||||
// make sure create map again.
|
||||
cy.get('header').click();
|
||||
cy.get('#iconState').click();
|
||||
cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
|
||||
const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
|
||||
expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
|
||||
});
|
||||
});
|
||||
|
||||
it('Trace', () => {
|
||||
// select radio
|
||||
cy.get('input#Trace2').check({ force: true }); // 選取 Radio 'Trace'
|
||||
cy.wait(2000);
|
||||
|
||||
// click on Trace Number to show a table
|
||||
cy.contains('td', '#1').click();
|
||||
cy.wait(1000);
|
||||
cy.get('#cyTrace').scrollIntoView().should('be.visible'); // 視窗滾到右邊
|
||||
cy.wait(1000);
|
||||
cy.get('.p-chart').scrollIntoView(); // 視窗拉回來
|
||||
|
||||
// Clear selected item
|
||||
cy.get('.p-slider-handle:nth-child(2)')
|
||||
.click()
|
||||
.trigger('mousedown', { which: 1 })
|
||||
.trigger('mousemove', { clientX: 250 })
|
||||
.xpath('//span[contains(@class, "p-slider-handle")][2]')
|
||||
.click()
|
||||
.trigger('mouseup');
|
||||
cy.contains('button', 'Clear').click();
|
||||
cy.get('.v-toast__text').should('contain', 'Filter cleared');
|
||||
cy.wait(2000);
|
||||
|
||||
// selected item
|
||||
cy.get('.p-slider-handle:nth-child(2)')
|
||||
.click()
|
||||
.trigger('mousedown', { which: 1 })
|
||||
.trigger('mousemove', { clientX: 250 })
|
||||
.xpath('//span[contains(@class, "p-slider-handle")][2]')
|
||||
.click()
|
||||
.trigger('mouseup');
|
||||
cy.contains('button', 'Apply').click();
|
||||
cy.get('#tabFunnel').click();
|
||||
cy.contains('p', 'Trace');
|
||||
cy.contains('button', 'Apply All').click();
|
||||
|
||||
// make sure create map again.
|
||||
cy.get('header').click();
|
||||
cy.get('#iconState').click();
|
||||
cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
|
||||
const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
|
||||
expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
|
||||
});
|
||||
});
|
||||
|
||||
it('Timeframes', () => {
|
||||
// select radio
|
||||
cy.get('input#Timeframes3').check({ force: true }); // 選取 Radio 'Trace'
|
||||
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(2000);
|
||||
|
||||
// selected item
|
||||
cy.get('#startCalendar').click();
|
||||
cy.get('.p-datepicker td[aria-label="28"]').click({ multiple: true });
|
||||
cy.contains('button', 'Apply').click();
|
||||
cy.get('#tabFunnel').click();
|
||||
cy.contains('p', 'Timeframe');
|
||||
cy.contains('button', 'Apply All').click();
|
||||
|
||||
// make sure create map again.
|
||||
cy.get('header').click();
|
||||
cy.get('#iconState').click();
|
||||
cy.get('li').first().then($li => { // then() 獲取 <li> 元素的內容
|
||||
const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span
|
||||
expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user