2020-09-04 02:31:09 +00:00
|
|
|
/**
|
2021-04-05 00:09:36 +00:00
|
|
|
* External dependencies
|
2020-09-04 02:31:09 +00:00
|
|
|
*/
|
2021-03-17 19:22:09 +00:00
|
|
|
import {
|
|
|
|
clearAndFillInput,
|
|
|
|
verifyValueOfInputField,
|
|
|
|
} from '@woocommerce/e2e-utils';
|
2020-09-04 02:31:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-04-05 00:09:36 +00:00
|
|
|
import { WcSettings } from '../../pages/WcSettings';
|
|
|
|
import { WpSettings } from '../../pages/WpSettings';
|
|
|
|
import { Login } from '../../pages/Login';
|
2020-09-04 02:31:09 +00:00
|
|
|
|
2021-04-05 00:09:36 +00:00
|
|
|
describe( 'Store owner can finish initial store setup', () => {
|
|
|
|
const wcSettings = new WcSettings( page );
|
|
|
|
const wpSettings = new WpSettings( page );
|
|
|
|
const login = new Login( page );
|
2020-09-04 02:31:09 +00:00
|
|
|
|
2021-04-05 00:09:36 +00:00
|
|
|
beforeAll( async () => {
|
|
|
|
await login.login();
|
|
|
|
} );
|
|
|
|
afterAll( async () => {
|
|
|
|
await login.logout();
|
2020-09-04 02:31:09 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can enable tax rates and calculations', async () => {
|
2021-03-17 19:22:09 +00:00
|
|
|
// Go to general settings page
|
2021-04-05 00:09:36 +00:00
|
|
|
await wcSettings.navigate( 'general' );
|
2021-03-17 19:22:09 +00:00
|
|
|
await wcSettings.enableTaxRates();
|
|
|
|
await wcSettings.saveSettings();
|
2020-09-04 02:31:09 +00:00
|
|
|
|
|
|
|
// Verify that settings have been saved
|
2021-03-17 19:22:09 +00:00
|
|
|
const taxRate = await wcSettings.getTaxRateValue();
|
|
|
|
expect( taxRate ).toEqual( true );
|
2020-09-04 02:31:09 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can configure permalink settings', async () => {
|
|
|
|
// Go to Permalink Settings page
|
2021-04-05 00:09:36 +00:00
|
|
|
await wpSettings.navigate();
|
2021-03-17 19:22:09 +00:00
|
|
|
await wpSettings.openPermalinkSettings();
|
2020-09-04 02:31:09 +00:00
|
|
|
|
|
|
|
// Select "Post name" option in common settings section
|
2021-03-17 19:22:09 +00:00
|
|
|
await page.click( 'input[value="/%postname%/"]' );
|
2020-09-04 02:31:09 +00:00
|
|
|
|
|
|
|
// Select "Custom base" in product permalinks section
|
|
|
|
await page.click( '#woocommerce_custom_selection' );
|
|
|
|
|
|
|
|
// Fill custom base slug to use
|
2021-03-17 19:22:09 +00:00
|
|
|
await clearAndFillInput( '#woocommerce_permalink_structure', '' );
|
|
|
|
await page.type( '#woocommerce_permalink_structure', '/product/' );
|
2020-09-04 02:31:09 +00:00
|
|
|
|
2021-03-17 19:22:09 +00:00
|
|
|
await wpSettings.saveSettings();
|
2020-09-04 02:31:09 +00:00
|
|
|
|
|
|
|
// Verify that settings have been saved
|
|
|
|
await Promise.all( [
|
|
|
|
expect( page ).toMatchElement( '#setting-error-settings_updated', {
|
|
|
|
text: 'Permalink structure updated.',
|
|
|
|
} ),
|
|
|
|
verifyValueOfInputField( '#permalink_structure', '/%postname%/' ),
|
|
|
|
verifyValueOfInputField(
|
|
|
|
'#woocommerce_permalink_structure',
|
|
|
|
'/product/'
|
|
|
|
),
|
|
|
|
] );
|
|
|
|
} );
|
|
|
|
} );
|