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 #306

Open
wants to merge 2 commits 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
24 changes: 21 additions & 3 deletions cypress/e2e/checkout.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
import HomeAndCataloguePageObject
from '../support/pages/homeCatalogue.pageObject';

const homePage = new HomeAndCataloguePageObject();
/// <reference types='cypress' />

describe('', () => {

Choose a reason for hiding this comment

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

The describe block is missing a description. It's important to provide a meaningful description to understand what this test suite is about.

Choose a reason for hiding this comment

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

The describe block is missing a description. It's important to provide a meaningful description to understand what this test suite is about.

before(() => {

homePage.visit();
});

it('', () => {

it('should allow a user to add a product to the car', () => {

Choose a reason for hiding this comment

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

The it block is missing a description. Please provide a clear description of what this test case is intended to verify.

homePage.clickOnLinkOther('Laptops');
cy.get('.hrefch').contains('a', 'Sony vaio i7').click();
cy.get('.col-sm-12 > .btn').click();

Choose a reason for hiding this comment

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

After clicking 'Add to cart', you should assert the message in the alert to ensure it matches the expected result as per the task requirements.

Choose a reason for hiding this comment

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

There should be an assertion here to verify that an alert is shown after clicking the button to add a product to the cart. This is crucial to ensure that the action was successful.

cy.url().should('include', '#');
cy.get('#cartur').click();
cy.url().should('include', 'cart.html');
cy.get('[data-target="#orderModal"').click();
cy.get('#name').type('Roma');
cy.get('#country').type('Uk');
cy.get('#city').type('Lviv');
cy.get('#card').type('12345678');
cy.get('#month').type('September');
cy.get('#year').type('2024');
cy.get('[onclick="purchaseOrder()"]').click();

Choose a reason for hiding this comment

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

There should be an assertion to verify that the entered data is shown on the modal after clicking 'Purchase'. This is required to ensure the test case meets the task requirements.

Choose a reason for hiding this comment

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

Consider adding assertions to verify that the entered data is correctly shown on the modal after clicking 'Purchase'. This will ensure that the data is being handled correctly.

homePage.clickOnButton('OK');
});
});
10 changes: 10 additions & 0 deletions cypress/support/pages/homeCatalogue.pageObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ class HomeAndCataloguePageObject extends PageObject {
.click();
}

clickOnLinkOther(linkName) {
cy.contains('.list-group-item', linkName)
.click();
}

clickOnButton(linkName) {
cy.contains('.confirm', linkName)
.click();
}

clickOnCategory(categoryName) {
cy.contains('#itemc', categoryName)
.click();
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.