@@ -34,6 +34,7 @@ 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
+
37
38
const product = await catalog . createSimpleProduct ( {
38
39
inventoryTracking : 'product' ,
39
40
inventoryLevel : 0 ,
@@ -46,6 +47,54 @@ test('Displays out of stock product correctly', async ({ page, catalog }) => {
46
47
await expect ( page . getByRole ( 'button' , { name : t ( 'Submit.outOfStock' ) } ) ) . toBeVisible ( ) ;
47
48
} ) ;
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
+
62
+ const product = await catalog . createSimpleProduct ( {
63
+ inventoryTracking : 'product' ,
64
+ inventoryLevel : 0 ,
65
+ } ) ;
66
+
67
+ await page . goto ( product . path ) ;
68
+ await page . waitForLoadState ( 'networkidle' ) ;
69
+
70
+ await expect ( page . getByRole ( 'heading' , { name : product . name } ) ) . toBeVisible ( ) ;
71
+ await expect ( page . getByRole ( 'button' , { name : t ( 'Submit.outOfStock' ) } ) ) . toBeVisible ( ) ;
72
+ await expect ( page . getByText ( 'Currently out of stock' ) ) . toBeVisible ( ) ;
73
+ } ) ;
74
+
75
+ test ( 'Displays current stock message when stock level message is enabled' , async ( {
76
+ page,
77
+ catalog,
78
+ settings,
79
+ } ) => {
80
+ const t = await getTranslations ( 'Product.ProductDetails' ) ;
81
+
82
+ await settings . setInventorySettings ( {
83
+ stockLevelDisplay : 'show' ,
84
+ } ) ;
85
+
86
+ const product = await catalog . createSimpleProduct ( {
87
+ inventoryTracking : 'product' ,
88
+ inventoryLevel : 10 ,
89
+ } ) ;
90
+
91
+ await page . goto ( product . path ) ;
92
+ await page . waitForLoadState ( 'networkidle' ) ;
93
+
94
+ await expect ( page . getByRole ( 'heading' , { name : product . name } ) ) . toBeVisible ( ) ;
95
+ await expect ( page . getByText ( t ( 'currentStock' , { quantity : 10 } ) ) ) . toBeVisible ( ) ;
96
+ } ) ;
97
+
49
98
test ( 'Displays product price correctly for an alternate currency' , async ( {
50
99
page,
51
100
catalog,
0 commit comments