Skip to content

Commit

Permalink
OXDEV-7605 Add test for low stock popup
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaIvanovski committed Nov 19, 2024
1 parent 9d3df12 commit 563d081
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Codeception/Acceptance/ProductDetailsPageCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,39 @@ public function checkProductAmountPrice(AcceptanceTester $I): void
->seeAmountPrices($amountPrices);
}

#[group('product')]
public function popupWhenExceedingStockAvailability(AcceptanceTester $I): void
{
$I->wantToTest('popup is show when exceeding stock availability');

$productNavigation = new ProductNavigation($I);

$productId = '1000';

$I->updateConfigInDatabase('iNewBasketItemMessage', '2', 'str');

// making product out of stock now
$I->updateInDatabase('oxarticles', ['oxstock' => '1', 'oxstockflag' => '2'], ['oxid' => $productId]);

//open details page
$productNavigation
->openProductDetailsPage($productId)
->addProductToBasket(2);

$I->see(Translator::translate('ERROR_MESSAGE_OUTOFSTOCK_OUTOFSTOCK'));

//assert product in basket
$basketItem = [
'id' => $productId,
'title' => 'Test product 0 [EN] šÄßüл',
'totalPrice' => '50,00 €',
'amount' => 1
];

$basketPage = $I->openShop()->openBasket();
$basketPage->seeBasketContains([$basketItem], '50,00 €');
}

private function getExistingUserData()
{
return Fixtures::get('existingUser');
Expand Down

0 comments on commit 563d081

Please sign in to comment.