Skip to content
This repository was archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Fix WooCommerce on WP.com specs (#1055)
Browse files Browse the repository at this point in the history
Includes fixes for this new toolbar view: Automattic/wp-calypso#22541

To test
`env BROWSERSIZE=desktop ./node_modules/.bin/mocha specs-woocommerce`
`env BROWSERSIZE=mobile ./node_modules/.bin/mocha specs-woocommerce`
  • Loading branch information
alisterscott authored Mar 19, 2018
1 parent 65cad2a commit 1008b4a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/components/store-sidebar-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class StoreSidebarComponent extends BaseContainer {
// this is necessary on mobile width screens
displayComponentIfNecessary() {
const driver = this.driver;
const mobileLeftArrowSelector = By.css( '.current-section a' );
const mobileLeftArrowSelector = By.css( '.action-header button' );
driver.findElement( mobileLeftArrowSelector ).isDisplayed().then( ( displayed ) => {
if ( displayed === true ) {
driverHelper.clickWhenClickable( driver, mobileLeftArrowSelector );
Expand Down
10 changes: 8 additions & 2 deletions lib/pages/woocommerce/add-edit-product-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import config from 'config';
import BaseContainer from '../../base-container';

import * as driverHelper from '../../driver-helper';
import * as driverManager from '../../driver-manager';
import * as dataHelper from '../../data-helper';

export default class AddEditProductPage extends BaseContainer {
Expand Down Expand Up @@ -65,8 +66,13 @@ export default class AddEditProductPage extends BaseContainer {
}

deleteProduct() {
driverHelper.clickWhenClickable( this.driver, by.css( '.action-header__actions button.is-scary' ) );
if ( driverManager.currentScreenSize() === 'mobile' ) {
// open the menu on mobile screens
driverHelper.clickWhenClickable( this.driver, by.css( 'button.split-button__toggle' ) );
driverHelper.clickWhenClickable( this.driver, by.css( '.popover__menu-item.is-scary' ) );
} else {
driverHelper.clickWhenClickable( this.driver, by.css( '.action-header__actions button.is-scary' ) );
}
driverHelper.clickWhenClickable( this.driver, by.css( '.dialog__action-buttons button[data-e2e-button="accept"]' ) );
}

}
4 changes: 2 additions & 2 deletions specs-woocommerce/wp-woocommerce-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ test.describe( `Can see WooCommerce Store option in Calypso '${ screenSize }' @p
this.navBarComponent.clickMySites();
} );

test.it( 'Can see \'Store (BETA)\' option in main Calypso menu for an AT WooCommerce site set to the US', function() {
test.it( 'Can see \'Store\' option in main Calypso menu for an AT WooCommerce site set to the US', function() {
this.sideBarComponent = new SidebarComponent( driver );
this.sideBarComponent.storeOptionDisplayed().then( ( displayed ) => {
assert( displayed, 'The Store menu option is not displayed for the AT WooCommerce site set to the US' );
} );
} );

test.it( 'The \'Store (BETA)\' option opens the store dashboard with its own sidebar', function() {
test.it( 'The \'Store\' option opens the store dashboard with its own sidebar', function() {
this.sideBarComponent = new SidebarComponent( driver );
this.sideBarComponent.selectStoreOption();
this.storeDashboardPage = new StoreDashboardPage( driver );
Expand Down

0 comments on commit 1008b4a

Please sign in to comment.