Adds SFRA 6.0

This commit is contained in:
Isaac Vallee
2021-12-21 10:57:31 -08:00
parent d04eb5dd16
commit 823c7608c3
1257 changed files with 137087 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
const I = actor();
module.exports = {
locators: {
addressTitle: '#addressId.form-control',
fName: '#firstName.form-control',
lName: '#lastName.form-control',
address1: '#address1.form-control',
country: '#country.form-control',
state: '#state.form-control',
city: '#city.form-control',
zip: '#zipCode.form-control',
phone: '#phone.form-control',
saveBtn: '.btn.btn-save.btn-block.btn-primary',
nameOnCard: '#cardOwner.form-control',
ccNum: '#cardNumber.form-control',
expMonth: '#month.form-control',
expYear: '#year.form-control',
defaultPayment: '.custom-control-label',
currentPassword: '#currentPassword.form-control',
newPassword: '#newPassword.form-control',
newPasswordConfirm: '#newPasswordConfirm.form-control',
confirmEmail: '#confirmEmail.form-control',
confirmPassword: '#password.form-control',
addNew: '.card-link',
backToAccount: '.text-center.back-to-account-link',
viewAll: '.pull-right',
removeProductBtn: '.remove-btn.remove-payment.btn-light',
removeProductModal: '.modal-content',
removeProductConfirm: '.btn.btn-primary.delete-confirmation-btn',
loggedInAccountNav: '.user.nav-item',
accountLogOut: '.user .popover li'
},
addAddress(addressTitle, fName, lName, address1, country, state, city, zipcode, phone) {
I.fillField(this.locators.addressTitle, addressTitle);
I.fillField(this.locators.fName, fName);
I.fillField(this.locators.lName, lName);
I.fillField(this.locators.address1, address1);
I.selectOption(this.locators.country, country);
I.selectOption(this.locators.state, state);
I.fillField(this.locators.city, city);
I.fillField(this.locators.zip, zipcode);
I.fillField(this.locators.phone, phone);
I.click(this.locators.saveBtn);
},
clickAddAddress() {
let locator = locate(this.locators.addNew)
.withAttr({ 'aria-label': 'Add New Address' });
I.click(locator);
},
clickAddPayment() {
let locator = locate(this.locators.addNew)
.withAttr({ 'aria-label': 'Add New Payment' });
I.click(locator);
},
clickEditProfile() {
let locator = locate(this.locators.viewAll)
.withAttr({ 'aria-label': 'Edit Profile' });
I.click(locator);
},
clickEditPassword() {
let locator = locate(this.locators.viewAll)
.withAttr({ 'aria-label': 'Change Password' });
I.click(locator);
},
clickAddressBook() {
let locator = locate(this.locators.viewAll)
.withAttr({ 'aria-label': 'View Address Book' });
I.click(locator);
},
clickEditAddress(addName) {
let locator = locate(this.locators.viewAll)
.withAttr({ 'aria-label': `Edit Address : ${addName} (Default Address)` });
I.click(locator);
},
editAddress(addName) {
let locator = locate('#addressId.form-control');
I.wait(1);
I.fillField(locator, addName);
I.wait(1);
I.click(this.locators.saveBtn);
},
addPayment(nameOnCard, ccNum, expMonth, expYear) {
I.fillField(this.locators.nameOnCard, nameOnCard);
I.fillField(this.locators.ccNum, ccNum);
I.scrollTo(this.locators.expMonth);
I.selectOption(this.locators.expMonth, expMonth);
I.selectOption(this.locators.expYear, expYear);
I.click(this.locators.defaultPayment);
I.click(this.locators.saveBtn);
I.click(this.locators.backToAccount);
},
viewAllPayments() {
let locator = locate(this.locators.viewAll)
.withAttr({ 'aria-label': 'View saved payment methods' });
I.click(locator);
},
removePayment(deletePaymentModalText) {
let locator = locate(this.locators.removeProductBtn).last();
I.click(locator);
I.waitForText(deletePaymentModalText);
within(this.locators.removeProductModal, () => {
I.click(this.locators.removeProductConfirm);
});
},
changePassword(currentPassword, newPassword) {
I.fillField(this.locators.currentPassword, currentPassword);
I.fillField(this.locators.newPassword, newPassword);
I.fillField(this.locators.newPasswordConfirm, newPassword);
I.click(this.locators.saveBtn);
},
editProfile(phone, email, password) {
I.fillField(this.locators.phone, phone);
I.fillField(this.locators.confirmEmail, email);
I.fillField(this.locators.confirmPassword, password);
I.click(this.locators.saveBtn);
},
logOut() {
I.click(this.locators.loggedInAccountNav);
let locator = locate(this.locators.accountLogOut).last();
I.click(locator);
}
};

