From 1d1c08205cc9fa964fdc8c7cca1f68d181fe7159 Mon Sep 17 00:00:00 2001 From: Sourav Kunda <50537259+07souravkunda@users.noreply.github.com> Date: Wed, 4 Jan 2023 11:01:47 +0530 Subject: [PATCH 01/22] update: refactor sdk --- .gitignore | 3 + NUnit-BrowserStack/.config/dotnet-tools.json | 12 +++ NUnit-BrowserStack/App.config | 62 ------------ NUnit-BrowserStack/BrowserStackNUnitTest.cs | 74 +------------- NUnit-BrowserStack/LocalTest.cs | 19 ---- NUnit-BrowserStack/NUnit-BrowserStack.csproj | 99 +++---------------- NUnit-BrowserStack/ParallelTest.cs | 15 --- NUnit-BrowserStack/Properties/AssemblyInfo.cs | 37 ------- NUnit-BrowserStack/SampleLocalTest.cs | 20 ++++ .../{SingleTest.cs => SampleTest.cs} | 5 +- NUnit-BrowserStack/browserstack.yml | 75 ++++++++++++++ NUnit-BrowserStack/local.log | 0 NUnit-BrowserStack/packages.config | 18 ---- 13 files changed, 133 insertions(+), 306 deletions(-) create mode 100644 NUnit-BrowserStack/.config/dotnet-tools.json delete mode 100644 NUnit-BrowserStack/App.config delete mode 100644 NUnit-BrowserStack/LocalTest.cs delete mode 100644 NUnit-BrowserStack/ParallelTest.cs delete mode 100644 NUnit-BrowserStack/Properties/AssemblyInfo.cs create mode 100644 NUnit-BrowserStack/SampleLocalTest.cs rename NUnit-BrowserStack/{SingleTest.cs => SampleTest.cs} (86%) create mode 100644 NUnit-BrowserStack/browserstack.yml delete mode 100644 NUnit-BrowserStack/local.log delete mode 100644 NUnit-BrowserStack/packages.config diff --git a/.gitignore b/.gitignore index 4818878..94ba720 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ bin obj .vs .DS_Store +local.log +browserstack.err +log diff --git a/NUnit-BrowserStack/.config/dotnet-tools.json b/NUnit-BrowserStack/.config/dotnet-tools.json new file mode 100644 index 0000000..4f0da2d --- /dev/null +++ b/NUnit-BrowserStack/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "browserstack-sdk": { + "version": "0.0.4", + "commands": [ + "browserstack-sdk" + ] + } + } +} \ No newline at end of file diff --git a/NUnit-BrowserStack/App.config b/NUnit-BrowserStack/App.config deleted file mode 100644 index 9518d06..0000000 --- a/NUnit-BrowserStack/App.config +++ /dev/null @@ -1,62 +0,0 @@ - - - - -
-
-
- - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/NUnit-BrowserStack/BrowserStackNUnitTest.cs b/NUnit-BrowserStack/BrowserStackNUnitTest.cs index c3ce994..530886b 100644 --- a/NUnit-BrowserStack/BrowserStackNUnitTest.cs +++ b/NUnit-BrowserStack/BrowserStackNUnitTest.cs @@ -11,82 +11,22 @@ namespace BrowserStack [TestFixture] public class BrowserStackNUnitTest { - protected IWebDriver driver; - protected string profile; - protected string environment; - private Local browserStackLocal; + protected RemoteWebDriver driver; - public BrowserStackNUnitTest(string profile, string environment) + public BrowserStackNUnitTest() { - this.profile = profile; - this.environment = environment; - } - - static DriverOptions getBrowserOption(String browser) - { - switch (browser) - { - case "chrome": - return new OpenQA.Selenium.Chrome.ChromeOptions(); - case "firefox": - return new OpenQA.Selenium.Firefox.FirefoxOptions(); - case "safari": - return new OpenQA.Selenium.Safari.SafariOptions(); - case "edge": - return new OpenQA.Selenium.Edge.EdgeOptions(); - default: - return new OpenQA.Selenium.Chrome.ChromeOptions(); - } } [SetUp] public void Init() { - NameValueCollection caps = - ConfigurationManager.GetSection("capabilities/" + profile) as NameValueCollection; - NameValueCollection settings = - ConfigurationManager.GetSection("environments/" + environment) - as NameValueCollection; - DriverOptions capability = getBrowserOption(settings["browser"]); + DriverOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions(); capability.BrowserVersion = "latest"; - System.Collections.Generic.Dictionary browserstackOptions = - new Dictionary(); - - foreach (string key in caps.AllKeys) - { - browserstackOptions.Add(key, caps[key]); - } - - String username = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME"); - if (username == null) - { - username = ConfigurationManager.AppSettings.Get("user"); - } - - String accesskey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY"); - if (accesskey == null) - { - accesskey = ConfigurationManager.AppSettings.Get("key"); - } - - browserstackOptions.Add("userName", username); - browserstackOptions.Add("accessKey", accesskey); - if (caps.Get("local").ToString() == "true") - { - browserStackLocal = new Local(); - List> bsLocalArgs = new List< - KeyValuePair - >() - { - new KeyValuePair("key", accesskey) - }; - browserStackLocal.start(bsLocalArgs); - } - capability.AddAdditionalOption("bstack:options", browserstackOptions); + capability.AddAdditionalOption("bstack:options", capability); driver = new RemoteWebDriver( - new Uri("http://" + ConfigurationManager.AppSettings.Get("server") + "/wd/hub/"), + new Uri("http://localhost:4444/wd/hub/"), capability ); } @@ -95,10 +35,6 @@ public void Init() public void Cleanup() { driver.Quit(); - if (browserStackLocal != null) - { - browserStackLocal.stop(); - } } } } diff --git a/NUnit-BrowserStack/LocalTest.cs b/NUnit-BrowserStack/LocalTest.cs deleted file mode 100644 index 70f80b0..0000000 --- a/NUnit-BrowserStack/LocalTest.cs +++ /dev/null @@ -1,19 +0,0 @@ -using NUnit.Framework; -using OpenQA.Selenium; -using System.Text.RegularExpressions; - -namespace BrowserStack -{ - [TestFixture("local", "chrome")] - public class LocalTest : BrowserStackNUnitTest - { - public LocalTest(string profile, string environment) : base(profile, environment) { } - - [Test] - public void HealthCheck() - { - driver.Navigate().GoToUrl("http://bs-local.com:45691/check"); - Assert.IsTrue(Regex.IsMatch(driver.PageSource, "Up and running", RegexOptions.IgnoreCase)); - } - } -} diff --git a/NUnit-BrowserStack/NUnit-BrowserStack.csproj b/NUnit-BrowserStack/NUnit-BrowserStack.csproj index 53f2f2c..a40ed0a 100644 --- a/NUnit-BrowserStack/NUnit-BrowserStack.csproj +++ b/NUnit-BrowserStack/NUnit-BrowserStack.csproj @@ -1,90 +1,21 @@ - - - - - - + + - Debug - AnyCPU - {D309DDB3-1E3B-428B-B00B-1257F2532079} - Library - Properties + net6.0 SingleTest SingleTest - v4.5 - 512 + enable + enable + + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - ..\packages\log4net.2.0.14\lib\net45\log4net.dll - - - - ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\BrowserStackLocal.2.0.0\lib\net20\BrowserStackLocal.dll - - - ..\packages\NUnit.3.13.2\lib\net45\nunit.framework.dll - - - ..\packages\Selenium.WebDriver.4.1.0\lib\net45\WebDriver.dll - - - - - - - - - - - - Designer - - - + - + + + + + - - - \ No newline at end of file + + diff --git a/NUnit-BrowserStack/ParallelTest.cs b/NUnit-BrowserStack/ParallelTest.cs deleted file mode 100644 index 6923a52..0000000 --- a/NUnit-BrowserStack/ParallelTest.cs +++ /dev/null @@ -1,15 +0,0 @@ -using NUnit.Framework; -using OpenQA.Selenium; - -namespace BrowserStack -{ - [TestFixture("parallel", "chrome")] - [TestFixture("parallel", "firefox")] - [TestFixture("parallel", "safari")] - [TestFixture("parallel", "edge")] - [Parallelizable(ParallelScope.Fixtures)] - public class ParallelTest : SingleTest - { - public ParallelTest(string profile, string environment) : base(profile, environment) { } - } -} diff --git a/NUnit-BrowserStack/Properties/AssemblyInfo.cs b/NUnit-BrowserStack/Properties/AssemblyInfo.cs deleted file mode 100644 index c6753e5..0000000 --- a/NUnit-BrowserStack/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using NUnit.Framework; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("NUnit-BrowserStack")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NUnit-BrowserStack")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -// For more details on LevelOfParallelism Attribute review NUnit documentation- https://github.com/nunit/docs/wiki/LevelOfParallelism-Attribute -[assembly: LevelOfParallelism(2)] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d309ddb3-1e3b-428b-b00b-1257f2532079")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NUnit-BrowserStack/SampleLocalTest.cs b/NUnit-BrowserStack/SampleLocalTest.cs new file mode 100644 index 0000000..2fbeb0e --- /dev/null +++ b/NUnit-BrowserStack/SampleLocalTest.cs @@ -0,0 +1,20 @@ +using NUnit.Framework; +using OpenQA.Selenium; +using System.Text.RegularExpressions; + +namespace BrowserStack +{ + [TestFixture] + [Category("sample_local_test")] + public class SampleLocalTest : BrowserStackNUnitTest + { + public SampleLocalTest() : base() { } + + [Test] + public void TunnelCheck() + { + driver.Navigate().GoToUrl("http://bs-local.com:45454/"); + Assert.True(Regex.IsMatch(driver.Title, @"/BrowserStack Local/i", RegexOptions.IgnoreCase)); + } + } +} diff --git a/NUnit-BrowserStack/SingleTest.cs b/NUnit-BrowserStack/SampleTest.cs similarity index 86% rename from NUnit-BrowserStack/SingleTest.cs rename to NUnit-BrowserStack/SampleTest.cs index 42776d8..ab83911 100644 --- a/NUnit-BrowserStack/SingleTest.cs +++ b/NUnit-BrowserStack/SampleTest.cs @@ -3,10 +3,11 @@ namespace BrowserStack { - [TestFixture("single", "chrome")] + [TestFixture] + [Category("sample_test")] public class SingleTest : BrowserStackNUnitTest { - public SingleTest(string profile, string environment) : base(profile, environment) { } + public SingleTest() : base() { } [Test] public void SearchBstackDemo() diff --git a/NUnit-BrowserStack/browserstack.yml b/NUnit-BrowserStack/browserstack.yml new file mode 100644 index 0000000..e0f879a --- /dev/null +++ b/NUnit-BrowserStack/browserstack.yml @@ -0,0 +1,75 @@ +# ============================= +# Set BrowserStack Credentials +# ============================= +# Add your BrowserStack userName and acccessKey here or set BROWSERSTACK_USERNAME and +# BROWSERSTACK_ACCESS_KEY as env variables +userName: YOUR_USERNAME +accessKey: YOUR_ACCESS_KEY + +# ====================== +# BrowserStack Reporting +# ====================== +# The following capabilities are used to set up reporting on BrowserStack: +# Set 'projectName' to the name of your project. Example, Marketing Website +projectName: BrowserStack Samples +# Set `buildName` as the name of the job / testsuite being run +buildName: browserstack build +# `buildIdentifier` is a unique id to differentiate every execution that gets appended to +# buildName. Choose your buildIdentifier format from the available expressions: +# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution +# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30 +# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests +buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression} +# Set `source` in the syntax `:sample-: +source: nunit-c#:sample-main:v1.0 + +# ======================================= +# Platforms (Browsers / Devices to test) +# ======================================= +# Platforms object contains all the browser / device combinations you want to test on. +# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate) +platforms: + - os: OS X + osVersion: Big Sur + browserName: Chrome + browserVersion: latest + - os: Windows + osVersion: 10 + browserName: Edge + browserVersion: latest + - deviceName: Samsung Galaxy S22 Ultra + browserName: chrome # Try 'samsung' for Samsung browser + osVersion: 12.0 + +# ======================= +# Parallels per Platform +# ======================= +# The number of parallel threads to be used for each platform set. +# BrowserStack's SDK runner will select the best strategy based on the configured value +# +# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack +# +# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack +parallelsPerPlatform: 1 + +# ========================================== +# BrowserStack Local +# (For localhost, staging/private websites) +# ========================================== +# Set browserStackLocal to true if your website under test is not accessible publicly over the internet +# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction +browserstackLocal: true # (Default false) + +# browserStackLocalOptions: +# Options to be passed to BrowserStack local in-case of advanced configurations + # localIdentifier: # (Default: null) Needed if you need to run multiple instances of local. + # forceLocal: true # (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel. + # Entire list of arguments availabe here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections + +# =================== +# Debugging features +# =================== +debug: false # # Set to true if you need screenshots for every selenium command ran +networkLogs: false # Set to true to enable HAR logs capturing +consoleLogs: errors # Remote browser's console debug levels to be printed (Default: errors) +# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors) diff --git a/NUnit-BrowserStack/local.log b/NUnit-BrowserStack/local.log deleted file mode 100644 index e69de29..0000000 diff --git a/NUnit-BrowserStack/packages.config b/NUnit-BrowserStack/packages.config deleted file mode 100644 index 28fe1a7..0000000 --- a/NUnit-BrowserStack/packages.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - From 0a4a9c7f2ae34fab179e759d823550bab5a1850f Mon Sep 17 00:00:00 2001 From: Sourav Kunda <50537259+07souravkunda@users.noreply.github.com> Date: Wed, 4 Jan 2023 11:26:56 +0530 Subject: [PATCH 02/22] update: rename singletest to sampletest --- NUnit-BrowserStack/SampleTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NUnit-BrowserStack/SampleTest.cs b/NUnit-BrowserStack/SampleTest.cs index ab83911..fd5262a 100644 --- a/NUnit-BrowserStack/SampleTest.cs +++ b/NUnit-BrowserStack/SampleTest.cs @@ -5,9 +5,9 @@ namespace BrowserStack { [TestFixture] [Category("sample_test")] - public class SingleTest : BrowserStackNUnitTest + public class SampleTest : BrowserStackNUnitTest { - public SingleTest() : base() { } + public SampleTest() : base() { } [Test] public void SearchBstackDemo() From 52ee3da9b7998fd5beb00e8440e2aa0f1dd8d53e Mon Sep 17 00:00:00 2001 From: Sourav Kunda <50537259+07souravkunda@users.noreply.github.com> Date: Tue, 24 Jan 2023 17:55:18 +0530 Subject: [PATCH 03/22] update: readme --- .gitignore | 1 + NUnit-BrowserStack/.config/dotnet-tools.json | 12 ------------ NUnit-BrowserStack/NUnit-BrowserStack.csproj | 1 + NUnit-BrowserStack/SampleLocalTest.cs | 2 +- NUnit-BrowserStack/SampleTest.cs | 4 ++-- README.md | 17 +++++++++-------- 6 files changed, 14 insertions(+), 23 deletions(-) delete mode 100644 NUnit-BrowserStack/.config/dotnet-tools.json diff --git a/.gitignore b/.gitignore index 94ba720..beec231 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ obj local.log browserstack.err log +.config diff --git a/NUnit-BrowserStack/.config/dotnet-tools.json b/NUnit-BrowserStack/.config/dotnet-tools.json deleted file mode 100644 index 4f0da2d..0000000 --- a/NUnit-BrowserStack/.config/dotnet-tools.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "browserstack-sdk": { - "version": "0.0.4", - "commands": [ - "browserstack-sdk" - ] - } - } -} \ No newline at end of file diff --git a/NUnit-BrowserStack/NUnit-BrowserStack.csproj b/NUnit-BrowserStack/NUnit-BrowserStack.csproj index a40ed0a..811a6a3 100644 --- a/NUnit-BrowserStack/NUnit-BrowserStack.csproj +++ b/NUnit-BrowserStack/NUnit-BrowserStack.csproj @@ -11,6 +11,7 @@ + diff --git a/NUnit-BrowserStack/SampleLocalTest.cs b/NUnit-BrowserStack/SampleLocalTest.cs index 2fbeb0e..cc58b3a 100644 --- a/NUnit-BrowserStack/SampleLocalTest.cs +++ b/NUnit-BrowserStack/SampleLocalTest.cs @@ -5,7 +5,7 @@ namespace BrowserStack { [TestFixture] - [Category("sample_local_test")] + [Category("sample-local-test")] public class SampleLocalTest : BrowserStackNUnitTest { public SampleLocalTest() : base() { } diff --git a/NUnit-BrowserStack/SampleTest.cs b/NUnit-BrowserStack/SampleTest.cs index fd5262a..2149890 100644 --- a/NUnit-BrowserStack/SampleTest.cs +++ b/NUnit-BrowserStack/SampleTest.cs @@ -4,7 +4,7 @@ namespace BrowserStack { [TestFixture] - [Category("sample_test")] + [Category("sample-test")] public class SampleTest : BrowserStackNUnitTest { public SampleTest() : base() { } @@ -23,4 +23,4 @@ public void SearchBstackDemo() Assert.AreEqual(productOnCartText, productOnPageText); } } -} \ No newline at end of file +} diff --git a/README.md b/README.md index cc3f553..3feb25c 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,19 @@ ![BrowserStack Logo](https://d98b8t1nnulk5.cloudfront.net/production/images/layout/logo-header.png?1469004780) - + -## Setup +## Run Sample Build * Clone the repo * Open the solution `NUnit-BrowserStack.sln` in Visual Studio * Build the solution -* Update `App.config` file with your BrowserStack Username and Access Key(https://www.browserstack.com/accounts/settings) - -## Running your tests from Test Explorer via NUnit Test Adapter -- To run a single test, run test with fixture `single` -- To run local tests, run test with fixture `local` -- To run parallel tests, run tests with fixture `parallel` +* Update `browserstack.yml` file with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings) +### Running your tests from CLI +* To run the test suite having cross-platform with parallelization, dotnet test --filter "Category=sample-test" +* To run local tests, dotnet test --filter "Category=sample-local-test" +### Running your tests from Test Explorer +- To run a parallel tests, run test with fixture `sample-test` +- To run local tests, run test with fixture `sample-local-test` Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github) From 3c995e566f7e08dbdc087b58fb795739ea8be117 Mon Sep 17 00:00:00 2001 From: Sourav Kunda <50537259+07souravkunda@users.noreply.github.com> Date: Tue, 24 Jan 2023 18:27:55 +0530 Subject: [PATCH 04/22] update: integrate --- NUnit-BrowserStack/SampleLocalTest.cs | 2 +- README.md | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NUnit-BrowserStack/SampleLocalTest.cs b/NUnit-BrowserStack/SampleLocalTest.cs index cc58b3a..c6ba932 100644 --- a/NUnit-BrowserStack/SampleLocalTest.cs +++ b/NUnit-BrowserStack/SampleLocalTest.cs @@ -14,7 +14,7 @@ public SampleLocalTest() : base() { } public void TunnelCheck() { driver.Navigate().GoToUrl("http://bs-local.com:45454/"); - Assert.True(Regex.IsMatch(driver.Title, @"/BrowserStack Local/i", RegexOptions.IgnoreCase)); + Assert.Contains("BrowserStack Local", driver.Title); } } } diff --git a/README.md b/README.md index 3feb25c..06ac4f9 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,17 @@ Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github) +## Integrate your test suite + +This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow the steps below to install the SDK in your test suite and run tests on BrowserStack: + +* Create sample browserstack.yml file with the browserstack related capabilities with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings) and place it in your root folder. +* Add nuget library BrowserStack.TestAdapter +```sh +dotnet add BrowserStack.TestAdapter +``` +* Build project `dotnet build` + ## Notes * You can view your test results on the [BrowserStack automate dashboard](https://www.browserstack.com/automate) * To test on a different set of browsers, check out our [platform configurator](https://www.browserstack.com/automate/c-sharp#setting-os-and-browser) From c5baa9f6e87a273dcfce7b8281bd1485a5492dd5 Mon Sep 17 00:00:00 2001 From: 07souravkunda Date: Wed, 1 Feb 2023 18:07:35 +0530 Subject: [PATCH 05/22] update: remove ppp, fix string assert --- NUnit-BrowserStack/SampleLocalTest.cs | 2 +- NUnit-BrowserStack/browserstack.yml | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/NUnit-BrowserStack/SampleLocalTest.cs b/NUnit-BrowserStack/SampleLocalTest.cs index c6ba932..f792687 100644 --- a/NUnit-BrowserStack/SampleLocalTest.cs +++ b/NUnit-BrowserStack/SampleLocalTest.cs @@ -14,7 +14,7 @@ public SampleLocalTest() : base() { } public void TunnelCheck() { driver.Navigate().GoToUrl("http://bs-local.com:45454/"); - Assert.Contains("BrowserStack Local", driver.Title); + StringAssert.Contains("BrowserStack Local", driver.Title); } } } diff --git a/NUnit-BrowserStack/browserstack.yml b/NUnit-BrowserStack/browserstack.yml index e0f879a..951f9ce 100644 --- a/NUnit-BrowserStack/browserstack.yml +++ b/NUnit-BrowserStack/browserstack.yml @@ -3,6 +3,7 @@ # ============================= # Add your BrowserStack userName and acccessKey here or set BROWSERSTACK_USERNAME and # BROWSERSTACK_ACCESS_KEY as env variables + userName: YOUR_USERNAME accessKey: YOUR_ACCESS_KEY @@ -41,17 +42,6 @@ platforms: browserName: chrome # Try 'samsung' for Samsung browser osVersion: 12.0 -# ======================= -# Parallels per Platform -# ======================= -# The number of parallel threads to be used for each platform set. -# BrowserStack's SDK runner will select the best strategy based on the configured value -# -# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack -# -# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack -parallelsPerPlatform: 1 - # ========================================== # BrowserStack Local # (For localhost, staging/private websites) From 5e25e2c2052ef79c3c11e7b1da992ff1ce467c67 Mon Sep 17 00:00:00 2001 From: 07souravkunda Date: Wed, 1 Feb 2023 18:09:10 +0530 Subject: [PATCH 06/22] fix: source key --- NUnit-BrowserStack/browserstack.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NUnit-BrowserStack/browserstack.yml b/NUnit-BrowserStack/browserstack.yml index 951f9ce..44c7f7c 100644 --- a/NUnit-BrowserStack/browserstack.yml +++ b/NUnit-BrowserStack/browserstack.yml @@ -22,7 +22,8 @@ buildName: browserstack build # Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression} # Set `source` in the syntax `:sample-: -source: nunit-c#:sample-main:v1.0 + +source: nunit-c#:sample-sdk:v1.0 # ======================================= # Platforms (Browsers / Devices to test) From e41730236f8c163fa331aaececee7c82fa0daad9 Mon Sep 17 00:00:00 2001 From: Sourav Kunda <50537259+07souravkunda@users.noreply.github.com> Date: Fri, 10 Feb 2023 10:27:05 +0530 Subject: [PATCH 07/22] update: use latest adapter --- .gitignore | 1 - NUnit-BrowserStack/.config/dotnet-tools.json | 5 +++++ NUnit-BrowserStack/NUnit-BrowserStack.csproj | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 NUnit-BrowserStack/.config/dotnet-tools.json diff --git a/.gitignore b/.gitignore index beec231..94ba720 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ obj local.log browserstack.err log -.config diff --git a/NUnit-BrowserStack/.config/dotnet-tools.json b/NUnit-BrowserStack/.config/dotnet-tools.json new file mode 100644 index 0000000..b0e38ab --- /dev/null +++ b/NUnit-BrowserStack/.config/dotnet-tools.json @@ -0,0 +1,5 @@ +{ + "version": 1, + "isRoot": true, + "tools": {} +} \ No newline at end of file diff --git a/NUnit-BrowserStack/NUnit-BrowserStack.csproj b/NUnit-BrowserStack/NUnit-BrowserStack.csproj index 811a6a3..c3e4e8b 100644 --- a/NUnit-BrowserStack/NUnit-BrowserStack.csproj +++ b/NUnit-BrowserStack/NUnit-BrowserStack.csproj @@ -11,7 +11,7 @@ - + From e91fc917fd5ee5e5bf2d3396465faf4f5a4da1d6 Mon Sep 17 00:00:00 2001 From: 07souravkunda Date: Fri, 10 Feb 2023 12:23:33 +0530 Subject: [PATCH 08/22] chore: new line --- NUnit-BrowserStack/.config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NUnit-BrowserStack/.config/dotnet-tools.json b/NUnit-BrowserStack/.config/dotnet-tools.json index b0e38ab..c967c89 100644 --- a/NUnit-BrowserStack/.config/dotnet-tools.json +++ b/NUnit-BrowserStack/.config/dotnet-tools.json @@ -2,4 +2,4 @@ "version": 1, "isRoot": true, "tools": {} -} \ No newline at end of file +} From 5d65782c31194d056805884fd6f4474e1971615b Mon Sep 17 00:00:00 2001 From: 07souravkunda Date: Fri, 10 Mar 2023 14:39:44 +0530 Subject: [PATCH 09/22] update: powershell command readme --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 06ac4f9..2e731cf 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,24 @@ dotnet add BrowserStack.TestAdapter * To test on a different set of browsers, check out our [platform configurator](https://www.browserstack.com/automate/c-sharp#setting-os-and-browser) * You can export the environment variables for the Username and Access Key of your BrowserStack account + * For Unix-like or Mac machines: ``` export BROWSERSTACK_USERNAME= && export BROWSERSTACK_ACCESS_KEY= ``` + * For Windows Cmd: + ``` + set BROWSERSTACK_USERNAME= + set BROWSERSTACK_ACCESS_KEY= + ``` + + * For Windows Powershell: + ``` + $env:BROWSERSTACK_USERNAME= + $env:BROWSERSTACK_ACCESS_KEY= + ``` + ## Additional Resources * [Documentation for writing automate test scripts in C#](https://www.browserstack.com/automate/c-sharp) * [Customizing your tests on BrowserStack](https://www.browserstack.com/automate/capabilities) From d3d1269c58a18a80e2e604bf93439b24b12c0ed5 Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Tue, 11 Apr 2023 17:30:38 +0530 Subject: [PATCH 10/22] Added github action --- .github/CODEOWNERS | 1 + .github/workflows/reviewing_changes.yml | 88 +++++++++++++++++++++++++ NUnit-BrowserStack/browserstack.yml | 2 +- 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/reviewing_changes.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..7e1f1b4 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +.github/* @browserstack/asi-devs diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml new file mode 100644 index 0000000..3418be1 --- /dev/null +++ b/.github/workflows/reviewing_changes.yml @@ -0,0 +1,88 @@ +# This job is to test different profiles in sdk branch against Pull Requests raised +# This workflow targets nunit + +name: C# SDK Test workflow on workflow_dispatch + +on: + workflow_dispatch: + inputs: + pull_request_number: + description: 'The pull request number to build' + required: true + +jobs: + comment-run: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 3 + matrix: + dotnet: ['6.0.x', '5.0.x'] + os: [ macos-latest, windows-latest, ubuntu-latest ] + name: NUnit Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + + steps: + - uses: actions/checkout@v3 + with: + ref: refs/pull/${{ github.event.inputs.pull_request_number }}/head + - name: Fetch Commit SHA + run: | + git log -1 --format='%H' + echo "commit_sha=$(git log -1 --format='%H')" >> $GITHUB_ENV + echo "commit_sha=$(git log -1 --format='%H')" >> $env:GITHUB_ENV + - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 + id: status-check-in-progress + env: + job_name: NUnit Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample + with: + github-token: ${{ github.token }} + script: | + const result = await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: process.env.job_name, + head_sha: process.env.commit_sha, + status: 'in_progress' + }).catch((err) => ({status: err.status, response: err.response})); + console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) + if (result.status !== 201) { + console.log('Failed to create check run') + } + - name: Setup dotnet + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.dotnet }} + + - name: Install dependencies + run: dotnet build + + - name: Run sample tests + run: dotnet test --filter "Category=sample-test" + + - name: Run local tests + run: dotnet test --filter "Category=sample-local-test" + + - if: always() + uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 + id: status-check-completed + env: + conclusion: ${{ job.status }} + job_name: NUnit Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample + with: + github-token: ${{ github.token }} + script: | + const result = await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: process.env.job_name, + head_sha: process.env.commit_sha, + status: 'completed', + conclusion: process.env.conclusion + }).catch((err) => ({status: err.status, response: err.response})); + console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) + if (result.status !== 201) { + console.log('Failed to create check run') + } diff --git a/NUnit-BrowserStack/browserstack.yml b/NUnit-BrowserStack/browserstack.yml index 44c7f7c..239fd52 100644 --- a/NUnit-BrowserStack/browserstack.yml +++ b/NUnit-BrowserStack/browserstack.yml @@ -23,7 +23,7 @@ buildName: browserstack build buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression} # Set `source` in the syntax `:sample-: -source: nunit-c#:sample-sdk:v1.0 +source: nunit:sample-sdk:v1.0 # ======================================= # Platforms (Browsers / Devices to test) From 283c6b68b2e505e6be89121c5497ce481098576d Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Wed, 12 Apr 2023 12:34:38 +0530 Subject: [PATCH 11/22] Syntax fix for name --- .github/workflows/reviewing_changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml index 3418be1..f96dd54 100644 --- a/.github/workflows/reviewing_changes.yml +++ b/.github/workflows/reviewing_changes.yml @@ -1,7 +1,7 @@ # This job is to test different profiles in sdk branch against Pull Requests raised # This workflow targets nunit -name: C# SDK Test workflow on workflow_dispatch +name: C-sharp SDK Test workflow on workflow_dispatch on: workflow_dispatch: From 0594a3160f38323639fbec817f0d3c7b54f55865 Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Wed, 12 Apr 2023 13:26:52 +0530 Subject: [PATCH 12/22] Fix --- .github/workflows/reviewing_changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml index f96dd54..b32e90d 100644 --- a/.github/workflows/reviewing_changes.yml +++ b/.github/workflows/reviewing_changes.yml @@ -18,7 +18,7 @@ jobs: max-parallel: 3 matrix: dotnet: ['6.0.x', '5.0.x'] - os: [ macos-latest, windows-latest, ubuntu-latest ] + os: [ windows-latest ] name: NUnit Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample env: BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} From cb4f425d951014b2d6d8261606302a9b4beee147 Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Mon, 26 Jun 2023 10:44:40 +0530 Subject: [PATCH 13/22] Added bstack to method name --- NUnit-BrowserStack/SampleLocalTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NUnit-BrowserStack/SampleLocalTest.cs b/NUnit-BrowserStack/SampleLocalTest.cs index f792687..e21228c 100644 --- a/NUnit-BrowserStack/SampleLocalTest.cs +++ b/NUnit-BrowserStack/SampleLocalTest.cs @@ -11,7 +11,7 @@ public class SampleLocalTest : BrowserStackNUnitTest public SampleLocalTest() : base() { } [Test] - public void TunnelCheck() + public void BStackTunnelCheck() { driver.Navigate().GoToUrl("http://bs-local.com:45454/"); StringAssert.Contains("BrowserStack Local", driver.Title); From c0fbccdc0fa0d4a55c57d7cc88ace6ca94bb9164 Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Mon, 10 Jul 2023 13:25:10 +0530 Subject: [PATCH 14/22] delete sdk workflow --- .github/workflows/reviewing_changes.yml | 88 ------------------------- 1 file changed, 88 deletions(-) delete mode 100644 .github/workflows/reviewing_changes.yml diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml deleted file mode 100644 index b32e90d..0000000 --- a/.github/workflows/reviewing_changes.yml +++ /dev/null @@ -1,88 +0,0 @@ -# This job is to test different profiles in sdk branch against Pull Requests raised -# This workflow targets nunit - -name: C-sharp SDK Test workflow on workflow_dispatch - -on: - workflow_dispatch: - inputs: - pull_request_number: - description: 'The pull request number to build' - required: true - -jobs: - comment-run: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - max-parallel: 3 - matrix: - dotnet: ['6.0.x', '5.0.x'] - os: [ windows-latest ] - name: NUnit Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample - env: - BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} - BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - - steps: - - uses: actions/checkout@v3 - with: - ref: refs/pull/${{ github.event.inputs.pull_request_number }}/head - - name: Fetch Commit SHA - run: | - git log -1 --format='%H' - echo "commit_sha=$(git log -1 --format='%H')" >> $GITHUB_ENV - echo "commit_sha=$(git log -1 --format='%H')" >> $env:GITHUB_ENV - - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 - id: status-check-in-progress - env: - job_name: NUnit Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample - with: - github-token: ${{ github.token }} - script: | - const result = await github.rest.checks.create({ - owner: context.repo.owner, - repo: context.repo.repo, - name: process.env.job_name, - head_sha: process.env.commit_sha, - status: 'in_progress' - }).catch((err) => ({status: err.status, response: err.response})); - console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) - if (result.status !== 201) { - console.log('Failed to create check run') - } - - name: Setup dotnet - uses: actions/setup-dotnet@v3 - with: - dotnet-version: ${{ matrix.dotnet }} - - - name: Install dependencies - run: dotnet build - - - name: Run sample tests - run: dotnet test --filter "Category=sample-test" - - - name: Run local tests - run: dotnet test --filter "Category=sample-local-test" - - - if: always() - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 - id: status-check-completed - env: - conclusion: ${{ job.status }} - job_name: NUnit Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample - with: - github-token: ${{ github.token }} - script: | - const result = await github.rest.checks.create({ - owner: context.repo.owner, - repo: context.repo.repo, - name: process.env.job_name, - head_sha: process.env.commit_sha, - status: 'completed', - conclusion: process.env.conclusion - }).catch((err) => ({status: err.status, response: err.response})); - console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) - if (result.status !== 201) { - console.log('Failed to create check run') - } From edafc48dd6bf858e47ae8f205d34d74d82759d90 Mon Sep 17 00:00:00 2001 From: Sriteja Sugoor Date: Fri, 31 May 2024 12:36:52 +0530 Subject: [PATCH 15/22] Remove bstack options call --- NUnit-BrowserStack/BrowserStackNUnitTest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/NUnit-BrowserStack/BrowserStackNUnitTest.cs b/NUnit-BrowserStack/BrowserStackNUnitTest.cs index 530886b..cde298c 100644 --- a/NUnit-BrowserStack/BrowserStackNUnitTest.cs +++ b/NUnit-BrowserStack/BrowserStackNUnitTest.cs @@ -21,10 +21,8 @@ public BrowserStackNUnitTest() public void Init() { DriverOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions(); - capability.BrowserVersion = "latest"; - capability.AddAdditionalOption("bstack:options", capability); driver = new RemoteWebDriver( new Uri("http://localhost:4444/wd/hub/"), capability From 721677f51455c0a95d4a629e9f9c20c2bd37f277 Mon Sep 17 00:00:00 2001 From: Sriteja Sugoor <32356934+sriteja777@users.noreply.github.com> Date: Fri, 31 May 2024 14:16:02 +0530 Subject: [PATCH 16/22] bump source version --- NUnit-BrowserStack/browserstack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NUnit-BrowserStack/browserstack.yml b/NUnit-BrowserStack/browserstack.yml index 239fd52..eb1c8eb 100644 --- a/NUnit-BrowserStack/browserstack.yml +++ b/NUnit-BrowserStack/browserstack.yml @@ -23,7 +23,7 @@ buildName: browserstack build buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression} # Set `source` in the syntax `:sample-: -source: nunit:sample-sdk:v1.0 +source: nunit:sample-sdk:v1.1 # ======================================= # Platforms (Browsers / Devices to test) From afddbd7f1a284e1fa4d50db0021482b5146c578a Mon Sep 17 00:00:00 2001 From: Hrithik Katiyar Date: Mon, 1 Jul 2024 16:20:53 +0530 Subject: [PATCH 17/22] Fixed linting issue --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 94ba720..906adac 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,5 @@ obj .vs .DS_Store local.log -browserstack.err log +browserstack.err From a6f50dda503c5b9cc288f3995b03425e2a0c2ad7 Mon Sep 17 00:00:00 2001 From: "Yash D. Saraf" Date: Thu, 12 Feb 2026 19:22:47 +0530 Subject: [PATCH 18/22] Chore: Add debug utility flag in sample repo yaml --- NUnit-BrowserStack/browserstack.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NUnit-BrowserStack/browserstack.yml b/NUnit-BrowserStack/browserstack.yml index eb1c8eb..716cb1d 100644 --- a/NUnit-BrowserStack/browserstack.yml +++ b/NUnit-BrowserStack/browserstack.yml @@ -64,3 +64,5 @@ debug: false # # Set to true if you need screenshots for every seleniu networkLogs: false # Set to true to enable HAR logs capturing consoleLogs: errors # Remote browser's console debug levels to be printed (Default: errors) # Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors) + +# debugUtility: true # Set to true if you want to validate and debug the correctness of your BrowserStack config options. Read more about it here - https://www.browserstack.com/docs/automate/debug-common-errors From c6700e7ced28dd9770f60c7b47f97f7655c3c13c Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Tue, 7 Apr 2026 17:52:07 +0530 Subject: [PATCH 19/22] fix github actions workflow --- .github/workflows/reviewing_changes.yml | 22 ++++++++++++++------ NUnit-BrowserStack/NUnit-BrowserStack.csproj | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml index dfd638e..b13b302 100644 --- a/.github/workflows/reviewing_changes.yml +++ b/.github/workflows/reviewing_changes.yml @@ -16,8 +16,19 @@ jobs: strategy: fail-fast: false max-parallel: 3 + # .net5 runner doesn't installed at runtime, so skipping it and adding other .net latest versions. + # added target-framework in matrix to avoid runtime errors as each runner has only its matching runtime installed. matrix: - dotnet: ['6.0.x', '5.0.x'] + dotnet: ['6.0.x', '8.0.x', '9.0.x', '10.0.x'] + include: + - dotnet: '6.0.x' + target-framework: 'net6.0' + - dotnet: '8.0.x' + target-framework: 'net8.0' + - dotnet: '9.0.x' + target-framework: 'net9.0' + - dotnet: '10.0.x' + target-framework: 'net10.0' os: [ windows-latest ] name: NUnit Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample env: @@ -53,16 +64,15 @@ jobs: dotnet-version: ${{ matrix.dotnet }} - name: Install dependencies - run: | + run: | dotnet --version - dotnet build - + dotnet build /p:TargetFramework=${{ matrix.target-framework }} - name: Run sample tests - run: dotnet test --filter "Category=sample-test" + run: dotnet test --filter "Category=sample-test" /p:TargetFramework=${{ matrix.target-framework }} - name: Run local tests - run: dotnet test --filter "Category=sample-local-test" + run: dotnet test --filter "Category=sample-local-test" /p:TargetFramework=${{ matrix.target-framework }} - if: always() uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 diff --git a/NUnit-BrowserStack/NUnit-BrowserStack.csproj b/NUnit-BrowserStack/NUnit-BrowserStack.csproj index c3e4e8b..3161a59 100644 --- a/NUnit-BrowserStack/NUnit-BrowserStack.csproj +++ b/NUnit-BrowserStack/NUnit-BrowserStack.csproj @@ -1,7 +1,7 @@  - net6.0 + net6.0;net8.0;net9.0;net10.0 SingleTest SingleTest enable From 099a514b389a5203196016fa5f2da982467d03f1 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 8 Apr 2026 19:39:55 +0530 Subject: [PATCH 20/22] fix: use global.json --- .github/workflows/reviewing_changes.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml index b13b302..e0d9cc7 100644 --- a/.github/workflows/reviewing_changes.yml +++ b/.github/workflows/reviewing_changes.yml @@ -59,10 +59,18 @@ jobs: console.log('Failed to create check run') } - name: Setup dotnet + id: setup-dotnet uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ matrix.dotnet }} + - name: Pin SDK version via global.json + run: | + $version = "${{ matrix.target-framework }}".Replace("net","") + ".0" + "{`"sdk`":{`"version`":`"$version`",`"rollForward`":`"latestPatch`"}}" | Set-Content global.json + Get-Content global.json + shell: pwsh + - name: Install dependencies run: | dotnet --version From a03cf4206b5ac481698b5c4775be9f918b780fe5 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 8 Apr 2026 19:48:23 +0530 Subject: [PATCH 21/22] fix: requierd version for global.json --- .github/workflows/reviewing_changes.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml index e0d9cc7..2e24895 100644 --- a/.github/workflows/reviewing_changes.yml +++ b/.github/workflows/reviewing_changes.yml @@ -66,8 +66,9 @@ jobs: - name: Pin SDK version via global.json run: | - $version = "${{ matrix.target-framework }}".Replace("net","") + ".0" - "{`"sdk`":{`"version`":`"$version`",`"rollForward`":`"latestPatch`"}}" | Set-Content global.json + $major = "${{ matrix.target-framework }}".Replace("net","").Split(".")[0] + $version = "$major.0.100" + "{`"sdk`":{`"version`":`"$version`",`"rollForward`":`"latestFeature`"}}" | Set-Content global.json Get-Content global.json shell: pwsh From cff99e96402d3c9e2529f447affc4dc779eba026 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 8 Apr 2026 20:22:27 +0530 Subject: [PATCH 22/22] added global.json for version match --- .github/workflows/reviewing_changes.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml index 2e24895..10e3173 100644 --- a/.github/workflows/reviewing_changes.yml +++ b/.github/workflows/reviewing_changes.yml @@ -75,13 +75,13 @@ jobs: - name: Install dependencies run: | dotnet --version - dotnet build /p:TargetFramework=${{ matrix.target-framework }} + dotnet build /p:TargetFrameworks=${{ matrix.target-framework }} /p:TargetFramework=${{ matrix.target-framework }} - name: Run sample tests - run: dotnet test --filter "Category=sample-test" /p:TargetFramework=${{ matrix.target-framework }} + run: dotnet test --filter "Category=sample-test" /p:TargetFrameworks=${{ matrix.target-framework }} /p:TargetFramework=${{ matrix.target-framework }} - name: Run local tests - run: dotnet test --filter "Category=sample-local-test" /p:TargetFramework=${{ matrix.target-framework }} + run: dotnet test --filter "Category=sample-local-test" /p:TargetFrameworks=${{ matrix.target-framework }} /p:TargetFramework=${{ matrix.target-framework }} - if: always() uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975