2020-09-04 02:31:09 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { StoreOwnerFlow } from '../../utils/flows';
|
|
|
|
import { completeStoreDetailsSection } from './complete-store-details-section';
|
2021-01-06 22:08:57 +00:00
|
|
|
import {
|
|
|
|
chooseIndustries,
|
|
|
|
completeIndustrySection,
|
|
|
|
} from './complete-industry-section';
|
2020-09-04 02:31:09 +00:00
|
|
|
import { completeProductTypesSection } from './complete-product-types-section';
|
2021-01-06 22:08:57 +00:00
|
|
|
import {
|
|
|
|
completeBusinessSection,
|
|
|
|
completeSelectiveBundleInstallBusinessDetailsTab,
|
|
|
|
} from './complete-business-section';
|
2020-09-04 02:31:09 +00:00
|
|
|
import { completeThemeSelectionSection } from './complete-theme-selection-section';
|
2021-03-17 19:22:09 +00:00
|
|
|
import { OnboardingWizard } from '../../models/OnboardingWizard';
|
|
|
|
import { WcHomescreen } from '../../models/WcHomescreen';
|
|
|
|
import { TaskTitles } from '../../constants/taskTitles';
|
|
|
|
import { getElementByText } from '../../utils/actions';
|
2020-09-04 02:31:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests a default, happy path for the onboarding wizard.
|
|
|
|
*/
|
|
|
|
describe( 'Store owner can complete onboarding wizard', () => {
|
|
|
|
it( 'can log in', StoreOwnerFlow.login );
|
|
|
|
it( 'can start the profile wizard', StoreOwnerFlow.startProfileWizard );
|
2021-03-17 19:22:09 +00:00
|
|
|
it( 'can complete the store details section', async () =>
|
|
|
|
await completeStoreDetailsSection() );
|
|
|
|
it( 'can complete the industry section', async () =>
|
|
|
|
await completeIndustrySection() );
|
|
|
|
it( 'can complete the product types section', async () =>
|
|
|
|
await completeProductTypesSection() );
|
2021-03-08 14:23:39 +00:00
|
|
|
it( 'can complete the business section', async () =>
|
|
|
|
await completeSelectiveBundleInstallBusinessDetailsTab() );
|
2021-03-17 19:22:09 +00:00
|
|
|
it( 'can unselect all business features and contine', async () => {
|
|
|
|
const onboarding = new OnboardingWizard( page );
|
|
|
|
|
|
|
|
await onboarding.business.freeFeaturesIsDisplayed();
|
|
|
|
// Add WC Pay check
|
|
|
|
await onboarding.business.expandRecommendedBusinessFeatures();
|
|
|
|
|
|
|
|
expect( page ).toMatchElement( 'a', {
|
|
|
|
text: 'WooCommerce Payments',
|
|
|
|
} );
|
|
|
|
|
|
|
|
await onboarding.business.uncheckAllRecommendedBusinessFeatures();
|
|
|
|
|
|
|
|
await onboarding.continue();
|
|
|
|
} );
|
2020-09-04 02:31:09 +00:00
|
|
|
it(
|
|
|
|
'can complete the theme selection section',
|
|
|
|
completeThemeSelectionSection
|
|
|
|
);
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A non-US store doesn't get the "install recommended features" checkbox.
|
|
|
|
*/
|
2021-03-08 14:23:39 +00:00
|
|
|
describe( 'A spanish store does not get the install recommended features tab, but sees the benefits section', () => {
|
2020-09-04 02:31:09 +00:00
|
|
|
it( 'can log in', StoreOwnerFlow.login );
|
|
|
|
it( 'can start the profile wizard', StoreOwnerFlow.startProfileWizard );
|
|
|
|
it( 'can complete the store details section', async () => {
|
|
|
|
await completeStoreDetailsSection( {
|
2021-03-08 14:23:39 +00:00
|
|
|
countryRegionSubstring: 'spain',
|
|
|
|
countryRegionSelector: 'ES\\:B',
|
|
|
|
countryRegion: 'Spain - Barcelona',
|
2020-09-04 02:31:09 +00:00
|
|
|
} );
|
|
|
|
} );
|
|
|
|
it( 'can complete the industry section', async () => {
|
2020-09-22 12:20:42 +00:00
|
|
|
await completeIndustrySection( 7 );
|
2020-09-04 02:31:09 +00:00
|
|
|
} );
|
2021-03-17 19:22:09 +00:00
|
|
|
it( 'can complete the product types section', async () =>
|
|
|
|
await completeProductTypesSection() );
|
2020-09-04 02:31:09 +00:00
|
|
|
it( 'does not have the install recommended features checkbox', async () => {
|
|
|
|
const installFeaturesCheckbox = await page.$(
|
|
|
|
'#woocommerce-business-extensions__checkbox'
|
|
|
|
);
|
|
|
|
|
|
|
|
expect( installFeaturesCheckbox ).toBe( null );
|
|
|
|
} );
|
2021-03-08 14:23:39 +00:00
|
|
|
it( 'can complete the business section', async () =>
|
|
|
|
await completeBusinessSection() );
|
2021-03-17 19:22:09 +00:00
|
|
|
it( 'can complete the theme selection section', async () =>
|
|
|
|
await completeThemeSelectionSection() );
|
|
|
|
it( 'can complete the benefits section', async () => {
|
|
|
|
const onboarding = new OnboardingWizard( page );
|
|
|
|
await onboarding.benefits.isDisplayed();
|
|
|
|
await onboarding.benefits.noThanks();
|
|
|
|
} );
|
2021-03-08 14:23:39 +00:00
|
|
|
it( 'should display the choose payments task, and not the woocommerce payments task', async () => {
|
2021-03-17 19:22:09 +00:00
|
|
|
const homescreen = new WcHomescreen( page );
|
|
|
|
await homescreen.isDisplayed();
|
|
|
|
await homescreen.possiblyDismissWelcomeModal();
|
|
|
|
const tasks = await homescreen.getTaskList();
|
2021-03-08 14:23:39 +00:00
|
|
|
expect( tasks ).toContain( TaskTitles.addPayments );
|
|
|
|
expect( tasks ).not.toContain( TaskTitles.wooPayments );
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'should not display woocommerce payments as a payments option', async () => {
|
2021-03-17 19:22:09 +00:00
|
|
|
const homescreen = new WcHomescreen( page );
|
|
|
|
await homescreen.clickOnTaskList( TaskTitles.addPayments );
|
2021-03-08 14:23:39 +00:00
|
|
|
const wcPayLabel = await getElementByText(
|
|
|
|
'h2',
|
|
|
|
'WooCommerce Payments'
|
|
|
|
);
|
|
|
|
expect( wcPayLabel ).toBeUndefined();
|
|
|
|
} );
|
2020-09-04 02:31:09 +00:00
|
|
|
} );
|
2021-01-06 22:08:57 +00:00
|
|
|
|
2021-03-08 14:23:39 +00:00
|
|
|
describe( 'A japanese store can complete the selective bundle install but does not include WCPay. ', () => {
|
2021-01-06 22:08:57 +00:00
|
|
|
it( 'can log in', StoreOwnerFlow.login );
|
|
|
|
it( 'can start the profile wizard', StoreOwnerFlow.startProfileWizard );
|
2021-03-08 14:23:39 +00:00
|
|
|
it( 'can complete the store details section', async () => {
|
|
|
|
await completeStoreDetailsSection( {
|
|
|
|
countryRegionSubstring: 'japan',
|
|
|
|
countryRegionSelector: 'JP\\:JP01',
|
|
|
|
countryRegion: 'Japan — Hokkaido',
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
// JP:JP01
|
2021-01-06 22:08:57 +00:00
|
|
|
it( 'can choose the "Other" industry', async () => {
|
|
|
|
await chooseIndustries( [ 'Other' ] );
|
|
|
|
} );
|
2021-03-17 19:22:09 +00:00
|
|
|
it( 'can complete the product types section', async () =>
|
|
|
|
await completeProductTypesSection() );
|
2021-01-06 22:08:57 +00:00
|
|
|
it( 'can complete the business details tab', async () => {
|
|
|
|
await completeSelectiveBundleInstallBusinessDetailsTab();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can choose not to install any extensions', async () => {
|
2021-03-17 19:22:09 +00:00
|
|
|
const onboarding = new OnboardingWizard( page );
|
|
|
|
|
|
|
|
await onboarding.business.freeFeaturesIsDisplayed();
|
|
|
|
// Add WC Pay check
|
|
|
|
await onboarding.business.expandRecommendedBusinessFeatures();
|
|
|
|
|
|
|
|
expect( page ).not.toMatchElement( 'a', {
|
|
|
|
text: 'WooCommerce Payments',
|
|
|
|
} );
|
|
|
|
|
|
|
|
await onboarding.business.uncheckAllRecommendedBusinessFeatures();
|
|
|
|
|
|
|
|
await onboarding.continue();
|
2021-01-06 22:08:57 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
it(
|
|
|
|
'can finish the rest of the wizard successfully',
|
|
|
|
completeThemeSelectionSection
|
|
|
|
);
|
2021-03-08 14:23:39 +00:00
|
|
|
it( 'should display the choose payments task, and not the woocommerce payments task', async () => {
|
2021-03-17 19:22:09 +00:00
|
|
|
const homescreen = new WcHomescreen( page );
|
|
|
|
await homescreen.isDisplayed();
|
|
|
|
await homescreen.possiblyDismissWelcomeModal();
|
|
|
|
const tasks = await homescreen.getTaskList();
|
2021-03-08 14:23:39 +00:00
|
|
|
expect( tasks ).toContain( TaskTitles.addPayments );
|
|
|
|
expect( tasks ).not.toContain( TaskTitles.wooPayments );
|
|
|
|
} );
|
2021-01-06 22:08:57 +00:00
|
|
|
} );
|