View File

@@ -0,0 +1,86 @@
const I = actor();
module.exports = {
locators: {
lineItemQuantity: '.form-control.quantity.custom-select',
totalItemQuantity: 'h2.number-of-items',
lineItemPriceTotal: 'span.value',
totalItemPrice: '.line-item-total-price',
shippingCost: '.text-right.shipping-cost',
taxTotal: '.text-right.tax-total',
estimatedTotal: '.text-right.grand-total',
cartIcon: '.minicart-icon.fa.fa-shopping-bag',
checkoutBtn: '.btn.btn-primary.btn-block.checkout-btn',
removeProductBox: '.hidden-md-down',
removeProductBtn: '.remove-btn-lg.remove-product.btn.btn-light',
removeProductModal: '.modal-content',
removeProductModalConfirm: '.btn.btn-primary.cart-delete-confirmation-btn',
editQuantitySelector: '.form-control.quantity.custom-select',
miniCartEditQty: 'select[data-pid="<pid>"]',
lineItemName: '.line-item-name',
miniCartLineItemName: '.line-item-name > span',
lineItemAttributes: '.item-attributes .line-item-attributes',
subTotal: '.text-right.sub-total',
removeProductButton: '.remove-btn.remove-product',
removeFromMiniCartButton: 'button[data-pid="<pid>"]',
miniCartQuantity: '.minicart-quantity',
miniCartPopover: '.popover.popover-bottom.show'
},
verifyCart(totalQuantity, itemPrice, totalItemPrice, shipping, tax, estimatedTotal) {
I.see(totalQuantity, this.locators.lineItemQuantity);
I.see(itemPrice, this.locators.lineItemPriceTotal);
I.see(totalItemPrice, this.locators.totalItemPrice);
I.see(shipping, this.locators.shippingCost);
I.see(tax, this.locators.taxTotal);
I.see(estimatedTotal, this.locators.estimatedTotal);
},
verifyCartQuantity(totalQuantity) {
I.see(totalQuantity + ' Items', this.locators.totalItemQuantity);
},
verifyMiniCartOriginal(product) {
I.scrollPageToTop();
I.executeScript(function (el) { $(el).trigger('touchstart'); }, this.locators.cartIcon);
this.verifyMiniCart(product);
I.see(product.originalQuantity, this.locators.lineItemQuantity);
I.see(product.originalPrice, this.locators.subTotal);
},
verifyMiniCartUpdated(product) {
this.verifyMiniCart(product);
I.see(product.finalQuantity, this.locators.lineItemQuantity);
I.see(product.finalPrice, this.locators.subTotal);
},
verifyMiniCart(product) {
I.see(product.name, this.locators.miniCartLineItemName);
I.see(product.colorAttribute, this.locators.lineItemAttributes);
I.see(product.sizeAttribute, this.locators.lineItemAttributes);
I.see(product.availability, this.locators.lineItemAttributes);
},
removeProductFromMiniCart(product) {
I.scrollPageToTop();
I.executeScript(function (el) { $(el).trigger('touchstart'); }, this.locators.cartIcon);
I.click(this.locators.removeFromMiniCartButton.replace('<pid>', product.pid));
// Confirm remove product
within(this.locators.removeProductModal, () => {
I.click(this.locators.removeProductModalConfirm);
});
},
removeProduct(productName) {
// Click x to remove product
let locator = locate(this.locators.removeProductBox)
.find(this.locators.removeProductBtn)
.withAttr({ 'data-name': productName });
I.click(locator);
// Confirm remove product
within(this.locators.removeProductModal, () => {
I.click(this.locators.removeProductModalConfirm);
});
},
editQuantity(quantity) {
I.selectOption(this.locators.editQuantitySelector, quantity);
},
editMiniCartQuantity(product) {
within(this.locators.miniCartPopover, () => {
I.selectOption(this.locators.miniCartEditQty.replace('<pid>', product.pid), product.editQuantity);
});
}
};

