Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #622

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cypress/e2e/signIn.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

describe('Sign In page', () => {
it('should provide an ability to log in', () => {
// Define valid test credentials
const credentials = {
email: '[email protected]',
password: 'password123', // Replace with actual valid credentials
username: 'TestUser'
};
Comment on lines +6 to +10

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'username' field in the credentials object might not be necessary if the login process only requires an email and password. Ensure that the application uses this field for displaying the username in the navigation header after a successful login.


// Visit the application
cy.visit('https://react-redux.realworld.io');

// Navigate to the "Sign In" page
cy.contains('a', 'Sign in').click();

// Fill in the email and password fields
cy.get('input[type="email"]').type(credentials.email);
cy.get('input[type="password"]').type(credentials.password);

// Click on the [Sign In] button
cy.get('button[type="submit"]').click();

// Assert that the username appears in the site navigation header
cy.get('.navbar').should('contain', credentials.username);
});
});
Loading