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

cypress e2e test #617

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
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { defineConfig } = require('cypress');

module.exports = defineConfig({
e2e: {
baseUrl: 'https://conduit.mate.academy/',
setupNodeEvents(on, config) {
}
}
Expand Down
11 changes: 10 additions & 1 deletion cypress/e2e/signIn.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

describe('Sign In page', () => {
it('should provide an ability to log in', () => {

cy.visit('/');
cy.contains('.nav-link', 'Sign in')
.should('exist').click();
cy.url().should('include', '/login');
cy.get('h1').should('contain.text', 'Sign in');
cy.get(':nth-child(1) > .form-control').type('[email protected]');
cy.get(':nth-child(2) > .form-control').type('12345678');
Comment on lines +10 to +11

Choose a reason for hiding this comment

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

Ensure that the email and password used for testing are valid and correspond to a test account in your application. Using real user credentials is not recommended for automated tests.

cy.get('.btn').click();
cy.get(':nth-child(4) > .nav-link').click();
cy.get('h4').should('contain.text', 'vladfil');
Comment on lines +13 to +14

Choose a reason for hiding this comment

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

The selector :nth-child(4) > .nav-link assumes a specific structure of the navigation bar. If the structure changes, this selector might break. Consider using a more robust selector if possible.

});
});
Binary file added cypress/videos/signIn.cy.js.mp4
Binary file not shown.