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

@@ -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);
})