|
@@ -20,4 +20,26 @@ describe('Login Page', () => {
|
|
// Wait for the login process to complete
|
|
// Wait for the login process to complete
|
|
cy.contains('登录成功').should('be.visible', { timeout: 10000 });
|
|
cy.contains('登录成功').should('be.visible', { timeout: 10000 });
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ it('should show an error message for incorrect credentials', () => {
|
|
|
|
+ // Visit the base URL
|
|
|
|
+ cy.visit('/');
|
|
|
|
+
|
|
|
|
+ // Wait for the page to load and ensure the elements are present
|
|
|
|
+ cy.get('[data-testid="login-username-input"]').should('be.visible');
|
|
|
|
+ cy.get('[data-testid="login-password-input"]').should('be.visible');
|
|
|
|
+ cy.get('[data-testid="login-submit-button"]').should('be.visible');
|
|
|
|
+
|
|
|
|
+ // Enter the incorrect username
|
|
|
|
+ cy.get('[data-testid="login-username-input"]').type('wronguser');
|
|
|
|
+
|
|
|
|
+ // Enter the incorrect password
|
|
|
|
+ cy.get('[data-testid="login-password-input"]').type('wrongpassword');
|
|
|
|
+
|
|
|
|
+ // Click the login button
|
|
|
|
+ cy.get('[data-testid="login-submit-button"]').click();
|
|
|
|
+
|
|
|
|
+ // Wait for the error message to be visible
|
|
|
|
+ cy.contains('登录失败').should('be.visible', { timeout: 10000 });
|
|
|
|
+ });
|
|
});
|
|
});
|