From ff742ed83aab11db92cc083d0472dd3942bf8588 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sun, 17 Sep 2023 19:22:59 +0200 Subject: [PATCH 01/12] Addig media fields for the product part --- .../Recipes/Media/product-image.png | Bin 0 -> 7340 bytes ...dCore.Commerce.Content.Product.recipe.json | 34 +++++++++++++ ...dCore.Commerce.Samples.Product.recipe.json | 48 ++++++++++++++++-- 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 src/Modules/OrchardCore.Commerce/Recipes/Media/product-image.png diff --git a/src/Modules/OrchardCore.Commerce/Recipes/Media/product-image.png b/src/Modules/OrchardCore.Commerce/Recipes/Media/product-image.png new file mode 100644 index 0000000000000000000000000000000000000000..1d37b788c880e065821faf74566a1e4d17f5923b GIT binary patch literal 7340 zcmdscS2P@M^sN+ih~8_07`>P1f{4+LZV+V})Oy+%y*61}%XCxl?4_ZnlO1%pvX zFaP}R+gICia7ff&tLXpBzy1pXynknn zNp0T0^uSwR?Ilj_7}L(b;<1C0mJ$w5Lo(pT8uwpK=<(Xr8wZEN=f8NcV$T|YgTthx zuA*cRV7ZSZgc!`S;2*MHC$SMdd&ag6e%(MUDHd8=#t%|#<%W|V3-_leCs>!7H@}Y zDiWcAi0U1yfeaj40$U0QTY|brxX|+++}@1G|1Sd8C62nag*eVeA&JhHbM+0)h0p2+qMO`={heOGFpropnE`@K=9q7p{ef;MHBCMgasetjAuzB z$nMRi!?#syXe7Oc|D?$C_0lu^^7U7Q*VtWuJ;VTg{{8}?gBq8aS>S9C@$tctg|Nrc z){M%KRKD;w@B8JpA ziWVzse+bq9+KxzZwMfH}Ha_(No?3(+)HzB8zrI-N2WEoKjYuNb@1Jbhg9LmX+OHnB z#=#sOgq9aT<0AM{%Ik9vaBgGG|3TDRp6)WG(nq7IuwWSV$u2sb0HU-RM7lfG?o z_Q^^pCE5VJswn9~bNk@om7@AhCPVueBKK86q8yLqZ+-!u_cifc43gy<8Z(A|on7&S zo(tb#q)+aH2)Io%vr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Z!~2uF_um+RWfe(2O=)$Iio( zOyHwgKP@7jYHz9WvDU4Rpe(~Q+ZV#T&~rv0NIFQeYahur`F4WK@R a%@scBhY+7z{QF_VQCHPgseSq8{r> Date: Sun, 17 Sep 2023 20:03:32 +0200 Subject: [PATCH 02/12] Trying to fix images fo UI tests --- .../OrchardCore.Commerce/OrchardCore.Commerce.csproj | 6 ++++++ .../OrchardCore.Commerce.Content.Product.recipe.json | 9 --------- .../OrchardCore.Commerce.Samples.Product.recipe.json | 9 +++++++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj index c38ab3cb1..403b225d5 100644 --- a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj +++ b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj @@ -41,6 +41,12 @@ + + + PreserveNewest + + + diff --git a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Content.Product.recipe.json b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Content.Product.recipe.json index bdfb58eaa..1c21ad4dc 100644 --- a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Content.Product.recipe.json +++ b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Content.Product.recipe.json @@ -279,15 +279,6 @@ ] } ] - }, - { - "name": "media", - "Files": [ - { - "SourcePath": "Media/product-image.png", - "TargetPath": "Media/product-image.png" - } - ] } ] } diff --git a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json index ac30ba0c7..d9096e5df 100644 --- a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json +++ b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json @@ -475,6 +475,15 @@ } } ] + }, + { + "name": "media", + "Files": [ + { + "SourcePath": "media/product-image.png", + "TargetPath": "media/product-image.png" + } + ] } ] } From 923a777ff50f397b13c78e8969783a42584d8cd0 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sun, 17 Sep 2023 21:19:25 +0200 Subject: [PATCH 03/12] Fixing images during UI testing --- .../Migrations/ProductMigrations.cs | 6 +++++ .../OrchardCore.Commerce.csproj | 6 ----- ...dCore.Commerce.Content.Product.recipe.json | 25 ------------------- ...dCore.Commerce.Samples.Product.recipe.json | 2 +- .../OrchardCore.Commerce.Tests.UI.csproj | 2 +- .../LocalizedProductBehaviourTests.cs | 3 ++- 6 files changed, 10 insertions(+), 34 deletions(-) diff --git a/src/Modules/OrchardCore.Commerce/Migrations/ProductMigrations.cs b/src/Modules/OrchardCore.Commerce/Migrations/ProductMigrations.cs index f2963939e..8f5d5d41d 100644 --- a/src/Modules/OrchardCore.Commerce/Migrations/ProductMigrations.cs +++ b/src/Modules/OrchardCore.Commerce/Migrations/ProductMigrations.cs @@ -3,6 +3,8 @@ using OrchardCore.ContentManagement.Metadata; using OrchardCore.ContentManagement.Metadata.Settings; using OrchardCore.Data.Migration; +using OrchardCore.Media.Fields; +using OrchardCore.Media.Settings; using YesSql.Sql; namespace OrchardCore.Commerce.Migrations; @@ -21,6 +23,10 @@ public int Create() { _contentDefinitionManager .AlterPartDefinition(nameof(ProductPart), builder => builder + .WithField("ProductImage", field => field + .OfType(nameof(MediaField)) + .WithDisplayName("Product Image") + .WithSettings(new MediaFieldSettings { Multiple = false })) .Attachable() .WithDescription("Makes a content item into a product.")); diff --git a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj index 403b225d5..c38ab3cb1 100644 --- a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj +++ b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj @@ -41,12 +41,6 @@ - - - PreserveNewest - - - diff --git a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Content.Product.recipe.json b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Content.Product.recipe.json index 1c21ad4dc..d2438ef73 100644 --- a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Content.Product.recipe.json +++ b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Content.Product.recipe.json @@ -229,31 +229,6 @@ } ], "ContentParts": [ - { - "Name": "ProductPart", - "Settings": { - "ContentPartSettings": { - "Attachable": true, - "Description": "Makes a content item into a product." - } - }, - "ContentPartFieldDefinitionRecords": [ - { - "FieldName": "MediaField", - "Name": "ProductImage", - "Settings": { - "ContentPartFieldSettings": { - "DisplayName": "Product Image", - "Position": "0" - }, - "MediaFieldSettings": { - "Multiple": false, - "AllowedExtensions": [] - } - } - } - ] - }, { "Name": "PriceVariantsProduct", "Settings": {}, diff --git a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json index d9096e5df..43c4991fc 100644 --- a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json +++ b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json @@ -481,7 +481,7 @@ "Files": [ { "SourcePath": "media/product-image.png", - "TargetPath": "media/product-image.png" + "TargetPath": "product-image.png" } ] } diff --git a/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj b/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj index 0f8fa56d5..e1501c3d1 100644 --- a/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj +++ b/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/test/OrchardCore.Commerce.Tests.UI/Tests/LocalizedProductTests/LocalizedProductBehaviourTests.cs b/test/OrchardCore.Commerce.Tests.UI/Tests/LocalizedProductTests/LocalizedProductBehaviourTests.cs index 4e002e620..52ad232dc 100644 --- a/test/OrchardCore.Commerce.Tests.UI/Tests/LocalizedProductTests/LocalizedProductBehaviourTests.cs +++ b/test/OrchardCore.Commerce.Tests.UI/Tests/LocalizedProductTests/LocalizedProductBehaviourTests.cs @@ -1,4 +1,4 @@ -using Lombiq.Tests.UI.Attributes; +using Lombiq.Tests.UI.Attributes; using Lombiq.Tests.UI.Extensions; using Lombiq.Tests.UI.Services; using OpenQA.Selenium; @@ -27,6 +27,7 @@ public Task LocalizedProductCreationShouldBeAllowed(Browser browser) => ExecuteTestAfterSetupAsync( async context => { + await context.SwitchToInteractiveAsync(); await context.SignInDirectlyAsync(); await GoToLocalizedProductAsync(context); From 9c3b4edd4c1f8d02810aeaa056a2dbf7b315e98d Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sun, 17 Sep 2023 21:39:13 +0200 Subject: [PATCH 04/12] Removing interactive mode --- .../LocalizedProductTests/LocalizedProductBehaviourTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/OrchardCore.Commerce.Tests.UI/Tests/LocalizedProductTests/LocalizedProductBehaviourTests.cs b/test/OrchardCore.Commerce.Tests.UI/Tests/LocalizedProductTests/LocalizedProductBehaviourTests.cs index 52ad232dc..8ceeb5698 100644 --- a/test/OrchardCore.Commerce.Tests.UI/Tests/LocalizedProductTests/LocalizedProductBehaviourTests.cs +++ b/test/OrchardCore.Commerce.Tests.UI/Tests/LocalizedProductTests/LocalizedProductBehaviourTests.cs @@ -27,7 +27,6 @@ public Task LocalizedProductCreationShouldBeAllowed(Browser browser) => ExecuteTestAfterSetupAsync( async context => { - await context.SwitchToInteractiveAsync(); await context.SignInDirectlyAsync(); await GoToLocalizedProductAsync(context); From daaecc4f030a21c58d6a837270006e00e64eacf2 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sun, 17 Sep 2023 21:42:10 +0200 Subject: [PATCH 05/12] Trying to fix ui tests --- .../OrchardCore.Commerce/OrchardCore.Commerce.csproj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj index c38ab3cb1..f39d3bb9e 100644 --- a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj +++ b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj @@ -47,6 +47,13 @@ + + + + PreserveNewest + + + ..\..\..\..\..\Utilities\Lombiq.NodeJs.Extensions\Lombiq.NodeJs.Extensions From a5167137447b53ce77f39216dcafd46956a8264a Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sun, 17 Sep 2023 21:42:20 +0200 Subject: [PATCH 06/12] Typo --- src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj index f39d3bb9e..5292ac659 100644 --- a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj +++ b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj @@ -49,7 +49,7 @@ - + PreserveNewest From 480eb2be6f27fc8c9f01441d0a7d277b0c21c18b Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sun, 17 Sep 2023 21:54:08 +0200 Subject: [PATCH 07/12] Trying to fix UI test --- .../OrchardCore.Commerce.csproj | 2 +- .../sample-product-image.png} | Bin ...OrchardCore.Commerce.Samples.Product.recipe.json | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/Modules/OrchardCore.Commerce/Recipes/Media/{product-image.png => Product Images/sample-product-image.png} (100%) diff --git a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj index 5292ac659..66c227234 100644 --- a/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj +++ b/src/Modules/OrchardCore.Commerce/OrchardCore.Commerce.csproj @@ -49,7 +49,7 @@ - + PreserveNewest diff --git a/src/Modules/OrchardCore.Commerce/Recipes/Media/product-image.png b/src/Modules/OrchardCore.Commerce/Recipes/Media/Product Images/sample-product-image.png similarity index 100% rename from src/Modules/OrchardCore.Commerce/Recipes/Media/product-image.png rename to src/Modules/OrchardCore.Commerce/Recipes/Media/Product Images/sample-product-image.png diff --git a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json index 43c4991fc..d3456b100 100644 --- a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json +++ b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json @@ -480,8 +480,8 @@ "name": "media", "Files": [ { - "SourcePath": "media/product-image.png", - "TargetPath": "product-image.png" + "SourcePath": "Media/Product Images/sample-product-image.png", + "TargetPath": "Product Images/sample-product-image.png" } ] } From 7a2a44af81e4650b8377ba0302d6938fdd72bdb8 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sun, 17 Sep 2023 22:04:22 +0200 Subject: [PATCH 08/12] Renaming image on other places --- .../OrchardCore.Commerce.Samples.Product.recipe.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json index d3456b100..ab16427ed 100644 --- a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json +++ b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json @@ -173,7 +173,7 @@ "Sku": "TESTPRODUCTVARIANT", "ProductImage": { "Paths": [ - "product-image.png" + "sample-product-image.png" ], "MediaTexts": [ "" @@ -215,7 +215,7 @@ "Sku": "TESTPRODUCT", "ProductImage": { "Paths": [ - "product-image.png" + "sample-product-image.png" ], "MediaTexts": [ "" @@ -288,7 +288,7 @@ "Sku": "TESTFREEPRODUCT", "ProductImage": { "Paths": [ - "product-image.png" + "sample-product-image.png" ], "MediaTexts": [ "" @@ -361,7 +361,7 @@ "Sku": "TESTDISCOUNTEDPRODUCT", "ProductImage": { "Paths": [ - "product-image.png" + "sample-product-image.png" ], "MediaTexts": [ "" @@ -448,7 +448,7 @@ "Sku": "LOCALIZED", "ProductImage": { "Paths": [ - "product-image.png" + "sample-product-image.png" ], "MediaTexts": [ "" From b62696826c738df8e9d3148463a1e871dcfb12e3 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sun, 17 Sep 2023 22:21:30 +0200 Subject: [PATCH 09/12] Fixing paths --- .../OrchardCore.Commerce.Samples.Product.recipe.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json index ab16427ed..543c9224f 100644 --- a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json +++ b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json @@ -173,7 +173,7 @@ "Sku": "TESTPRODUCTVARIANT", "ProductImage": { "Paths": [ - "sample-product-image.png" + "Product Images/sample-product-image.png" ], "MediaTexts": [ "" @@ -215,7 +215,7 @@ "Sku": "TESTPRODUCT", "ProductImage": { "Paths": [ - "sample-product-image.png" + "Product Images/sample-product-image.png" ], "MediaTexts": [ "" @@ -288,7 +288,7 @@ "Sku": "TESTFREEPRODUCT", "ProductImage": { "Paths": [ - "sample-product-image.png" + "Product Images/sample-product-image.png" ], "MediaTexts": [ "" @@ -361,7 +361,7 @@ "Sku": "TESTDISCOUNTEDPRODUCT", "ProductImage": { "Paths": [ - "sample-product-image.png" + "Product Images/sample-product-image.png" ], "MediaTexts": [ "" @@ -448,7 +448,7 @@ "Sku": "LOCALIZED", "ProductImage": { "Paths": [ - "sample-product-image.png" + "Product Images/sample-product-image.png" ], "MediaTexts": [ "" From ac809f998f57efd5bc63e46ff09d56439ce21d25 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Thu, 21 Sep 2023 18:59:31 +0200 Subject: [PATCH 10/12] Fixing minor problems --- .../Migrations/ProductMigrations.cs | 14 ++++++++++++-- .../OrchardCore.Commerce/Models/ProductPart.cs | 2 ++ .../sample-product-image.png | Bin ...chardCore.Commerce.Samples.Product.recipe.json | 14 +++++++------- 4 files changed, 21 insertions(+), 9 deletions(-) rename src/Modules/OrchardCore.Commerce/Recipes/Media/{Product Images => ProductImages}/sample-product-image.png (100%) diff --git a/src/Modules/OrchardCore.Commerce/Migrations/ProductMigrations.cs b/src/Modules/OrchardCore.Commerce/Migrations/ProductMigrations.cs index 8f5d5d41d..1a7cc7ac6 100644 --- a/src/Modules/OrchardCore.Commerce/Migrations/ProductMigrations.cs +++ b/src/Modules/OrchardCore.Commerce/Migrations/ProductMigrations.cs @@ -23,7 +23,7 @@ public int Create() { _contentDefinitionManager .AlterPartDefinition(nameof(ProductPart), builder => builder - .WithField("ProductImage", field => field + .WithField(nameof(ProductPart.ProductImage), field => field .OfType(nameof(MediaField)) .WithDisplayName("Product Image") .WithSettings(new MediaFieldSettings { Multiple = false })) @@ -41,6 +41,16 @@ public int Create() $"IDX_{nameof(ProductPartIndex)}_{nameof(ProductPartIndex.Sku)}", nameof(ProductPartIndex.Sku))); - return 1; + return 2; + } + + public int UpdateFrom1() + { + _contentDefinitionManager + .AlterPartDefinition(builder => builder + .WithField(part => part.ProductImage, field => field + .WithDisplayName("Product Image") + .WithSettings(new MediaFieldSettings { Multiple = false }))); + return 2; } } diff --git a/src/Modules/OrchardCore.Commerce/Models/ProductPart.cs b/src/Modules/OrchardCore.Commerce/Models/ProductPart.cs index 9c3c3783a..50bbf65ef 100644 --- a/src/Modules/OrchardCore.Commerce/Models/ProductPart.cs +++ b/src/Modules/OrchardCore.Commerce/Models/ProductPart.cs @@ -1,4 +1,5 @@ using OrchardCore.ContentManagement; +using OrchardCore.Media.Fields; using System.Collections.Generic; namespace OrchardCore.Commerce.Models; @@ -14,4 +15,5 @@ public class ProductPart : ContentPart /// public string Sku { get; set; } public IDictionary CanBeBought { get; } = new Dictionary(); + public MediaField ProductImage { get; set; } } diff --git a/src/Modules/OrchardCore.Commerce/Recipes/Media/Product Images/sample-product-image.png b/src/Modules/OrchardCore.Commerce/Recipes/Media/ProductImages/sample-product-image.png similarity index 100% rename from src/Modules/OrchardCore.Commerce/Recipes/Media/Product Images/sample-product-image.png rename to src/Modules/OrchardCore.Commerce/Recipes/Media/ProductImages/sample-product-image.png diff --git a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json index 543c9224f..810afa60f 100644 --- a/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json +++ b/src/Modules/OrchardCore.Commerce/Recipes/OrchardCore.Commerce.Samples.Product.recipe.json @@ -173,7 +173,7 @@ "Sku": "TESTPRODUCTVARIANT", "ProductImage": { "Paths": [ - "Product Images/sample-product-image.png" + "ProductImages/sample-product-image.png" ], "MediaTexts": [ "" @@ -215,7 +215,7 @@ "Sku": "TESTPRODUCT", "ProductImage": { "Paths": [ - "Product Images/sample-product-image.png" + "ProductImages/sample-product-image.png" ], "MediaTexts": [ "" @@ -288,7 +288,7 @@ "Sku": "TESTFREEPRODUCT", "ProductImage": { "Paths": [ - "Product Images/sample-product-image.png" + "ProductImages/sample-product-image.png" ], "MediaTexts": [ "" @@ -361,7 +361,7 @@ "Sku": "TESTDISCOUNTEDPRODUCT", "ProductImage": { "Paths": [ - "Product Images/sample-product-image.png" + "ProductImages/sample-product-image.png" ], "MediaTexts": [ "" @@ -448,7 +448,7 @@ "Sku": "LOCALIZED", "ProductImage": { "Paths": [ - "Product Images/sample-product-image.png" + "ProductImages/sample-product-image.png" ], "MediaTexts": [ "" @@ -480,8 +480,8 @@ "name": "media", "Files": [ { - "SourcePath": "Media/Product Images/sample-product-image.png", - "TargetPath": "Product Images/sample-product-image.png" + "SourcePath": "Media/ProductImages/sample-product-image.png", + "TargetPath": "ProductImages/sample-product-image.png" } ] } From c0847b0591e469ca9de047fe5a501a415696fb32 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Thu, 21 Sep 2023 19:21:57 +0200 Subject: [PATCH 11/12] Adding UI test --- .../Tests/ProductTests/RetrievalProductTests.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/OrchardCore.Commerce.Tests.UI/Tests/ProductTests/RetrievalProductTests.cs b/test/OrchardCore.Commerce.Tests.UI/Tests/ProductTests/RetrievalProductTests.cs index df342a323..623bdd263 100644 --- a/test/OrchardCore.Commerce.Tests.UI/Tests/ProductTests/RetrievalProductTests.cs +++ b/test/OrchardCore.Commerce.Tests.UI/Tests/ProductTests/RetrievalProductTests.cs @@ -1,4 +1,4 @@ -using Lombiq.Tests.UI.Attributes; +using Lombiq.Tests.UI.Attributes; using Lombiq.Tests.UI.Extensions; using Lombiq.Tests.UI.Services; using OpenQA.Selenium; @@ -25,9 +25,22 @@ void TextShouldBe(string css, string expectedText) => await context.SignInDirectlyAndGoToHomepageAsync(); + TextShouldBe(".site-heading h1", "My Shop"); TextShouldBe(".site-heading h1", "My Shop"); TextShouldBe(".content-price-variants-product header h2 a", "Test Price Variant Product"); + TextShouldBe( + ".content-price-variants-product > .field-name-product-" + + "part-product-image > .name", + "Product Image"); TextShouldBe(".content-product header h2 a", "Test Product"); + TextShouldBe( + ".content-product > .field-name-product-" + + "part-product-image > .name", + "Product Image"); + + context.GetAll(By.XPath("//img[@src='/media/ProductImages/sample-product-image.png']")) + .Count + .ShouldBe(5); }, browser); } From 9c262ef00d844fbdd39a78a4f8e985c0213cecdd Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Sat, 23 Sep 2023 13:03:02 +0200 Subject: [PATCH 12/12] Removing extra line --- .../Tests/ProductTests/RetrievalProductTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/OrchardCore.Commerce.Tests.UI/Tests/ProductTests/RetrievalProductTests.cs b/test/OrchardCore.Commerce.Tests.UI/Tests/ProductTests/RetrievalProductTests.cs index 623bdd263..fb4498bc1 100644 --- a/test/OrchardCore.Commerce.Tests.UI/Tests/ProductTests/RetrievalProductTests.cs +++ b/test/OrchardCore.Commerce.Tests.UI/Tests/ProductTests/RetrievalProductTests.cs @@ -25,7 +25,6 @@ void TextShouldBe(string css, string expectedText) => await context.SignInDirectlyAndGoToHomepageAsync(); - TextShouldBe(".site-heading h1", "My Shop"); TextShouldBe(".site-heading h1", "My Shop"); TextShouldBe(".content-price-variants-product header h2 a", "Test Price Variant Product"); TextShouldBe(