Skip to content

Commit

Permalink
Merge pull request #46 from mpekurny/master
Browse files Browse the repository at this point in the history
Adding method to allow screenshots from the plugin with the datastores setup
  • Loading branch information
sriv authored Sep 23, 2024
2 parents 1006acb + 86f97f7 commit 6d9f3a9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Gauge.CSharp.Lib/Gauge.CSharp.Lib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Description>CSharp bindings for Gauge. Write CSharp step implementation for Gauge specs. https://gauge.org</Description>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.11.1</Version>
<AssemblyVersion>0.11.1.0</AssemblyVersion>
<FileVersion>0.11.1.0</FileVersion>
<Version>0.11.2</Version>
<AssemblyVersion>0.11.2.0</AssemblyVersion>
<FileVersion>0.11.2.0</FileVersion>
<Authors>getgauge</Authors>
<Company>ThoughtWorks Inc.</Company>
<Copyright>Copyright © ThoughtWorks Inc. 2018</Copyright>
Expand Down
23 changes: 23 additions & 0 deletions Gauge.CSharp.Lib/GaugeScreenshots.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,27 @@ public static void Capture()
{
ScreenshotFiles.Add(screenshotWriter.TakeScreenShot());
}

public static void CaptureByStream(int streamId)
{
SetDataStores(streamId);
ScreenshotFiles.Add(screenshotWriter.TakeScreenShot());
}

private static void SetDataStores(int streamId)
{
var dataStore = DataStoreFactory.GetDataStoresByStream(streamId);
lock (SuiteDataStore.Store)
{
SuiteDataStore.Store.Value = DataStoreFactory.SuiteDataStore;
}
lock (SpecDataStore.Store)
{
SpecDataStore.Store.Value = dataStore.GetValueOrDefault(DataStoreType.Spec, null);
}
lock (ScenarioDataStore.Store)
{
ScenarioDataStore.Store.Value = dataStore.GetValueOrDefault(DataStoreType.Scenario, null);
}
}
}

0 comments on commit 6d9f3a9

Please sign in to comment.