cypress-saveLogAndFilter: select Activity & checked all event done.

This commit is contained in:
chiayin
2023-05-04 18:01:28 +08:00
parent 739718f3d5
commit 7daac78bea
7 changed files with 31 additions and 57 deletions

View File

@@ -6,18 +6,3 @@ module.exports = defineConfig({
specPattern: "cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}",
},
});
// {
// "video": false,
// "env": {
// "DISPLAY": ":99"
// },
// "chromeWebSecurity": false,
// "viewportHeight": 1080,
// "viewportWidth": 1920,
// "numTestsKeptInMemory": 10,
// "browser": "chrome",
// "headless": true,
// "includeShadowDom": true,
// "watchForFileChanges": true
// }

View File

@@ -1,27 +1,36 @@
// 每一 describe 就是一個測試套件
// 每一 it 就是一個測試命令
describe('Save Log and Filter', ()=>{
// 每一 it 就是一個測試命令
// it('test', () => {
// cy.visit('http://');
// cy.get('#id').click();
// cy.title().shoule('include', 'DISCOVER') // 檢查標題看是否有點擊成功
// cy.url().should('include', 'discover/logs') // url 需要一個斷言
// });
beforeEach(() => {
cy.visit('https://REDACTED-HOST/files');
cy.login();
cy.visit('https://REDACTED-HOST/files');
});
it('log', () => {
cy.visit('https://REDACTED-HOST/files');
console.log(cy.title());
console.log(cy.url());
})
})
it('save log', () => {
// 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)
// 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'); // 打開隱藏項目並選取
});
});
// cy.visit('https://REDACTED-HOST/files');
// cy.get('.min-w-\[216px\]:nth-child(1) > div > .text-neutral-500').click();
// cy.get('.text-primary').click();

View File

@@ -21,8 +21,6 @@ Cypress.Commands.add('login', () => {
password: Cypress.env('user').password
}
}).then(response => {
console.log(response);
cy.log(response)
const token = response.body.access_token;
cy.setCookie('luciaToken', token);
})

View File

@@ -10,7 +10,7 @@
<DataTable v-model:selection="select" :value="data" breakpoint="0" tableClass="w-full !border-separate !border-spacing-x-2 !table-auto text-sm" @row-select="onRowSelect" @row-unselect="onRowUnselect" @row-select-all="onRowSelectAll" @row-unselect-all="onRowUnelectAll">
<ColumnGroup type="header">
<Row>
<Column selectionMode="multiple" headerClass="w-8 !p-2 !bg-neutral-10 !border-neutral-500 sticky top-0 left-0 z-10 bg-neutral-10"></Column>
<Column selectionMode="multiple" headerClass="w-8 !p-2 !bg-neutral-10 !border-neutral-500 sticky top-0 left-0 z-10 bg-neutral-10 allCheckboxAct"></Column>
<Column field="label" header="Activity" headerClass="!bg-neutral-10 !border-neutral-500 !py-2 sticky top-0 left-0 z-10 bg-neutral-10" sortable />
<Column field="occ_value" header="Occurrences" headerClass="!bg-neutral-10 !border-neutral-500 !py-2 sticky top-0 left-0 z-10 bg-neutral-10" sortable :colspan="3" />
<Column field="case_value" headerClass="!bg-neutral-10 !border-neutral-500 !py-2 sticky top-0 left-0 z-10 bg-neutral-10" header="Cases with Activity" sortable :colspan="3" />
@@ -46,24 +46,6 @@ import Search from '@/components/Search.vue';
export default {
props: ['tableTitle', 'tableData', 'tableSelect', 'progressWidth'],
// {
// tableTitle: {
// type: String,
// require: true,
// },
// tableData: {
// type: Array,
// require: true,
// },
// tableSelect: {
// type: Array,
// require: true,
// },
// progressWidth: {
// type: Function,
// require: false,
// }
// },
data() {
return {
select: this.tableSelect,

View File

@@ -2,8 +2,8 @@
<Sidebar :visible="sidebarFilter" :closeIcon="'pi pi-chevron-left'" :modal="false" position="left" :dismissable="true" :baseZIndex="15" class="!w-11/12 !bg-neutral-100">
<template #header>
<ul class="flex space-x-4">
<li class="h1 border-r-2 border-neutral-300 pr-4 cursor-pointer hover:text-neutral-900 hover:duration-700" @click="switchTab('filter')" :class="tab === 'filter'? 'text-neutral-900': 'text-neutral-500'">Filter</li>
<li class="h1 border-r-2 border-neutral-300 pr-4 cursor-pointer hover:text-neutral-900 hover:duration-700" @click="switchTab('funnel')" :class="tab === 'funnel'? 'text-neutral-900': 'text-neutral-500'">Funnel</li>
<li class="h1 border-r-2 border-neutral-300 pr-4 cursor-pointer hover:text-neutral-900 hover:duration-700" @click="switchTab('filter')" :class="tab === 'filter'? 'text-neutral-900': 'text-neutral-500'" id="tabFilter">Filter</li>
<li class="h1 border-r-2 border-neutral-300 pr-4 cursor-pointer hover:text-neutral-900 hover:duration-700" @click="switchTab('funnel')" :class="tab === 'funnel'? 'text-neutral-900': 'text-neutral-500'" id="tabFunnel">Funnel</li>
</ul>
</template>
<!-- header: filter -->

View File

@@ -8,7 +8,7 @@
</span>
</li>
<li class="inline-flex items-center justify-center border border-neutral-500 rounded-full w-9 h-9 cursor-pointer bg-neutral-50 drop-shadow hover:border-primary" @click="sidebarFilter = true" :class="{'border-primary': sidebarFilter}">
<span class="material-symbols-outlined text-2xl hover:text-primary p-1.5" :class="[sidebarFilter ? 'text-primary' : 'text-neutral-500']">
<span class="material-symbols-outlined text-2xl hover:text-primary p-1.5" :class="[sidebarFilter ? 'text-primary' : 'text-neutral-500']" id="iconFilter">
tornado
</span>
</li>

View File

@@ -40,9 +40,9 @@
<!-- All Files type of List -->
<div class="overflow-y-scroll overflow-x-hidden scrollbar -mx-2 max-h-[calc(100vh_-_480px)]" v-if="!switchListOrGrid">
<DataTable :value="allFiles" dataKey="id" tableClass="w-full !border-separate !border-spacing-x-2 text-sm cursor-pointer" breakpoint="0" @row-dblclick="enterDiscover($event.data)">
<Column field="name" header="Name" bodyClass="font-medium" sortable></Column>
<Column field="name" header="Name" bodyClass="font-medium fileName" sortable></Column>
<Column field="parentLog" header="Parent log" bodyClass="text-neutral-500" sortable></Column>
<Column field="fileType" header="File type" bodyClass="text-neutral-500" sortable></Column>
<Column field="fileType" header="File type" bodyClass="text-neutral-500 fileType" sortable></Column>
<Column field="owner.name" header="Owner" bodyClass="text-neutral-500" sortable></Column>
<Column field="updated_at" header="Last update" bodyClass="text-neutral-500" sortable></Column>
</DataTable>