Skip to content

Commit

Permalink
Merge pull request woocommerce#26804 from woocommerce/fix/obw-e2e-test
Browse files Browse the repository at this point in the history
E2E: Fix OBW e2e test to account for the new Home Screen
  • Loading branch information
claudiosanches authored Jun 22, 2020
2 parents 720c1a1 + 281057e commit f21c92d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/env/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"country": "United States (US)",
"addressfirstline": "addr 1",
"addresssecondline": "addr 2",
"countryandstate": "United States (US) -- California",
"countryandstate": "United States (US) California",
"city": "San Francisco",
"state": "CA",
"postcode": "94107"
Expand Down
22 changes: 5 additions & 17 deletions tests/e2e/specs/activate-and-setup/setup-wizard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@
* Internal dependencies
*/
import { StoreOwnerFlow } from '../../utils/flows';
import { completeOldSetupWizard, completeOnboardingWizard } from '../../utils/components';
import { completeOnboardingWizard } from '../../utils/components';
import {
permalinkSettingsPageSaveChanges,
setCheckbox,
settingsPageSaveChanges,
verifyCheckboxIsSet,
verifyCheckboxIsUnset, verifyValueOfInputField
verifyValueOfInputField
} from '../../utils';

const config = require( 'config' );

describe( 'Store owner can login and make sure WooCommerce is activated', () => {

it( 'can login', async () => {
beforeAll( async () => {
await StoreOwnerFlow.login();
} );

Expand Down Expand Up @@ -56,25 +53,16 @@ describe( 'Store owner can go through setup Task List', () => {
it( 'can setup shipping', async () => {
// Query for all tasks on the list
const taskListItems = await page.$$( '.woocommerce-list__item-title' );
expect( taskListItems ).toHaveLength( 5 );
expect( taskListItems ).toHaveLength( 6 );

await Promise.all( [
// Click on "Set up shipping" task to move to the next step
taskListItems[2].click(),
taskListItems[3].click(),

// Wait for shipping setup section to load
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
] );

// Query for store location fields
const storeLocationFields = await page.$$( '.components-text-control__input' );
expect( storeLocationFields ).toHaveLength( 4 );

// Wait for "Continue" button to become active
await page.waitForSelector( 'button.is-primary:not(:disabled)' );
// Click on "Continue" button to move to the shipping cost section
await page.click( 'button.is-primary' );

// Wait for "Proceed" button to become active
await page.waitForSelector( 'button.is-primary:not(:disabled)' );
await page.waitFor( 3000 );
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/utils/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ const completeOnboardingWizard = async () => {
}

// Wait for "Continue" button to become active
await page.waitForSelector( 'button.woocommerce-profile-wizard__continue:not(:disabled)' );
await page.waitForSelector( 'button.is-primary:not(:disabled)' );

await Promise.all( [
// Click on "Continue" button to move to the next step
page.click( 'button.woocommerce-profile-wizard__continue' ),
page.click( 'button.is-primary' ),

// Wait for "Tell us about your business" section to load
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
Expand Down Expand Up @@ -186,9 +186,9 @@ const completeOnboardingWizard = async () => {
await page.waitForSelector( '.woocommerce-profile-wizard__header-title' );

// Wait for "No thanks" button to become active
await page.waitForSelector( 'button.is-default:not(:disabled)' );
await page.waitForSelector( 'button.is-secondary:not(:disabled)' );
// Click on "No thanks" button to move to the next step
await page.click( 'button.is-default' );
await page.click( 'button.is-secondary' );

// End of onboarding wizard

Expand Down

0 comments on commit f21c92d

Please sign in to comment.