View File

@@ -0,0 +1,196 @@
const I = actor();
module.exports = {
locators: {
lineItemName: 'div.line-item-name',
checkoutAsGuestBtn: '.btn.btn-primary.btn-block.submit-customer',
checkoutAsRegisteredBtn: '.btn.btn-block.btn-primary',
emailGuest: '#email-guest',
emailRegistered: '#email',
password: '#login-form-password',
fName: '.form-control.shippingFirstName',
lName: '.form-control.shippingLastName',
address1: '.form-control.shippingAddressOne',
country: '.form-control.shippingCountry',
state: '.form-control.shippingState',
city: '.form-control.shippingAddressCity',
zip: '.form-control.shippingZipCode',
phone: '.form-control.shippingPhoneNumber',
toPayment: '.btn.btn-primary.btn-block.submit-shipping',
payPhone: '#phoneNumber',
payCard: '#cardNumber',
payExpMonth: '#expirationMonth',
payExpYear: '#expirationYear',
paySecCode: '#securityCode',
paySecCodeSaved: '.form-control.saved-payment-security-code',
placeOrder: '.btn.btn-primary.btn-block.submit-payment',
confirmOrder: '.btn.btn-primary.btn-block.place-order',
billingConfirmation: '.addressSelector.form-control',
shipping_addSelector: '.addressSelector',
shipping_methodBlock: '.shipping-method-block',
shipping_methodOptions: '.form-check.col-9.start-lines',
checkout_shippingSection: '.card.shipping-summary',
checkout_prefilledShippingInfo: '.addressSelector.form-control',
checkout_paymentSection: '.card.payment-summary',
checkout_orderSummary: '.card-body.order-total-summary',
orderConf_thankYou: '.order-thank-you-msg',
orderConf_shippingSection: '.summary-details.shipping',
orderConf_billingSection: '.summary-details.billing',
orderConf_paymentSection: '.payment-details',
orderConf_quantity: '.line-item-pricing-info',
orderConf_totalSection: '.order-total-summary',
orderConf_orderNumber: 'summary-details.order-number',
homeLink: 'a>img.hidden-md-down',
checkoutStage: '.data-checkout-stage'
},
fillPersonalDataGuest(email) {
I.fillField(this.locators.emailGuest, email);
},
fillShippingInfo(fName, lName, address1, country, state, city, zipcode, phone) {
I.scrollTo(this.locators.fName);
I.fillField(this.locators.fName, fName);
I.fillField(this.locators.lName, lName);
I.fillField(this.locators.address1, address1);
I.waitForElement(this.locators.country);
I.selectOption(this.locators.country, country);
I.waitForElement(this.locators.state);
I.selectOption(this.locators.state, state);
I.wait(3);
I.fillField(this.locators.city, city);
I.fillField(this.locators.phone, phone);
I.fillField(this.locators.zip, zipcode);
},
fillPaymentInfoGuest(fName, lName, address1, city, stateAbr, zipcode, phone, ccNum, expMonth, expYear, ccSecCode) {
I.waitForElement(this.locators.checkout_prefilledShippingInfo);
I.see(fName, this.locators.checkout_prefilledShippingInfo);
I.see(lName, this.locators.checkout_prefilledShippingInfo);
I.see(address1, this.locators.checkout_prefilledShippingInfo);
I.see(city, this.locators.checkout_prefilledShippingInfo);
I.see(stateAbr, this.locators.checkout_prefilledShippingInfo);
I.see(zipcode, this.locators.checkout_prefilledShippingInfo);
I.fillField(this.locators.payPhone, phone);
I.fillField(this.locators.payCard, ccNum);
I.waitForElement(this.locators.payExpMonth, expMonth);
I.selectOption(this.locators.payExpMonth, expMonth);
I.waitForElement(this.locators.payExpYear, expYear);
I.selectOption(this.locators.payExpYear, expYear);
I.waitForElement(this.locators.paySecCode);
I.fillField(this.locators.paySecCode, ccSecCode);
},
fillPaymentInfoRegistered(phone, ccSecCode) {
I.fillField(this.locators.payPhone, phone);
I.waitForElement(this.locators.paySecCodeSaved);
I.fillField(this.locators.paySecCodeSaved, ccSecCode);
},
verifyCart(quantity, itemPrice, totalItemPrice, shipping, tax, estimatedTotal) {
I.waitForElement(this.locators.lineItemQuantity);
I.waitForText(quantity, this.locators.lineItemQuantity);
I.waitForElement(this.locators.totalItemQuantity);
I.waitForText(quantity + ' Items', this.locators.totalItemQuantity);
I.waitForElement(this.locators.lineItemPriceTotal);
I.waitForText(itemPrice, this.locators.lineItemPriceTotal);
I.waitForElement(this.locators.totalItemPrice);
I.waitForText(totalItemPrice, this.locators.totalItemPrice);
I.waitForElement(this.locators.shippingCost);
I.waitForText(shipping, this.locators.shippingCost);
I.waitForElement(this.locators.taxTotal);
I.waitForText(tax, this.locators.taxTotal);
I.waitForElement(this.locators.estimatedTotal);
I.waitForText(estimatedTotal, this.locators.estimatedTotal);
},
fillReturnCustomerInfo(email, password) {
I.waitForElement(this.locators.email);
I.fillField(this.locators.email, email);
I.waitForElement(this.locators.password);
I.fillField(this.locators.password, password);
},
verifyShipping(fname, lname, add1, city, stateAbr, zip) {
I.waitForElement(this.locators.shipping_addSelector);
I.waitForText(`${fname} ${lname} ${add1}`, this.locators.shipping_addSelector);
I.waitForText(`${city}, ${stateAbr} ${zip}`, this.locators.shipping_addSelector);
I.waitForElement(this.locators.shipping_methodBlock);
I.seeNumberOfVisibleElements(this.locators.shipping_methodOptions, 3);
},
verifyBilling() {
// Check for best way to verify this one
I.waitForElement(this.locators.billingConfirmation);
I.waitForText(fName + lName + address1);
},
verifyCheckoutInfo(fName, lName, add1, city, zip, phone, ccNum, ccExpDate, quantity,
totalItemPrice, shipping, tax, estimatedTotal) {
// verify shipping address is correct
I.scrollTo(this.locators.checkout_shippingSection);
I.see(fName, this.locators.checkout_shippingSection);
I.see(lName, this.locators.checkout_shippingSection);
I.see(add1, this.locators.checkout_shippingSection);
I.see(city, this.locators.checkout_shippingSection);
I.see(zip, this.locators.checkout_shippingSection);
I.see(phone, this.locators.checkout_shippingSection);
// verify billing address is correct
I.scrollTo(this.locators.checkout_paymentSection);
I.see(fName, this.locators.checkout_paymentSection);
I.see(lName, this.locators.checkout_paymentSection);
I.see(add1, this.locators.checkout_paymentSection);
I.see(city, this.locators.checkout_paymentSection);
I.see(zip, this.locators.checkout_paymentSection);
I.see(phone, this.locators.checkout_paymentSection);
// verify payment info is correct
// Leave the last 4 digits shown; replace everything else with '*'
I.see(ccNum.replace(/\d(?=\d{4})/g, '*'), this.locators.checkout_paymentSection);
I.see(ccExpDate, this.locators.checkout_paymentSection);
// verify product info is correct
I.scrollTo(this.locators.orderConf_quantity);
I.see(quantity, this.locators.orderConf_quantity);
I.see(totalItemPrice, this.locators.checkout_orderSummary);
I.see(shipping, this.locators.checkout_orderSummary);
I.see(tax, this.locators.checkout_orderSummary);
I.see(estimatedTotal, this.locators.checkout_orderSummary);
},
verifyOrderConfirmation(fName, lName, add1, city, zip, phone, email, ccNum, ccExpDate, quantity,
totalItemPrice, shipping, tax, estimatedTotal) {
// verify order is place successfully by verifying the order confirmation page
I.scrollTo(this.locators.orderConf_thankYou);
I.see('Thank you for your order.', this.locators.orderConf_thankYou);
// verify shipping address is correct
I.scrollTo(this.locators.orderConf_shippingSection);
I.see(fName, this.locators.orderConf_shippingSection);
I.see(lName, this.locators.orderConf_shippingSection);
I.see(add1, this.locators.orderConf_shippingSection);
I.see(city, this.locators.orderConf_shippingSection);
I.see(zip, this.locators.orderConf_shippingSection);
I.see(phone, this.locators.orderConf_shippingSection);
// verify billing address is correct
I.scrollTo(this.locators.orderConf_billingSection);
I.see(fName, this.locators.orderConf_billingSection);
I.see(lName, this.locators.orderConf_billingSection);
I.see(add1, this.locators.orderConf_billingSection);
I.see(city, this.locators.orderConf_billingSection);
I.see(zip, this.locators.orderConf_billingSection);
I.see(email, this.locators.orderConf_billingSection);
I.see(phone, this.locators.orderConf_billingSection);
// verify payment info is correct
// Leave the last 4 digits shown; replace everything else with '*'
I.see(ccNum.replace(/\d(?=\d{4})/g, '*'), this.locators.orderConf_paymentSection);
I.see(ccExpDate, this.locators.orderConf_paymentSection);
// verify product info is correct
I.scrollTo(this.locators.orderConf_quantity);
I.see(quantity, this.locators.orderConf_quantity);
I.see(totalItemPrice, this.locators.orderConf_totalSection);
I.see(shipping, this.locators.orderConf_totalSection);
I.see(tax, this.locators.orderConf_totalSection);
I.see(estimatedTotal, this.locators.orderConf_totalSection);
},
gotoHomePageFromCheckout() {
I.click(this.locators.homeLink);
}
};

