From 563d081fe57f9afd45bd1102401dc9b9798061fa Mon Sep 17 00:00:00 2001 From: Nikola Ivanovski Date: Tue, 19 Nov 2024 08:54:56 +0200 Subject: [PATCH] OXDEV-7605 Add test for low stock popup --- .../Acceptance/ProductDetailsPageCest.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/Codeception/Acceptance/ProductDetailsPageCest.php b/tests/Codeception/Acceptance/ProductDetailsPageCest.php index 8c0440f21b..c9c5f1453b 100644 --- a/tests/Codeception/Acceptance/ProductDetailsPageCest.php +++ b/tests/Codeception/Acceptance/ProductDetailsPageCest.php @@ -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');