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

FRW-7936 Adjusted tests #62

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ export class B2bCartRepository implements CartRepository {
cy.get('.product-quick-add-form__button');
findCartItemRemovalForm = (sku: string): Cypress.Chainable => {
return cy.get('[action]').filter((index, element) => {
if (Cypress.env('isDynamicStoreEnabled')) {
const regex = new RegExp(`^/\\w+/\\w+/cart/async/remove/${sku}/\\w+`);
dimitriyTsemma marked this conversation as resolved.
Show resolved Hide resolved
return regex.test(element.getAttribute('action') ?? '');
}
const regex = new RegExp(`^/\\w+/cart/async/remove/${sku}/\\w+`);
return regex.test(element.getAttribute('action') ?? '');
});
};
findCartItemRemovalSubmit = (sku: string): Cypress.Chainable => this.findCartItemRemovalForm(sku).find('button');
findCartItemChangeQuantityForm = (sku: string): Cypress.Chainable => {
return cy.get('[action]').filter((index, element) => {
if (Cypress.env('isDynamicStoreEnabled')) {
const regex = new RegExp(`^/\\w+/\\w+/cart/async/change-quantity/${sku}$`);
return regex.test(element.getAttribute('action') ?? '');
}
const regex = new RegExp(`^/\\w+/cart/async/change-quantity/${sku}$`);
return regex.test(element.getAttribute('action') ?? '');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ export class B2bMpCartRepository implements CartRepository {
cy.get('.product-quick-add-form__button');
findCartItemRemovalForm = (sku: string): Cypress.Chainable => {
return cy.get('[action]').filter((index, element) => {
if (Cypress.env('isDynamicStoreEnabled')) {
const regex = new RegExp(`^/\\w+/\\w+/cart/async/remove/${sku}/\\w+`);
return regex.test(element.getAttribute('action') ?? '');
}
const regex = new RegExp(`^/\\w+/cart/async/remove/${sku}/\\w+`);
return regex.test(element.getAttribute('action') ?? '');
});
};
findCartItemRemovalSubmit = (sku: string): Cypress.Chainable => this.findCartItemRemovalForm(sku).find('button');
findCartItemChangeQuantityForm = (sku: string): Cypress.Chainable => {
return cy.get('[action]').filter((index, element) => {
if (Cypress.env('isDynamicStoreEnabled')) {
const regex = new RegExp(`^/\\w+/\\w+/cart/async/change-quantity/${sku}$`);
return regex.test(element.getAttribute('action') ?? '');
}
const regex = new RegExp(`^/\\w+/cart/async/change-quantity/${sku}$`);
return regex.test(element.getAttribute('action') ?? '');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@ export class B2cCartRepository implements CartRepository {
cy.get('[data-qa="product-quick-add-form-submit-button"]');
findCartItemRemovalForm = (sku: string): Cypress.Chainable => {
return cy.get('[action]').filter((index, element) => {
if (Cypress.env('isDynamicStoreEnabled')) {
const regex = new RegExp(`^/\\w+/\\w+/cart/async/remove/${sku}/\\w+`);
return regex.test(element.getAttribute('action') ?? '');
}
const regex = new RegExp(`^/\\w+/cart/async/remove/${sku}/\\w+`);
return regex.test(element.getAttribute('action') ?? '');
});
};
findCartItemChangeQuantityForm = (sku: string): Cypress.Chainable => {
return cy.get('[action]').filter((index, element) => {
if (Cypress.env('isDynamicStoreEnabled')) {
const regex = new RegExp(`^/\\w+/\\w+/cart/async/change-quantity/${sku}$`);
return regex.test(element.getAttribute('action') ?? '');
}
const regex = new RegExp(`^/\\w+/cart/async/change-quantity/${sku}$`);
return regex.test(element.getAttribute('action') ?? '');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@ export class B2cMpCartRepository implements CartRepository {
cy.get('[data-qa="product-quick-add-form-submit-button"]');
findCartItemRemovalForm = (sku: string): Cypress.Chainable => {
return cy.get('[action]').filter((index, element) => {
if (Cypress.env('isDynamicStoreEnabled')) {
const regex = new RegExp(`^/\\w+/\\w+/cart/async/remove/${sku}/\\w+`);
return regex.test(element.getAttribute('action') ?? '');
}
const regex = new RegExp(`^/\\w+/cart/async/remove/${sku}/\\w+`);
return regex.test(element.getAttribute('action') ?? '');
});
};
findCartItemRemovalSubmit = (sku: string): Cypress.Chainable => this.findCartItemRemovalForm(sku).find('button');
findCartItemChangeQuantityForm = (sku: string): Cypress.Chainable => {
return cy.get('[action]').filter((index, element) => {
if (Cypress.env('isDynamicStoreEnabled')) {
const regex = new RegExp(`^/\\w+/\\w+/cart/async/change-quantity/${sku}$`);
return regex.test(element.getAttribute('action') ?? '');
}
const regex = new RegExp(`^/\\w+/cart/async/change-quantity/${sku}$`);
return regex.test(element.getAttribute('action') ?? '');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ export class B2bCommentCartRepository implements CommentCartRepository {
getCommentThreadListSection = (): Cypress.Chainable =>
cy.get('[data-qa="component cart-sidebar-item"]').find('[data-qa="component add-comment-form"]').parent();
getAddCommentButtonSelector = (): string => '[data-qa="component icon"]';
getRemoveCommentButtonSelector = (): string => '[formaction="/en/comment/async/remove"]';
getRemoveCommentButtonSelector = (): string => {
if (Cypress.env('isDynamicStoreEnabled')) {
return '[formaction="/DE/en/comment/async/remove"]';
}

return '[formaction="/en/comment/async/remove"]';
};
getFirstCommentTextarea = (): Cypress.Chainable => {
this.getCommentThreadListSection().first().find('button:contains("Edit")').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ export class B2bMpCommentCartRepository implements CommentCartRepository {
getCommentThreadListSection = (): Cypress.Chainable =>
cy.get('[data-qa="component cart-sidebar-item"]').find('[data-qa="component add-comment-form"]').parent();
getAddCommentButtonSelector = (): string => '[data-qa="component icon"]';
getRemoveCommentButtonSelector = (): string => '[formaction="/en/comment/async/remove"]';
getRemoveCommentButtonSelector = (): string => {
if (Cypress.env('isDynamicStoreEnabled')) {
return '[formaction="/DE/en/comment/async/remove"]';
}

return '[formaction="/en/comment/async/remove"]';
};
getFirstCommentTextarea = (): Cypress.Chainable => {
this.getCommentThreadListSection().first().find('button:contains("Edit")').click();

Expand Down
Loading