View File

@@ -0,0 +1,50 @@
const I = actor();
module.exports = {
locators: {
consentTrackModal: '.modal-content',
consentTrackAffirm: '.affirm.btn.btn-primary',
searchField: 'input.form-control.search-field',
searchedImage: 'a>img.swatch-circle',
loginButton: '.user-message',
subscribeEmail: 'input.form-control',
subscribeButton: '.subscribe-email',
emailSignup: '.email-signup-alert',
searchWomens: '#womens.nav-link.dropdown-toggle',
searchWomensClothing: '#womens-clothing.dropdown-link.dropdown-toggle',
searchWomensTops: '#womens-clothing-tops.dropdown-link',
searchStoreZipCode: '#store-postal-code',
searchStoreBtn: '.btn-storelocator-search',
searchStoreResults: '.results.striped',
searchStoreCard: '.card-body',
searchStoreRadius: '.form-control.custom-select.radius'
},
accept() {
within(this.locators.consentTrackModal, () => {
I.click(this.locators.consentTrackAffirm);
});
},
search(product) {
I.fillField(this.locators.searchField, product);
I.waitForElement(this.locators.searchedImage);
I.click(this.locators.searchedImage);
},
subscribeList(email) {
I.fillField('hpEmailSignUp', email);
},
searchMenu(productPage) {
I.amOnPage(productPage);
},
searchForStore(zip) {
I.fillField(this.locators.searchStoreZipCode, zip);
I.click(this.locators.searchStoreBtn);
},
verifyStoreResults(numStores) {
let locator = locate(this.locators.searchStoreCard)
.inside(this.locators.searchStoreResults);
I.seeNumberOfVisibleElements(locator, numStores);
},
changeStoreRadius(radius) {
I.selectOption(this.locators.searchStoreRadius, radius);
}
};

