|
@@ -5,20 +5,19 @@ import LoginPage from '../support/pageObjects/LoginPage';
|
|
|
describe('Login Page', () => {
|
|
|
const loginPage = new LoginPage();
|
|
|
|
|
|
- it('should successfully log in with correct credentials', () => {
|
|
|
+ beforeEach(() => {
|
|
|
loginPage.visit();
|
|
|
loginPage.getUsernameInput().should('be.visible');
|
|
|
loginPage.getPasswordInput().should('be.visible');
|
|
|
loginPage.getSubmitButton().should('be.visible');
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should successfully log in with correct credentials', () => {
|
|
|
loginPage.login('admin', '123456');
|
|
|
cy.contains('登录成功').should('be.visible', { timeout: 10000 });
|
|
|
});
|
|
|
|
|
|
it('should show an error message for incorrect credentials', () => {
|
|
|
- loginPage.visit();
|
|
|
- loginPage.getUsernameInput().should('be.visible');
|
|
|
- loginPage.getPasswordInput().should('be.visible');
|
|
|
- loginPage.getSubmitButton().should('be.visible');
|
|
|
loginPage.login('wronguser', 'wrongpassword');
|
|
|
cy.contains('登录失败').should('be.visible', { timeout: 10000 });
|
|
|
});
|