Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding method to allow screenshots from the plugin with the datastores setup #46

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}
Loading