View File

@@ -0,0 +1,76 @@
const I = actor();
module.exports = {
locators: {
loginHomeScreen: 'span.user-message',
emailLogin: '#login-form-email',
passwordLogin: '#login-form-password',
primaryButton: '.btn.btn-block.btn-primary',
rememberMe: '.remember-me',
createAccount: '#register-tab',
firstName: '#registration-form-fname',
lastName: '#registration-form-lname',
phoneNum: '#registration-form-phone',
emailAdr: '#registration-form-email',
emailAdrConfirm: '#registration-form-email-confirm',
password: '#registration-form-password',
passwordConfirm: '#registration-form-password-confirm',
orderNumber: '#trackorder-form-number',
orderEmail: '#trackorder-form-email',
orderZipCode: '#trackorder-form-zip',
orderReceipt: '.card-body.order-total-summary',
forgotPassword: '#password-reset',
forgotPasswordForm: '#reset-password-email',
submitEmailBtn: '#submitEmailButton',
verifyPasswordModal: '.modal-content',
hamburgerLogin: '.navbar-toggler.d-md-none',
loginBtn: '.nav-item.d-lg-none',
loginBtnLink: 'a.nav-link'
},
login(email, password) {
// fill login form
I.waitForElement(this.locators.emailLogin);
I.waitForElement(this.locators.passwordLogin);
I.fillField(this.locators.emailLogin, email);
I.fillField(this.locators.passwordLogin, password);
// click login
I.waitForElement(this.locators.primaryButton);
I.click(this.locators.primaryButton);
},
createAccount(fName, lName, phone, email, password) {
I.fillField(this.locators.firstName, fName);
I.fillField(this.locators.lastName, lName);
I.fillField(this.locators.phoneNum, phone);
I.fillField(this.locators.emailAdr, email);
I.fillField(this.locators.emailAdrConfirm, email);
I.fillField(this.locators.password, password);
I.fillField(this.locators.passwordConfirm, password);
},
checkOrder(orderNum, orderEmail, billingZip) {
I.fillField(this.locators.orderNumber, orderNum);
I.fillField(this.locators.orderEmail, orderEmail);
I.fillField(this.locators.orderZipCode, billingZip);
},
verifyOrderHistory(product) {
I.see(product.totalItemPrice, this.locators.orderReceipt);
I.see(product.shipping, this.locators.orderReceipt);
I.see(product.tax, this.locators.orderReceipt);
I.see(product.estimatedTotal, this.locators.orderReceipt);
},
forgotPassword(email) {
I.wait(2); // Must wait because of modal fade chops the email param off randomly and fails the test
let locator = locate(this.locators.forgotPasswordForm)
.withAttr({ name: 'loginEmail' });
I.waitForElement(locator);
I.fillField(locator, email);
},
verifyPasswordReset() {
I.waitForElement(this.locators.submitEmailBtn);
I.click(this.locators.submitEmailBtn);
I.waitForElement(this.locators.verifyPasswordModal);
I.see('Request to Reset Your Password', this.locators.verifyPasswordModal);
I.waitForElement(this.locators.submitEmailBtn);
I.click(this.locators.submitEmailBtn);
}
};

