@@ -34,6 +34,31 @@ test('Displays a simple product and can add it to the cart', async ({
34
34
35
35
test ( 'Displays out of stock product correctly' , async ( { page, catalog } ) => {
36
36
const t = await getTranslations ( 'Product.ProductDetails' ) ;
37
+
38
+ const product = await catalog . createSimpleProduct ( {
39
+ inventoryTracking : 'product' ,
40
+ inventoryLevel : 0 ,
41
+ } ) ;
42
+
43
+ await page . goto ( product . path ) ;
44
+ await page . waitForLoadState ( 'networkidle' ) ;
45
+
46
+ await expect ( page . getByRole ( 'heading' , { name : product . name } ) ) . toBeVisible ( ) ;
47
+ await expect ( page . getByRole ( 'button' , { name : t ( 'Submit.outOfStock' ) } ) ) . toBeVisible ( ) ;
48
+ } ) ;
49
+
50
+ test ( 'Displays out of stock product correctly when out of stock message is enabled' , async ( {
51
+ page,
52
+ catalog,
53
+ settings,
54
+ } ) => {
55
+ const t = await getTranslations ( 'Product.ProductDetails' ) ;
56
+
57
+ await settings . setInventorySettings ( {
58
+ showOutOfStockMessage : true ,
59
+ defaultOutOfStockMessage : 'Currently out of stock' ,
60
+ } ) ;
61
+
37
62
const product = await catalog . createSimpleProduct ( {
38
63
inventoryTracking : 'product' ,
39
64
inventoryLevel : 0 ,
@@ -44,6 +69,7 @@ test('Displays out of stock product correctly', async ({ page, catalog }) => {
44
69
45
70
await expect ( page . getByRole ( 'heading' , { name : product . name } ) ) . toBeVisible ( ) ;
46
71
await expect ( page . getByRole ( 'button' , { name : t ( 'Submit.outOfStock' ) } ) ) . toBeVisible ( ) ;
72
+ await expect ( page . getByText ( 'Currently out of stock' ) ) . toBeVisible ( ) ;
47
73
} ) ;
48
74
49
75
test ( 'Displays product price correctly for an alternate currency' , async ( {
0 commit comments