From dc0a98f8198342d5e0d450a4db1506191c51ee23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Thu, 5 Mar 2026 23:00:58 +0800 Subject: [PATCH] Remove sensitive data from tracked files before BFG history cleanup Co-Authored-By: Claude Opus 4.6 --- .env | 2 +- .env.demo | 4 - .../accountDuplicationCheck.cy.js | 8 +- .../accountAdmin/confirmPasswordMessage.cy.js | 8 +- cypress/e2e/accountAdmin/createAccont.cy.js | 8 +- cypress/e2e/accountAdmin/deleteAccount.cy.js | 8 +- cypress/e2e/accountAdmin/editAccount.cy.js | 8 +- cypress/e2e/compare.cy.js | 4 +- cypress/e2e/pageAdmin.cy.js | 4 +- cypress/e2e/pasteUrlLoginRedirect.cy.js | 4 +- .../doneTesting/conformanceRule.cy.js | 168 ---------- .../doneTesting/conformanceSave.cy.js | 168 ---------- .../fixtures/doneTesting/fileUploadEtc.cy.js | 11 - .../fixtures/doneTesting/filterFunnel.cy.js | 308 ------------------ .../fixtures/doneTesting/loginToLogout.cy.js | 44 --- .../fixtures/doneTesting/performance.cy.js | 31 -- .../doneTesting/saveLogAndFilter.cy.js | 131 -------- src/constants/constants.js | 30 +- 18 files changed, 28 insertions(+), 921 deletions(-) delete mode 100644 .env.demo delete mode 100644 cypress/fixtures/doneTesting/conformanceRule.cy.js delete mode 100644 cypress/fixtures/doneTesting/conformanceSave.cy.js delete mode 100644 cypress/fixtures/doneTesting/fileUploadEtc.cy.js delete mode 100644 cypress/fixtures/doneTesting/filterFunnel.cy.js delete mode 100644 cypress/fixtures/doneTesting/loginToLogout.cy.js delete mode 100644 cypress/fixtures/doneTesting/performance.cy.js delete mode 100644 cypress/fixtures/doneTesting/saveLogAndFilter.cy.js diff --git a/.env b/.env index d4e2540..5fe6fc9 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VUE_APP_API_URL = "https://REDACTED-HOST/api/" \ No newline at end of file +VUE_APP_API_URL = "" diff --git a/.env.demo b/.env.demo deleted file mode 100644 index 2c7032b..0000000 --- a/.env.demo +++ /dev/null @@ -1,4 +0,0 @@ -/* -For demo env file -*/ -VUE_APP_API_URL = "https://REDACTED-HOST/api/" diff --git a/cypress/e2e/accountAdmin/accountDuplicationCheck.cy.js b/cypress/e2e/accountAdmin/accountDuplicationCheck.cy.js index 6750738..e1552bb 100644 --- a/cypress/e2e/accountAdmin/accountDuplicationCheck.cy.js +++ b/cypress/e2e/accountAdmin/accountDuplicationCheck.cy.js @@ -2,11 +2,11 @@ const MSG_ACCOUNT_NOT_UNIQUE = 'Account has already been registered.'; describe('Account duplication check.', ()=>{ beforeEach(() => { - cy.visit('https://REDACTED-HOST/account-admin'); - const username = 'cindy'; - const password = Cypress.env('loginPwd'); + cy.visit('/account-admin'); + const username = Cypress.env('user').username; + const password = Cypress.env('user').password; - cy.visit('https://REDACTED-HOST/account-admin'); + cy.visit('/account-admin'); cy.get('input[id="account"]').type(username); cy.get('input[id="password"]').type(password); diff --git a/cypress/e2e/accountAdmin/confirmPasswordMessage.cy.js b/cypress/e2e/accountAdmin/confirmPasswordMessage.cy.js index fdef367..bfd9a0c 100644 --- a/cypress/e2e/accountAdmin/confirmPasswordMessage.cy.js +++ b/cypress/e2e/accountAdmin/confirmPasswordMessage.cy.js @@ -3,11 +3,11 @@ const MSG_PWD_NOT_MATCHED = 'Confirm Password does not match.'; describe('Confirm that two input passwords are equal.', ()=>{ beforeEach(() => { - cy.visit('https://REDACTED-HOST/account-admin'); - const username = 'cindy'; - const password = Cypress.env('loginPwd'); + cy.visit('/account-admin'); + const username = Cypress.env('user').username; + const password = Cypress.env('user').password; - cy.visit('https://REDACTED-HOST/account-admin'); + cy.visit('/account-admin'); cy.get('input[id="account"]').type(username); cy.get('input[id="password"]').type(password); diff --git a/cypress/e2e/accountAdmin/createAccont.cy.js b/cypress/e2e/accountAdmin/createAccont.cy.js index de53104..8900292 100644 --- a/cypress/e2e/accountAdmin/createAccont.cy.js +++ b/cypress/e2e/accountAdmin/createAccont.cy.js @@ -2,11 +2,11 @@ import { getRandomInt } from '../../../src/utils/jsUtils'; describe('Create an Account', ()=>{ beforeEach(() => { - cy.visit('https://REDACTED-HOST/account-admin'); - const username = 'cindy'; - const password = Cypress.env('loginPwd'); + cy.visit('/account-admin'); + const username = Cypress.env('user').username; + const password = Cypress.env('user').password; - cy.visit('https://REDACTED-HOST/account-admin'); + cy.visit('/account-admin'); cy.get('input[id="account"]').type(username); cy.get('input[id="password"]').type(password); diff --git a/cypress/e2e/accountAdmin/deleteAccount.cy.js b/cypress/e2e/accountAdmin/deleteAccount.cy.js index 3b58e51..fa76067 100644 --- a/cypress/e2e/accountAdmin/deleteAccount.cy.js +++ b/cypress/e2e/accountAdmin/deleteAccount.cy.js @@ -1,10 +1,10 @@ describe('Delete an Account', ()=>{ beforeEach(() => { - cy.visit('https://REDACTED-HOST/account-admin'); - const username = 'cindy'; - const password = Cypress.env('loginPwd'); + cy.visit('/account-admin'); + const username = Cypress.env('user').username; + const password = Cypress.env('user').password; - cy.visit('https://REDACTED-HOST/account-admin'); + cy.visit('/account-admin'); cy.get('input[id="account"]').type(username); cy.get('input[id="password"]').type(password); diff --git a/cypress/e2e/accountAdmin/editAccount.cy.js b/cypress/e2e/accountAdmin/editAccount.cy.js index 273ab22..571e5ca 100644 --- a/cypress/e2e/accountAdmin/editAccount.cy.js +++ b/cypress/e2e/accountAdmin/editAccount.cy.js @@ -14,11 +14,11 @@ Cypress.Commands.add('manualScrollToBottom', (repeats = 20) => { describe('Edit an account', ()=>{ beforeEach(() => { - cy.visit('https://REDACTED-HOST/account-admin'); - const username = 'cindy'; - const password = Cypress.env('loginPwd'); + cy.visit('/account-admin'); + const username = Cypress.env('user').username; + const password = Cypress.env('user').password; - cy.visit('https://REDACTED-HOST/account-admin'); + cy.visit('/account-admin'); cy.get('input[id="account"]').type(username); cy.get('input[id="password"]').type(password); diff --git a/cypress/e2e/compare.cy.js b/cypress/e2e/compare.cy.js index 8f998b8..6df5b94 100644 --- a/cypress/e2e/compare.cy.js +++ b/cypress/e2e/compare.cy.js @@ -1,8 +1,8 @@ describe('Performance', ()=>{ beforeEach(() => { - cy.visit('https://REDACTED-HOST/files'); + cy.visit('/files'); cy.login(); - cy.visit('https://REDACTED-HOST/files'); + cy.visit('/files'); cy.url().should('include', 'files'); cy.contains('li', 'COMPARE').click(); }); diff --git a/cypress/e2e/pageAdmin.cy.js b/cypress/e2e/pageAdmin.cy.js index 042fac9..8f27778 100644 --- a/cypress/e2e/pageAdmin.cy.js +++ b/cypress/e2e/pageAdmin.cy.js @@ -1,8 +1,8 @@ describe('Modal dismissal related navigation button test', ()=>{ beforeEach(() => { - cy.visit('https://REDACTED-HOST/files'); + cy.visit('/files'); cy.login(); - cy.visit('https://REDACTED-HOST/files'); + cy.visit('/files'); }); it("On MAP page, after dismissing modal, active page is still MAP page, not CONFORMANCE page.", () => { diff --git a/cypress/e2e/pasteUrlLoginRedirect.cy.js b/cypress/e2e/pasteUrlLoginRedirect.cy.js index f8d29ce..f4a4a07 100644 --- a/cypress/e2e/pasteUrlLoginRedirect.cy.js +++ b/cypress/e2e/pasteUrlLoginRedirect.cy.js @@ -1,5 +1,5 @@ -const conformanceExampleUrl = "https://REDACTED-HOST/discover/conformance/log/185524797/conformance"; -const urlUnderTestNotEncoded = `https://REDACTED-HOST/login?return-to=${conformanceExampleUrl}`; +const conformanceExampleUrl = "http://localhost:5173/discover/conformance/log/185524797/conformance"; +const urlUnderTestNotEncoded = `http://localhost:5173/login?return-to=${conformanceExampleUrl}`; const urlsUnderTest = [urlUnderTestNotEncoded,]; describe('Conformance url pastetd', ()=>{ urlsUnderTest.forEach((curUrl) => { diff --git a/cypress/fixtures/doneTesting/conformanceRule.cy.js b/cypress/fixtures/doneTesting/conformanceRule.cy.js deleted file mode 100644 index f306055..0000000 --- a/cypress/fixtures/doneTesting/conformanceRule.cy.js +++ /dev/null @@ -1,168 +0,0 @@ -// 每一 describe 就是一個測試套件 -// 每一 it 就是一個測試命令 -describe('Conformance Save', ()=>{ - beforeEach(() => { - cy.visit('https://REDACTED-HOST/files'); - cy.login(); - cy.visit('https://REDACTED-HOST/files'); - }); - - - it('Cycle time, Start', () => { - // enter Map - cy.url().should('include', 'files'); - cy.get('table tr').filter(':contains("Rule")').filter(':contains("random-conformance-rule-E2Etesting")').dblclick({ force: true }); - cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁 - cy.url().should('include', 'rule/log'); // 斷言在 discover/map/log/:id 路徑 - cy.wait(2000) - - // select radio Rule Type - cy.get('#cyp-conformance-type-radio') - .find('input[value="Cycle time"]') - .check({ force: true }) - .should('be.checked'); - // select radio Activity Sequence - cy.get('#cyp-conformance-actseq-radio') - .find('input[value="Start"]') - .check({ force: true }) - .should('be.checked'); - - // open showbar - cy.get('#cyp-showbaricon').click(); - - // select radio Start - cy.contains('p', 'Start') - .next('div') - .find('input') - .first() - .check({ force: true }) - .should('be.checked'); - // change time to time range Start - cy.get('#min').click(); - cy.get('input[data-index="2"]').eq(0).type('59', { force: true }); - // change time to time range End - cy.get('#max').click(); - cy.get('input[data-index="2"]').eq(0).type('0', { force: true }); - - // click apply - cy.contains('button', 'Apply').click(); - cy.contains('.v-toast', 'Rule applied'); - - // 是否有顯示選擇項目 - cy.get('#cyp-conformance-result-dot') - .find('li') // 在 ul 中找到所有的 li 元素 - .should('have.length', 1); // 斷言 li 的數量為 2 - - // save log - cy.contains('button', 'Save').click(); - cy.contains('.swal2-title', 'SAVE COMPLETE'); - cy.contains('#swal2-html-container', 'random-conformance-rule-E2Etesting'); - }); - - it('Cycle time,End', () => { - // enter Map - cy.url().should('include', 'files'); - cy.get('table tr').filter(':contains("Rule")').filter(':contains("random-conformance-rule-E2Etesting")').dblclick({ force: true }); - cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁 - cy.url().should('include', 'rule/log'); // 斷言在 discover/map/log/:id 路徑 - cy.wait(2000) - - // select radio Rule Type - cy.get('#cyp-conformance-type-radio') - .find('input[value="Cycle time"]') - .check({ force: true }) - .should('be.checked'); - // select radio Activity Sequence - cy.get('#cyp-conformance-actseq-radio') - .find('input[value="End"]') - .check({ force: true }) - .should('be.checked'); - - // open showbar - cy.get('#cyp-showbaricon').click(); - - // select radio End - cy.contains('p', 'End') - .next('div') - .find('input') - .first() - .check({ force: true }) - .should('be.checked'); - // change time to time range Start - cy.get('#min').click(); - cy.get('input[data-index="2"]').eq(0).type('59', { force: true }); - // change time to time range End - cy.get('#max').click(); - cy.get('input[data-index="2"]').eq(0).type('0', { force: true }); - - // click apply - cy.contains('button', 'Apply').click(); - cy.contains('.v-toast', 'Rule applied'); - - // 是否有顯示選擇項目 - cy.get('#cyp-conformance-result-dot') - .find('li') // 在 ul 中找到所有的 li 元素 - .should('have.length', 1); // 斷言 li 的數量為 2 - - // save log - cy.contains('button', 'Save').click(); - cy.contains('.swal2-title', 'SAVE COMPLETE'); - cy.contains('#swal2-html-container', 'random-conformance-rule-E2Etesting'); - }); - - it('Cycle time,Start & End', () => { - // enter Map - cy.url().should('include', 'files'); - cy.get('table tr').filter(':contains("Rule")').filter(':contains("random-conformance-rule-E2Etesting")').dblclick({ force: true }); - cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁 - cy.url().should('include', 'rule/log'); // 斷言在 discover/map/log/:id 路徑 - cy.wait(2000) - - // select radio Rule Type - cy.get('#cyp-conformance-type-radio') - .find('input[value="Cycle time"]') - .check({ force: true }) - .should('be.checked'); - // select radio Activity Sequence - cy.get('#cyp-conformance-actseq-radio') - .find('input[value="Start & End"]') - .check({ force: true }) - .should('be.checked'); - - // open showbar - cy.get('#cyp-showbaricon').click(); - - // select radio "Start & End - cy.contains('p', 'Start') - .next('div') - .find('input') - .check({ force: true }) - .should('be.checked'); - // select radio End - cy.contains('p', 'End') - .next('div') - .find('input') - .check({ force: true }) - .should('be.checked'); - // change time to time range Start - cy.get('#min').click(); - cy.get('input[data-index="2"]').eq(0).type('59', { force: true }); - // change time to time range End - cy.get('#max').click(); - cy.get('input[data-index="2"]').eq(0).type('0', { force: true }); - - // click apply - cy.contains('button', 'Apply').click(); - cy.contains('.v-toast', 'Rule applied'); - - // 是否有顯示選擇項目 - cy.get('#cyp-conformance-result-dot') - .find('li') // 在 ul 中找到所有的 li 元素 - .should('have.length', 2); // 斷言 li 的數量為 2 - - // save log - cy.contains('button', 'Save').click(); - cy.contains('.swal2-title', 'SAVE COMPLETE'); - cy.contains('#swal2-html-container', 'random-conformance-rule-E2Etesting'); - }); -}); diff --git a/cypress/fixtures/doneTesting/conformanceSave.cy.js b/cypress/fixtures/doneTesting/conformanceSave.cy.js deleted file mode 100644 index 9805c9f..0000000 --- a/cypress/fixtures/doneTesting/conformanceSave.cy.js +++ /dev/null @@ -1,168 +0,0 @@ -// 每一 describe 就是一個測試套件 -// 每一 it 就是一個測試命令 -describe('Conformance Save', ()=>{ - beforeEach(() => { - cy.visit('https://REDACTED-HOST/files'); - cy.login(); - cy.visit('https://REDACTED-HOST/files'); - }); - - it('save conformance log', () => { - // enter Map - cy.url().should('include', 'files'); - 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) - - // enter Conformance - cy.contains('li', 'CONFORMANCE').click(); // 點擊 Conformance 頁 - cy.wait(2000); - cy.url().should('include', '/discover/conformance/log'); // 斷言在 discover/conformance/log/:id 路徑 - cy.get('.active').should('have.text', 'CONFORMANCE'); - - // select radio - cy.get('#cyp-conformance-type-radio').find('input').first().click({ force: true }).should('be.checked'); - - // select list checkbox - cy.get('#cyp-conformance-list-checkbox').find('input').first().click({ force: true }).should('be.checked'); - - // click apply - cy.contains('button', 'Apply').click(); - cy.contains('.v-toast', 'Rule applied'); - - // save conformance log - cy.contains('button', 'Save').click(); - cy.contains('.swal2-title', 'SAVE NEW RULE'); - cy.contains('button', 'OK').click(); - cy.contains('#swal2-validation-message', 'You need to write something!'); // 不輸入要跳驗證 - cy.get('.swal2-input').clear().type('random-conformance-log-E2Etesting'); - cy.contains('button', 'OK').click(); - cy.contains('#swal2-html-container', 'random-conformance-log-E2Etesting'); - - // 回到 Files 檢查是否有新增 Filter 'random-conformance-log-E2Etesting'. - cy.visit('https://REDACTED-HOST/files'); - cy.url().should('include', 'files'); - cy.contains('.fileName', 'random-conformance-log-E2Etesting'); - }); - - it('save conformance filter', () => { - // 先做一個 filter,再做一個 conformance filter。 - // enter log - cy.url().should('include', 'files'); - 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); - - // select radio - cy.get('#iconFilter').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 log - cy.contains('button', 'Save').click(); - cy.contains('.swal2-title', 'SAVE NEW FILTER'); - cy.get('.swal2-input').clear().type('random-to-conformance-filter-E2Etesting'); - cy.contains('button', 'OK').click(); - cy.contains('#swal2-html-container', 'random-to-conformance-filter-E2Etesting'); - - // 回到 Files 檢查是否有新增 Filter 'random-to-conformance-filter-E2Etesting' - // enter Map - cy.visit('https://REDACTED-HOST/files'); - cy.url().should('include', 'files'); - cy.get('table tr') - .contains('.fileType', 'Filter') - .parent() - .contains('.fileName', 'random-to-conformance-filter-E2Etesting') - .dblclick(); - cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁 - cy.url().should('include', 'discover/map/filter'); // 斷言在 discover/map/filter/:id 路徑 - cy.wait(2000) - - // enter Conformance - cy.contains('li', 'CONFORMANCE').click(); // 點擊 Conformance 頁 - cy.wait(2000); - cy.url().should('include', '/discover/conformance/filter'); // 斷言在 discover/conformance/filter/:id 路徑 - cy.get('.active').should('have.text', 'CONFORMANCE'); - - // select radio - cy.get('#cyp-conformance-type-radio').find('input').first().click({ force: true }).should('be.checked'); - - // select list checkbox - cy.get('#cyp-conformance-list-checkbox').find('input').eq(1).click({ force: true }).should('be.checked'); - - // click apply - cy.contains('button', 'Apply').click(); - cy.contains('.v-toast', 'Rule applied'); - - // save conformance log - cy.contains('button', 'Save').click(); - cy.contains('.swal2-title', 'SAVE NEW RULE'); - cy.contains('button', 'OK').click(); - cy.contains('#swal2-validation-message', 'You need to write something!'); // 不輸入要跳驗證 - cy.get('.swal2-input').clear().type('random-conformance-filter-E2Etesting'); - cy.contains('button', 'OK').click(); - cy.contains('#swal2-html-container', 'random-conformance-filter-E2Etesting'); - - // 回到 Files 檢查是否有新增 Filter 'random-conformance-log-E2Etesting'. - cy.visit('https://REDACTED-HOST/files'); - cy.url().should('include', 'files'); - cy.contains('.fileName', 'random-conformance-filter-E2Etesting'); - }); - - it('no save conformance', () => { - // enter log - cy.url().should('include', 'files'); - 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) - - // enter Conformance - cy.contains('li', 'CONFORMANCE').click(); // 點擊 Conformance 頁 - cy.wait(2000); - cy.url().should('include', '/discover/conformance/log'); // 斷言在 discover/conformance/log/:id 路徑 - cy.get('.active').should('have.text', 'CONFORMANCE'); - - // select radio - cy.get('#cyp-conformance-type-radio').find('input').first().click({ force: true }).should('be.checked'); - - // select list checkbox - cy.get('#cyp-conformance-list-checkbox').find('input').first().click({ force: true }).should('be.checked'); - - // click apply - cy.contains('button', 'Apply').click(); - cy.contains('.v-toast', 'Rule applied'); - cy.wait(1000) - - cy.get('#backPage').click(); - cy.contains('.swal2-title', 'SAVE YOUR RULE'); - cy.contains('button', 'No').click(); - cy.url().should('include', 'files'); - }); -}); diff --git a/cypress/fixtures/doneTesting/fileUploadEtc.cy.js b/cypress/fixtures/doneTesting/fileUploadEtc.cy.js deleted file mode 100644 index 4a3d901..0000000 --- a/cypress/fixtures/doneTesting/fileUploadEtc.cy.js +++ /dev/null @@ -1,11 +0,0 @@ -// Testing File Page: upload, download, delete, rename -// upload: 第一階段上傳錯誤、第二階段上傳錯誤、改名、改名前後空格、回上一頁、清空 -// delete: 第一階段刪除錯誤訊息 -// rename: 五種改名介面是否有出現 -describe('File Upload etc', () => { - beforeEach(() => { - cy.visit('https://REDACTED-HOST/'); - cy.login(); - cy.visit('https://REDACTED-HOST/files'); - }); -}); diff --git a/cypress/fixtures/doneTesting/filterFunnel.cy.js b/cypress/fixtures/doneTesting/filterFunnel.cy.js deleted file mode 100644 index 9f8ee21..0000000 --- a/cypress/fixtures/doneTesting/filterFunnel.cy.js +++ /dev/null @@ -1,308 +0,0 @@ -// 每一 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.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() 獲取
  • 元素的內容 - 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() 獲取
  • 元素的內容 - 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() 獲取
  • 元素的內容 - 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" 的 - cy.contains('p', 'Start activity') - .parents('div') // 回到 p 的父層 div - .eq(1) // 同階層的第二個 div - .find('table') // 向下找 table - .as('startTable'); // 將選取的元素命名,使用 @startTable 來操作 - // 選取 "end" 的
    - 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() 獲取
  • 元素的內容 - 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') // 在下一個相鄰元素中尋找指定的 元素 - .check({ force: true }); // 對該 元素進行勾選操作 - - // 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() 獲取
  • 元素的內容 - 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() 獲取
  • 元素的內容 - 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() 獲取
  • 元素的內容 - const percentage = $li.find('span').eq(1).text(); // li 底下找到第二個 span - expect(percentage).not.to.equal('100%'); // text !== 100% 來判斷數據是否有變化 - }); - }); - -}); diff --git a/cypress/fixtures/doneTesting/loginToLogout.cy.js b/cypress/fixtures/doneTesting/loginToLogout.cy.js deleted file mode 100644 index 54f7528..0000000 --- a/cypress/fixtures/doneTesting/loginToLogout.cy.js +++ /dev/null @@ -1,44 +0,0 @@ -// 之後要優化: 每一個測試步驟要分開寫,不寫在同一個 it 裡面、將測試寫成 report 輸出成 html(嘗試)、功能模組化 -const baseUrl = Cypress.env('baseUrl'); - -describe("Login to Logout", () => { - before(() => { - cy.visit(baseUrl); // 測試可否進入網站 - cy.contains("h2", "LOGIN"); // 是否轉址到 /login 並顯示畫面 - cy.url().should('include', 'login') // url path 要有 'Login',確定進入 login page - }) - - it("test login success and error", () => { - // 驗證帳密是否刪除前後空白、錯誤帳密是否顯示驗證、Button display - cy.fixture('users/id-not-exists').then(({username, password}) => { - cy.get('.btn-lg').should('be.disabled'); - cy.get('#account').should('have.focus').type(username); - cy.get('.btn-lg').should('be.disabled'); - cy.get('#password').type(password); - cy.get('.btn-lg').click(); - cy.get('#account').should('have.value', 'test'); - cy.get('#password').should('have.value', 'test'); - cy.get('form').submit(); - cy.contains("p", "Incorrect account or password."); - cy.url().should('include', 'login'); - }); - - // 正確帳密登入 - cy.get('#account').clear().type(` ${Cypress.env('user').username} `); - cy.get('#password').clear().type(` ${Cypress.env('user').password} `); - cy.get('.btn-lg').click(); - cy.get('#account').should('have.value', Cypress.env('user').username); - cy.get('#password').should('have.value', Cypress.env('user').password); - cy.get('form').submit(); // 選取 form 表單並發送 - - // 轉址到 files 頁 - cy.url().should('include', 'files'); - cy.get('a #iconMember').scrollIntoView().click(); - - // 轉址到會員頁 - cy.url().should('include', 'member-area'); - - // 登出 - cy.get('.btn-sm').contains('Logout').click(); - }); -}); diff --git a/cypress/fixtures/doneTesting/performance.cy.js b/cypress/fixtures/doneTesting/performance.cy.js deleted file mode 100644 index dc76f86..0000000 --- a/cypress/fixtures/doneTesting/performance.cy.js +++ /dev/null @@ -1,31 +0,0 @@ -describe('Performance', ()=>{ - beforeEach(() => { - cy.visit('https://REDACTED-HOST/files'); - cy.login(); - cy.visit('https://REDACTED-HOST/files'); - }); - - it('Anchor', () => { - // enter Map - cy.url().should('include', 'files'); - cy.get('table tr') - .filter(':contains("Log")') - .first() // 選擇集合中第一個元素 - .dblclick(); - cy.contains('h2', 'DISCOVER'); - cy.url().should('include', 'discover/map/log'); - cy.wait(2000); - // enter Performance - cy.contains('li', 'PERFORMANCE').click(); - cy.url().should('include', 'discover/performance/log'); - // Anchor 網頁不會捲動到錨點位置是因為 Cypress 是模擬使用者行為而非準確瀏覽器行為 - cy.get('aside li a[href="#cycleTime"]').click(); - cy.url().should('include', '#cycleTime'); - cy.get('aside li a[href="#processingTime"]').click(); - cy.url().should('include', '#processingTime'); - cy.get('aside li a[href="#waitingTime"]').click(); - cy.url().should('include', '#waitingTime'); - cy.get('aside li a[href="#cases"]').click(); - cy.url().should('include', '#cases'); - }); -}) diff --git a/cypress/fixtures/doneTesting/saveLogAndFilter.cy.js b/cypress/fixtures/doneTesting/saveLogAndFilter.cy.js deleted file mode 100644 index b2fac8b..0000000 --- a/cypress/fixtures/doneTesting/saveLogAndFilter.cy.js +++ /dev/null @@ -1,131 +0,0 @@ -// 每一 describe 就是一個測試套件 -// 每一 it 就是一個測試命令 -describe('Save Log and Filter', ()=>{ - beforeEach(() => { - cy.visit('https://REDACTED-HOST/files'); - cy.login(); - cy.visit('https://REDACTED-HOST/files'); - }); - - it('save log', () => { - // enter log - cy.url().should('include', 'files'); - 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) - - // select radio - 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) - - // 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 log - cy.contains('button', 'Save').click(); - cy.contains('.swal2-title', 'SAVE NEW FILTER'); - cy.contains('button', 'OK').click(); - cy.contains('#swal2-validation-message', 'You need to write something!'); // 不輸入要跳驗證 - cy.get('.swal2-input').clear().type('random-E2Etesting'); - cy.contains('button', 'OK').click(); - cy.contains('#swal2-html-container', 'random-E2Etesting'); - - // 回到 Files 檢查是否有新增 Filter 'random-E2Etesting'. - cy.visit('https://REDACTED-HOST/files'); - cy.url().should('include', 'files'); - 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/map/filter'); // 斷言在 discover/map/filter/: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.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) - - // select radio - 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) - - // 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(); - cy.wait(3000) - - cy.get('#backPage').click(); - cy.contains('.swal2-title', 'SAVE YOUR FILTER'); - cy.contains('button', 'No').click(); - cy.url().should('include', 'files'); - }) -}); diff --git a/src/constants/constants.js b/src/constants/constants.js index 344ef8f..ecfa13e 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -28,35 +28,7 @@ export const knownLayoutChartOption = { right: 8, } }; -export const accountList = [ - { - id: 12345, - username: "REDACTED-USER1", - name: "Alice Zheng", - is_admin: true, - is_active: false, - detail: "abcde", - is_sso: true, - }, - { - id: 345, - username: "REDACTED-USER2", - name: "Mike Chen", - is_admin: false, - is_active: true, - detail: "abcde", - is_sso: false, - }, - { - id: 88, - username: "REDACTED-USER3", - name: "Tory Cheng", - is_admin: true, - is_active: true, - detail: "abcde", - is_sso: false, - }, -]; + export const knownScaleLineChartOptions = { x: { type: 'time',