2021-03-17 19:22:09 +00:00
|
|
|
import { setCheckbox, unsetCheckbox } from '@woocommerce/e2e-utils';
|
2021-04-05 00:09:36 +00:00
|
|
|
import { BasePage } from '../../pages/BasePage';
|
2021-03-17 19:22:09 +00:00
|
|
|
import { waitForElementByText } from '../../utils/actions';
|
|
|
|
|
2021-04-05 00:09:36 +00:00
|
|
|
export class BusinessSection extends BasePage {
|
2021-03-17 19:22:09 +00:00
|
|
|
async isDisplayed() {
|
|
|
|
await waitForElementByText( 'h2', 'Tell us about your business' );
|
|
|
|
}
|
|
|
|
|
|
|
|
async freeFeaturesIsDisplayed() {
|
|
|
|
await waitForElementByText( 'h2', 'Included business features' );
|
|
|
|
}
|
|
|
|
|
|
|
|
async selectProductNumber( productLabel: string ) {
|
2021-04-05 00:09:36 +00:00
|
|
|
const howManyProductsDropdown = this.getDropdownField(
|
|
|
|
'.components-card__body > div:nth-child(1)'
|
|
|
|
);
|
|
|
|
|
|
|
|
await howManyProductsDropdown.select( productLabel );
|
2021-03-17 19:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async selectCurrentlySelling( currentlySelling: string ) {
|
2021-04-05 00:09:36 +00:00
|
|
|
const sellingElsewhereDropdown = this.getDropdownField(
|
|
|
|
'.components-card__body > div:nth-child(2)'
|
|
|
|
);
|
|
|
|
|
|
|
|
await sellingElsewhereDropdown.select( currentlySelling );
|
2021-03-17 19:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async selectInstallFreeBusinessFeatures( select: boolean ) {
|
|
|
|
if ( select ) {
|
|
|
|
await setCheckbox( '#woocommerce-business-extensions__checkbox' );
|
|
|
|
} else {
|
|
|
|
await unsetCheckbox( '#woocommerce-business-extensions__checkbox' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async expandRecommendedBusinessFeatures() {
|
|
|
|
const expandButtonSelector =
|
|
|
|
'.woocommerce-admin__business-details__selective-extensions-bundle__expand';
|
2021-04-05 00:09:36 +00:00
|
|
|
|
|
|
|
await this.click( expandButtonSelector );
|
2021-03-17 19:22:09 +00:00
|
|
|
|
|
|
|
// Confirm that expanding the list shows all the extensions available to install.
|
|
|
|
await this.page.waitForFunction( () => {
|
|
|
|
const inputsNum = document.querySelectorAll(
|
|
|
|
'.components-checkbox-control__input'
|
|
|
|
).length;
|
|
|
|
return inputsNum > 6;
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
async uncheckAllRecommendedBusinessFeatures() {
|
2021-04-05 00:09:36 +00:00
|
|
|
await this.unsetAllCheckboxes( '.components-checkbox-control__input' );
|
2021-03-17 19:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The old list displayed on the dropdown page
|
|
|
|
async uncheckBusinessFeatures() {
|
2021-04-05 00:09:36 +00:00
|
|
|
await this.unsetAllCheckboxes(
|
2021-03-17 19:22:09 +00:00
|
|
|
'.woocommerce-profile-wizard__benefit .components-form-toggle__input'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|