Discover: SidebarFilter Timeframes fix startDate & endDate.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
const { defineConfig } = require("cypress");
|
const { defineConfig } = require("cypress");
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
|
defaultCommandTimeout: 6000,
|
||||||
e2e: {
|
e2e: {
|
||||||
specPattern: "cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}",
|
specPattern: "cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}",
|
||||||
},
|
},
|
||||||
|
|||||||
78
cypress/e2e/filterFunnel.cy.js
Normal file
78
cypress/e2e/filterFunnel.cy.js
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
// 每一 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.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
||||||
|
cy.url().should('include', 'discover/logs'); // 斷言在 discover/logs/:id 路徑
|
||||||
|
cy.wait(3000)
|
||||||
|
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').click();
|
||||||
|
cy.get('.v-toast__text').should('contain', 'Not selected');
|
||||||
|
|
||||||
|
// 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')
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
// it('save log', () => {
|
||||||
|
// // 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)
|
||||||
|
|
||||||
|
// 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');
|
||||||
|
// });
|
||||||
|
});
|
||||||
@@ -17,7 +17,7 @@ describe('Save Log and Filter', ()=>{
|
|||||||
|
|
||||||
// select radio
|
// select radio
|
||||||
cy.get('#iconFilter').click(); // 選取 Filter sidebar
|
cy.get('#iconFilter').click(); // 選取 Filter sidebar
|
||||||
cy.get('input#Sequence0').should('be.checked'); // 選取 Radio 'Sequence'
|
cy.get('input#').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')
|
||||||
@@ -283,10 +283,10 @@ export default{
|
|||||||
// Slider
|
// Slider
|
||||||
this.selectArea = [0, this.selectRange];
|
this.selectArea = [0, this.selectRange];
|
||||||
// Calendar
|
// Calendar
|
||||||
this.startMinDate = new Date(getMoment(this.filterTimeframe.x_axis.min).startOf('day').local().format());
|
this.startMinDate = new Date(getMoment(this.filterTimeframe.x_axis.min).format());
|
||||||
this.startMaxDate = new Date(getMoment(this.filterTimeframe.x_axis.max).startOf('day').local().format());
|
this.startMaxDate = new Date(getMoment(this.filterTimeframe.x_axis.max).format());
|
||||||
this.endMinDate = new Date(getMoment(this.filterTimeframe.x_axis.min).startOf('day').local().format());
|
this.endMinDate = new Date(getMoment(this.filterTimeframe.x_axis.min).format());
|
||||||
this.endMaxDate = new Date(getMoment(this.filterTimeframe.x_axis.max).startOf('day').local().format());
|
this.endMaxDate = new Date(getMoment(this.filterTimeframe.x_axis.max).format());
|
||||||
// 讓日曆的範圍等於時間軸的範圍
|
// 讓日曆的範圍等於時間軸的範圍
|
||||||
this.startTime = this.startMinDate;
|
this.startTime = this.startMinDate;
|
||||||
this.endTime = this.startMaxDate;
|
this.endTime = this.startMaxDate;
|
||||||
@@ -295,8 +295,8 @@ export default{
|
|||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
this.selectArea = [0, this.selectRange];
|
this.selectArea = [0, this.selectRange];
|
||||||
this.resizeMask(this.chart);
|
this.resizeMask(this.chart);
|
||||||
this.startTime = new Date(getMoment(this.filterTimeframe.x_axis.min).startOf('day').local().format());
|
this.startTime = new Date(getMoment(this.filterTimeframe.x_axis.min).format());
|
||||||
this.endTime = new Date(getMoment(this.filterTimeframe.x_axis.max).startOf('day').local().format());
|
this.endTime = new Date(getMoment(this.filterTimeframe.x_axis.max).format());
|
||||||
this.timeFrameStartEnd;
|
this.timeFrameStartEnd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user