Skip to content

Commit

Permalink
Fix and improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlavtox committed Oct 1, 2024
1 parent 8bd63a8 commit 0ce263d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ describe('FO - Product page - Product page : Out of stock behaviour', async () =
expect(isAddToCartButtonEnabled).to.equal(false);

const productAvailability = await foHummingbirdProductPage.getProductAvailabilityLabel(page);
expect(productAvailability).to.contains('Out-of-Stock');
expect(productAvailability).to.contains('Out of stock');
});

it('should go back to BO', async function () {
Expand Down Expand Up @@ -290,6 +290,43 @@ describe('FO - Product page - Product page : Out of stock behaviour', async () =
const productAvailability = await foHummingbirdProductPage.getProductAvailabilityLabel(page);
expect(productAvailability).to.be.contains('Out of stock');
});

it('should go back to BO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBackOffice3', baseContext);

// Go back to BO
page = await foHummingbirdProductPage.closePage(browserContext, page, 0);

const pageTitle = await createProductPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductPage.pageTitle);
});

it('should clear When out of stock values', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'clearWhenOutOfStockValues', baseContext);

await boProductsCreateTabStocksPage.setLabelWhenOutOfStock(page, '');
await boProductsCreateTabStocksPage.setOptionWhenOutOfStock(page, 'Deny orders');

const message = await createProductPage.saveProduct(page);
expect(message).to.equal(createProductPage.successfulUpdateMessage);
});

it('should preview product', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'previewProduct4', baseContext);

// Click on preview button
page = await createProductPage.previewProduct(page);

const pageTitle = await foHummingbirdProductPage.getPageTitle(page);
expect(pageTitle).to.contains(newProductData.name);
});

it('should check that the availability field contains the global value', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkDefaultAvailabilityLabel', baseContext);

const productAvailability = await foHummingbirdProductPage.getProductAvailabilityLabel(page);
expect(productAvailability).to.be.contains('Out-of-stock');
});
});

// Post-condition : Uninstall Hummingbird
Expand Down
2 changes: 1 addition & 1 deletion tests/UI/pages/BO/catalog/products/add/combinationsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class CombinationsTab extends BOBasePage {
this.denyOrderRadioButton = '#product_combinations_availability_out_of_stock_type_0 +i';
this.allowOrderRadioButton = '#product_combinations_availability_out_of_stock_type_1 +i';
this.useDefaultBehaviourRadioButton = '#product_combinations_availability_out_of_stock_type_2 +i';
this.editDefaultBehaviourLink = '#product_combinations_availability a[href*=configuration_fieldset_stock]';
this.editDefaultBehaviourLink = '#product_combinations_availability .form-external-link a[href*=configuration_fieldset_stock]';

Check failure on line 337 in tests/UI/pages/BO/catalog/products/add/combinationsTab.ts

View workflow job for this annotation

GitHub Actions / ESLint

This line has a length of 131. Maximum allowed is 130
this.labelWhenInStock = '#product_combinations_availability_available_now_label_1';
this.labelWhenOutOfStock = '#product_combinations_availability_available_later_label_1';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class VirtualProductTab extends BOBasePage {
this.denyOrderRadioButton = '#product_stock_availability_out_of_stock_type_0 +i';
this.allowOrderRadioButton = '#product_stock_availability_out_of_stock_type_1 +i';
this.useDefaultBehaviourRadioButton = '#product_stock_availability_out_of_stock_type_2 +i';
this.editDefaultBehaviourLink = '#product_stock_availability a[href*=configuration_fieldset_stock]';
this.editDefaultBehaviourLink = '#product_stock_availability .form-external-link a[href*=configuration_fieldset_stock]';
this.labelWhenInStock = '#product_stock_availability_available_now_label_1';
this.labelWhenOutOfStock = '#product_stock_availability_available_later_label_1';
}
Expand Down

0 comments on commit 0ce263d

Please sign in to comment.