update per feedback, add spacing, remove unused function

This commit is contained in:
Ron Rennick 2021-08-26 10:07:13 -03:00
parent 8cbb606c7e
commit 76332ec0c8
2 changed files with 5 additions and 25 deletions

View File

@ -30,26 +30,6 @@ const VirtualProductName = 'Virtual Product Name';
const NonVirtualProductName = 'Non-Virtual Product Name';
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
const verifyPublishAndTrash = async () => {
// Wait for auto save
await page.waitFor( 2000 );
// Publish product
await expect( page ).toClick( '#publish' );
await page.waitForSelector( '.updated.notice', { text: 'Product published.' } );
// Verify
await expect( page ).toMatchElement( '.updated.notice', { text: 'Product published.' } );
await page.waitForSelector( 'a', { text: 'Move to Trash' } );
// Trash product
await expect( page ).toClick( 'a', { text: 'Move to Trash' } );
await page.waitForSelector( '.updated.notice', { text: '1 product moved to the Trash.' } );
// Verify
await expect( page ).toMatchElement( '.updated.notice', { text: '1 product moved to the Trash.' } );
};
const openNewProductAndVerify = async () => {
// Go to "add product" page
await merchant.openNewProduct();
@ -221,7 +201,7 @@ const runAddVariableProductTest = () => {
await page.focus('button.save-variation-changes');
await expect(page).toClick('button.save-variation-changes', {text: 'Save changes'});
// @todo: add one or more tests to verify changes were saved
// @todo: https://github.com/woocommerce/woocommerce/issues/30580
});
});
};

View File

@ -13,8 +13,8 @@ const updateReadyPageStatus = async ( status ) => {
const wpPagesEndpoint = '/wp/v2/pages';
const adminUsername = testConfig.users.admin.username ? testConfig.users.admin.username : 'admin';
const adminPassword = testConfig.users.admin.password ? testConfig.users.admin.password : 'password';
const client = HTTPClientFactory.build(apiUrl)
.withBasicAuth(adminUsername, adminPassword)
const client = HTTPClientFactory.build( apiUrl )
.withBasicAuth( adminUsername, adminPassword )
.create();
// As the default status filter in the API is `publish`, we need to
@ -25,11 +25,11 @@ const updateReadyPageStatus = async ( status ) => {
statusFilter = 'draft';
}
const getPostsResponse = await client.get(`${wpPagesEndpoint}?search=ready&status=${statusFilter}` );
const getPostsResponse = await client.get( `${wpPagesEndpoint}?search=ready&status=${statusFilter}` );
if ( getPostsResponse.data && getPostsResponse.data.length > 0 ) {
const pageId = getPostsResponse.data[0].id;
// Update the page to the new status
await client.put(`${wpPagesEndpoint}/${pageId}`, { 'status': status } );
await client.post( `${wpPagesEndpoint}/${pageId}`, { 'status': status } );
}
}