View File

@@ -0,0 +1,88 @@
const I = actor();
var carousel2Item1Selector = '.carousel:nth-child(2) .carousel-item:nth-child(1)';
var prodTile1ComponentSel = carousel2Item1Selector + ' .product-tile-pd';
var carousel2Item3Selector = '.carousel:nth-child(2) .carousel-item:nth-child(3)';
var prodTile3ComponentSel = carousel2Item3Selector + ' .product-tile-pd';
var shopCategoryComponent = '.mobile-1r-1c .shop-category-component';
var shopTheLookCell1 = '.cell1 .shopthelook-figure-lg';
var shopTheLookCell4 = '.cell4 .shopthelook-figure-lg';
module.exports = {
locators: {
carouselNext: '.carousel-control-next',
carouselPrevious: '.carousel-control-prev',
mainBanner: '.mainbanner-container',
mainBannerHeading: '.image-heading-text',
mainBannerSubHeading: '.mainbanner-sub-text',
mainBannerLink: '.mainbanner-container a',
pageTitle: '.page-title',
ITC: '.ITC-container',
ITCOverlay: '.ITC-image-heading-text',
ITCImageLink: '.ITC-figure a',
photo: '.photo-tile-container',
richText: '.editorialRichText-component-container',
richTextTitle: '.text-center',
shopTheLookContainer: '.shop-the-look-container',
shopTheLookTextOverlay: shopTheLookCell1 + ' .product-text-center',
shopTheLookImage: '.shopthelook-figure-lg img',
shopTheLookSetItems: shopTheLookCell1 + ' .set-count-text-center',
shopTheLookButton: shopTheLookCell1 + ' .shopthelook-text',
shopTheLook4thImage: shopTheLookCell4 + ' img',
shopTheLookProductName: shopTheLookCell4 + ' .product-text-center',
shopTheLook4thSetItems: shopTheLookCell4 + ' .set-count-text-center',
shopTheLook4thButton: shopTheLookCell4 + ' .shopthelook-text',
campaignBanner: '.campaign-banner',
campaignBannerMessage: '.campaign-banner-message',
campaignBannerCloseButton: '.campaign-banner .close-button .close',
productTile1: prodTile1ComponentSel,
productTile1Image: carousel2Item1Selector + ' .product-tile-image .product-tile-component-image',
productTile1Quickview: prodTile1ComponentSel + ' .quick-shop',
productTile1ProductName: prodTile1ComponentSel + ' .product-name-link',
productTile1ProductPrice: prodTile1ComponentSel + ' .product-price .sales',
productTile3StrikeThroughPrice: prodTile3ComponentSel + ' .product-price .strike-through',
productTile3ProductPrice: prodTile3ComponentSel + ' .product-price .sales',
productTile1ImageLinkToPdp: carousel2Item1Selector + ' .product-tile-image a',
productTile1NameLinkToPdp: prodTile1ComponentSel + ' .product-name-link a',
productDetailPage: '.product-detail',
productDetailPageProductId: '.product-id',
shopCategoryHeading: shopCategoryComponent + ' .shop-category-header h3',
shopCategoryLabel: shopCategoryComponent + ' .shop-category-label',
shopCategoryLink1: shopCategoryComponent + ' .shop-category-label:nth-child(1) a',
shopCategoryLink2: shopCategoryComponent + ' .shop-category-label:nth-child(2) a',
shopCategoryLink3: shopCategoryComponent + ' .shop-category-label:nth-child(3) a',
shopCategoryLink4: shopCategoryComponent + ' .shop-category-label:nth-child(4) a',
shopCategoryLink5: shopCategoryComponent + ' .shop-category-label:nth-child(5) a'
},
clickPopulareCategory(index, selector, url) {
let locator = locate(selector)
.at(index);
I.seeElement(locator);
I.click(locator);
I.seeInCurrentUrl(url);
},
seeCarousel(position) {
I.seeElement('.carousel:nth-child(' + position + ')');
},
controlsVisible(position) {
I.seeElement('.carousel:nth-child(' + position + ') .carousel-control-next');
I.seeElement('.carousel:nth-child(' + position + ') .carousel-control-prev');
},
verifySlide(position, expectedText, limitingElement) {
I.seeTextEquals(expectedText, '.carousel:nth-child(' + position + ') .carousel-item.active ' + limitingElement);
},
carouselControlClick(position, control) {
I.click('.carousel:nth-child(' + position + ') ' + control);
I.wait(1);
}
};

