2020-09-04 02:31:09 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-04-05 00:09:36 +00:00
|
|
|
import { OnboardingWizard } from '../../pages/OnboardingWizard';
|
|
|
|
import { WcHomescreen } from '../../pages/WcHomescreen';
|
2021-03-17 19:22:09 +00:00
|
|
|
import { TaskTitles } from '../../constants/taskTitles';
|
|
|
|
import { getElementByText } from '../../utils/actions';
|
2021-04-05 00:09:36 +00:00
|
|
|
import { Login } from '../../pages/Login';
|
|
|
|
|
|
|
|
const config = require( 'config' );
|
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', () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
const profileWizard = new OnboardingWizard( page );
|
|
|
|
const login = new Login( page );
|
|
|
|
|
|
|
|
beforeAll( async () => {
|
|
|
|
await login.login();
|
|
|
|
} );
|
|
|
|
afterAll( async () => {
|
|
|
|
await login.logout();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can start the profile wizard', async () => {
|
|
|
|
await profileWizard.navigate();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can complete the store details section', async () => {
|
|
|
|
await profileWizard.storeDetails.completeStoreDetailsSection();
|
|
|
|
// Wait for "Continue" button to become active
|
|
|
|
await profileWizard.continue();
|
|
|
|
|
|
|
|
// Wait for usage tracking pop-up window to appear
|
|
|
|
await profileWizard.optionallySelectUsageTracking();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can complete the industry section', async () => {
|
|
|
|
// Query for the industries checkboxes
|
|
|
|
await profileWizard.industry.isDisplayed( 8 );
|
|
|
|
await profileWizard.industry.uncheckIndustries();
|
|
|
|
|
|
|
|
// Select just "fashion" and "health/beauty" to get the single checkbox business section when
|
|
|
|
// filling out details for a US store.
|
|
|
|
await profileWizard.industry.selectIndustry(
|
|
|
|
'Fashion, apparel, and accessories'
|
|
|
|
);
|
|
|
|
await profileWizard.industry.selectIndustry( 'Health and beauty' );
|
|
|
|
|
|
|
|
await profileWizard.continue();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can complete the product types section', async () => {
|
|
|
|
await profileWizard.productTypes.isDisplayed( 7 );
|
|
|
|
await profileWizard.productTypes.uncheckProducts();
|
|
|
|
|
|
|
|
// Select Physical and Downloadable products
|
|
|
|
await profileWizard.productTypes.selectProduct( 'Physical products' );
|
|
|
|
await profileWizard.productTypes.selectProduct( 'Downloads' );
|
|
|
|
|
|
|
|
await profileWizard.continue();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can complete the business section', async () => {
|
|
|
|
await profileWizard.business.isDisplayed();
|
|
|
|
await profileWizard.business.selectProductNumber(
|
|
|
|
config.get( 'onboardingwizard.numberofproducts' )
|
|
|
|
);
|
|
|
|
await profileWizard.business.selectCurrentlySelling(
|
|
|
|
config.get( 'onboardingwizard.sellingelsewhere' )
|
|
|
|
);
|
|
|
|
|
|
|
|
await profileWizard.continue();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can unselect all business features and continue', async () => {
|
|
|
|
await profileWizard.business.freeFeaturesIsDisplayed();
|
2021-03-17 19:22:09 +00:00
|
|
|
// Add WC Pay check
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.business.expandRecommendedBusinessFeatures();
|
2021-03-17 19:22:09 +00:00
|
|
|
|
|
|
|
expect( page ).toMatchElement( 'a', {
|
|
|
|
text: 'WooCommerce Payments',
|
|
|
|
} );
|
|
|
|
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.business.uncheckAllRecommendedBusinessFeatures();
|
|
|
|
await profileWizard.continue();
|
|
|
|
} );
|
2021-03-17 19:22:09 +00:00
|
|
|
|
2021-04-05 00:09:36 +00:00
|
|
|
it( 'can complete the theme selection section', async () => {
|
|
|
|
await profileWizard.themes.isDisplayed();
|
|
|
|
await profileWizard.themes.continueWithActiveTheme();
|
2021-03-17 19:22:09 +00:00
|
|
|
} );
|
2020-09-04 02:31:09 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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', () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
const profileWizard = new OnboardingWizard( page );
|
|
|
|
const login = new Login( page );
|
|
|
|
|
|
|
|
beforeAll( async () => {
|
|
|
|
await login.login();
|
|
|
|
} );
|
|
|
|
afterAll( async () => {
|
|
|
|
await login.logout();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can start the profile wizard', async () => {
|
|
|
|
await profileWizard.navigate();
|
|
|
|
} );
|
|
|
|
|
2020-09-04 02:31:09 +00:00
|
|
|
it( 'can complete the store details section', async () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.storeDetails.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
|
|
|
} );
|
2021-04-05 00:09:36 +00:00
|
|
|
|
|
|
|
// Wait for "Continue" button to become active
|
|
|
|
await profileWizard.continue();
|
|
|
|
|
|
|
|
// Wait for usage tracking pop-up window to appear
|
|
|
|
await profileWizard.optionallySelectUsageTracking();
|
2020-09-04 02:31:09 +00:00
|
|
|
} );
|
2021-04-05 00:09:36 +00:00
|
|
|
|
2020-09-04 02:31:09 +00:00
|
|
|
it( 'can complete the industry section', async () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.industry.isDisplayed( 7 );
|
|
|
|
await profileWizard.industry.uncheckIndustries();
|
|
|
|
await profileWizard.industry.selectIndustry(
|
|
|
|
'Fashion, apparel, and accessories'
|
|
|
|
);
|
|
|
|
await profileWizard.industry.selectIndustry( 'Health and beauty' );
|
|
|
|
|
|
|
|
await profileWizard.continue();
|
2020-09-04 02:31:09 +00:00
|
|
|
} );
|
2021-04-05 00:09:36 +00:00
|
|
|
|
|
|
|
it( 'can complete the product types section', async () => {
|
|
|
|
await profileWizard.productTypes.isDisplayed( 7 );
|
|
|
|
await profileWizard.productTypes.uncheckProducts();
|
|
|
|
|
|
|
|
// Select Physical and Downloadable products
|
|
|
|
await profileWizard.productTypes.selectProduct( 'Physical products' );
|
|
|
|
await profileWizard.productTypes.selectProduct( 'Downloads' );
|
|
|
|
|
|
|
|
await profileWizard.continue();
|
|
|
|
} );
|
|
|
|
|
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-04-05 00:09:36 +00:00
|
|
|
|
|
|
|
it( 'can complete the business section', async () => {
|
|
|
|
await profileWizard.business.isDisplayed();
|
|
|
|
await profileWizard.business.selectProductNumber(
|
|
|
|
config.get( 'onboardingwizard.numberofproducts' )
|
|
|
|
);
|
|
|
|
await profileWizard.business.selectCurrentlySelling(
|
|
|
|
config.get( 'onboardingwizard.sellingelsewhere' )
|
|
|
|
);
|
|
|
|
|
|
|
|
await profileWizard.continue();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can complete the theme selection section', async () => {
|
|
|
|
// Make sure we're on the theme selection page before clicking continue
|
|
|
|
await profileWizard.themes.isDisplayed();
|
|
|
|
|
|
|
|
await profileWizard.themes.continueWithActiveTheme();
|
|
|
|
} );
|
|
|
|
|
2021-03-17 19:22:09 +00:00
|
|
|
it( 'can complete the benefits section', async () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.benefits.isDisplayed();
|
|
|
|
// This performs a navigation to home screen.
|
|
|
|
await profileWizard.benefits.noThanks();
|
2021-03-17 19:22:09 +00:00
|
|
|
} );
|
2021-04-05 00:09:36 +00:00
|
|
|
|
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();
|
2021-04-05 00:09:36 +00:00
|
|
|
|
2021-03-17 19:22:09 +00:00
|
|
|
const tasks = await homescreen.getTaskList();
|
2021-04-05 00:09:36 +00:00
|
|
|
|
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-04-05 00:09:36 +00:00
|
|
|
const profileWizard = new OnboardingWizard( page );
|
|
|
|
const login = new Login( page );
|
|
|
|
|
|
|
|
beforeAll( async () => {
|
|
|
|
await login.login();
|
|
|
|
} );
|
|
|
|
afterAll( async () => {
|
|
|
|
await login.logout();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can start the profile wizard', async () => {
|
|
|
|
await profileWizard.navigate();
|
|
|
|
} );
|
|
|
|
|
2021-03-08 14:23:39 +00:00
|
|
|
it( 'can complete the store details section', async () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.storeDetails.completeStoreDetailsSection( {
|
2021-03-08 14:23:39 +00:00
|
|
|
countryRegionSubstring: 'japan',
|
|
|
|
countryRegionSelector: 'JP\\:JP01',
|
|
|
|
countryRegion: 'Japan — Hokkaido',
|
|
|
|
} );
|
2021-04-05 00:09:36 +00:00
|
|
|
|
|
|
|
// Wait for "Continue" button to become active
|
|
|
|
await profileWizard.continue();
|
|
|
|
|
|
|
|
// Wait for usage tracking pop-up window to appear
|
|
|
|
await profileWizard.optionallySelectUsageTracking();
|
2021-03-08 14:23:39 +00:00
|
|
|
} );
|
2021-04-05 00:09:36 +00:00
|
|
|
|
2021-03-08 14:23:39 +00:00
|
|
|
// JP:JP01
|
2021-01-06 22:08:57 +00:00
|
|
|
it( 'can choose the "Other" industry', async () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
// Query for the industries checkboxes
|
|
|
|
await profileWizard.industry.isDisplayed();
|
|
|
|
await profileWizard.industry.uncheckIndustries();
|
|
|
|
await profileWizard.industry.selectIndustry( 'Other' );
|
|
|
|
await profileWizard.continue();
|
2021-01-06 22:08:57 +00:00
|
|
|
} );
|
2021-04-05 00:09:36 +00:00
|
|
|
|
|
|
|
it( 'can complete the product types section', async () => {
|
|
|
|
await profileWizard.productTypes.isDisplayed( 7 );
|
|
|
|
await profileWizard.productTypes.uncheckProducts();
|
|
|
|
|
|
|
|
// Select Physical and Downloadable products
|
|
|
|
await profileWizard.productTypes.selectProduct( 'Physical products' );
|
|
|
|
await profileWizard.productTypes.selectProduct( 'Downloads' );
|
|
|
|
|
|
|
|
await profileWizard.continue();
|
|
|
|
await page.waitForNavigation( { waitUntil: 'networkidle0' } );
|
|
|
|
} );
|
|
|
|
|
2021-01-06 22:08:57 +00:00
|
|
|
it( 'can complete the business details tab', async () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.business.isDisplayed();
|
|
|
|
|
|
|
|
await profileWizard.business.selectProductNumber(
|
|
|
|
config.get( 'onboardingwizard.numberofproducts' )
|
|
|
|
);
|
|
|
|
await profileWizard.business.selectCurrentlySelling(
|
|
|
|
config.get( 'onboardingwizard.sellingelsewhere' )
|
|
|
|
);
|
|
|
|
|
|
|
|
await profileWizard.continue();
|
2021-01-06 22:08:57 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can choose not to install any extensions', async () => {
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.business.freeFeaturesIsDisplayed();
|
2021-03-17 19:22:09 +00:00
|
|
|
// Add WC Pay check
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.business.expandRecommendedBusinessFeatures();
|
2021-03-17 19:22:09 +00:00
|
|
|
|
|
|
|
expect( page ).not.toMatchElement( 'a', {
|
|
|
|
text: 'WooCommerce Payments',
|
|
|
|
} );
|
|
|
|
|
2021-04-05 00:09:36 +00:00
|
|
|
await profileWizard.business.uncheckAllRecommendedBusinessFeatures();
|
|
|
|
await profileWizard.continue();
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can finish the rest of the wizard successfully', async () => {
|
|
|
|
await profileWizard.themes.isDisplayed();
|
2021-03-17 19:22:09 +00:00
|
|
|
|
2021-04-05 00:09:36 +00:00
|
|
|
// This navigates to the home screen
|
|
|
|
await profileWizard.themes.continueWithActiveTheme();
|
2021-01-06 22:08:57 +00:00
|
|
|
} );
|
|
|
|
|
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
|
|
|
} );
|