View File

@@ -0,0 +1,153 @@
const I = actor();
module.exports = {
locators: {
button: 'button',
selectSize: '.select-size',
selectQuantity: '.quantity-select',
selectColor: '.color-attribute',
addToCartButton: '.add-to-cart',
addToCartButtonEnabled: '.add-to-cart:not(:disabled)',
miniCartIcon: '.minicart-icon.fa.fa-shopping-bag',
miniCartCheckoutButton: '.checkout-btn',
cartHeader: '.cart-header',
productImage: '.carousel-item.active > img',
navigationCrumbs: '.product-breadcrumb:not(.d-md-none) .breadcrumb-item a',
productName: '.product-name',
productId: '.product-id',
ratings: '.ratings',
productAvailability: '.availability-msg',
productPrice: '.prices .price .value',
socialShare: 'ul.social-icons a',
pinterest: '.fa-pinterest',
facebook: '.fa-facebook-official',
twitter: '.fa-twitter',
copyLink: '.fa-link',
productDescription: '.description-and-detail .description .content',
productDetails: '.description-and-detail .details .content',
copyLinkMsgVisible: '.copy-link-message:not(.d-none)',
addToCartSuccess: '.add-to-cart-messages .alert-success',
addToCartFailure: '.add-to-cart-messages .alert-danger',
filterColor: '.swatch-circle-',
filterSize: 'span.null',
filterPrice: 'span',
filterOption: '.custom-select',
filterPDP: '.pdp-link a.link',
productTotals: '.result-count.text-center',
qv_ProductBtn: '.quickview.hidden-sm-down',
qv_ColorBtn: '.color-attribute',
qv_SizeSelect: '.custom-select.form-control.select-size',
qv_AddToCart: '.add-to-cart-global.btn.btn-primary',
alertAddToCart: '.alert.alert-success.add-to-basket-alert',
moreButton: '.show-more .more',
firstProductTile: '.product-tile',
pdpClass: '.product-detail'
},
selectSize(size) {
I.waitForElement(this.locators.selectSize);
I.selectOption(this.locators.selectSize, size);
},
selectQuantity(quantity) {
I.waitForElement(this.locators.selectQuantity);
I.selectOption(this.locators.selectQuantity, quantity);
},
selectColor(color) {
let locator = locate(this.locators.selectColor)
.withAttr({ 'aria-label': 'Select Color ' + color });
I.waitForElement(locator);
I.click(locator);
},
addToCart() {
I.waitForEnabled(this.locators.addToCartButton);
I.click(this.locators.addToCartButton);
},
addProductToMiniCart(product) {
this.selectSize(product.size);
this.selectColor(product.color);
this.selectQuantity(product.originalQuantity);
this.addToCart();
},
viewCart() {
I.click(this.locators.miniCartIcon);
I.waitForElement(this.locators.cartHeader);
},
clickCopyLink() {
I.waitForEnabled(this.locators.copyLink);
I.click(this.locators.copyLink);
},
filterProductColor(color) {
I.waitForElement(this.locators.filterColor + color);
I.click(this.locators.filterColor + color);
},
filterProductSize(filterSizeTotal) {
let locator = locate(this.locators.filterSize)
.withAttr({ 'aria-hidden': 'true' })
.withText(filterSizeTotal);
I.waitForElement(locator);
I.click(locator);
},
filterProductPrice(filterPriceTotal) {
let locator = locate(this.locators.filterPrice)
.withAttr({ 'aria-hidden': 'true' })
.withText(filterPriceTotal);
I.waitForElement(locator);
I.click(locator);
},
filterProductOption(filterOption, firstProductName) {
let locatorOption = locate(this.locators.filterOption)
.withAttr({ 'aria-label': 'Sort By' });
I.waitForElement(locatorOption);
I.scrollTo(locatorOption);
I.selectOption(locatorOption, filterOption);
I.wait(1.5);
let locatorProduct = locate(this.locators.filterPDP).first();
I.waitForElement(locatorProduct);
I.see(firstProductName, locatorProduct);
},
clickMoreButton() {
I.click(this.locators.moreButton);
I.wait(1.5);
},
clickFirstTile() {
I.click(this.locators.firstProductTile)[0]; // eslint-disable-line no-unused-expressions
},
simulateBackButton() {
I.wait(1.5);
I.waitForElement(this.locators.pdpClass);
I.executeScript('window.history.back();');
I.wait(1.5);
I.waitNumberOfVisibleElements(this.locators.firstProductTile, 24);
},
verifyProductTotals(totalItems) {
let locator = locate(this.locators.productTotals)
.find(this.locators.filterPrice);
I.waitForElement(locator);
I.see(totalItems, locator);
},
openProductQuickView(pdpQuickViewLink) {
let locator = locate(this.locators.qv_ProductBtn)
.withAttr({ href: pdpQuickViewLink });
I.waitForElement(locator);
I.scrollTo(locator);
I.click(locator);
},
selectQuickViewColor(color) {
let locator = locate(this.locators.qv_ColorBtn)
.withAttr({ 'aria-label': 'Select Color ' + color });
I.waitForElement(locator);
I.click(locator);
},
selectQuickViewSize(size) {
I.waitForElement(this.locators.qv_SizeSelect);
I.selectOption(this.locators.qv_SizeSelect, size);
},
addToCartQuickView() {
I.waitForElement(this.locators.qv_AddToCart);
I.click(this.locators.qv_AddToCart);
},
clickCheckoutBtnOnMiniCart() {
I.waitForElement(this.locators.miniCartCheckoutButton);
I.click(this.locators.miniCartCheckoutButton);
}
};