-
Notifications
You must be signed in to change notification settings - Fork 68
Labels
Description
We have just updated Reqnroll to 2.4.1 from 2.4.0, and suddenly we are seeing that our tests fall over when trying to use AllureApi
via Allure.Net.Commons
to push screenshots and issue links. Rolling back the Reqnroll version to 2.4.0 seems to fix this issue.
This only seems to occur after a test legitimately fails in the test suite when the ScenarioExecutionStatus != ScenarioExecutionStatus.OK
. The code below is run in an AfterScenario
hook.
Example Code:
if (_settings.PlaywrightSettings.AlwaysTrace || _context.ScenarioExecutionStatus != ScenarioExecutionStatus.OK)
{
var testFileName = GetSafeFileName($"{TestContext.CurrentContext.Test.ClassName.Split(".").Last()}.{TestContext.CurrentContext.Test.Name}.zip");
var path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "playwright-traces", testFileName);
await page.Context.Tracing.StopAsync(new()
{
Path = path
});
var link = "link.hidden.for.this.example."
AllureApi.AddAttachment(path);
AllureApi.AddIssue(link);
}
else
{
await page.Context.Tracing.StopAsync();
}
The test then hits the error below in its TearDown process. All subsequent tests after this failure in the test suite then fail almost instantly with the same error below when they try to execute.
Error message:
Error Message:
System.InvalidOperationException : No container context is active.
Stack Trace:
at Allure.Net.Commons.AllureContext.get_CurrentContainer()
at Allure.Net.Commons.AllureLifecycle.WriteTestContainer()
at Allure.ReqnrollPlugin.State.AllureReqnrollStateFacade.EmitFeatureFiles()
at Allure.ReqnrollPlugin.Events.FeatureFinishedEventHandler.HandleInAllureContext(FeatureFinishedEvent eventData)
at Allure.Net.Commons.AllureLifecycle.RunInContext(AllureContext context, Action action)
at Allure.ReqnrollPlugin.State.CrossBindingContextTransport.PropagateState(Action update)
at InvokeStub_Action`1.Invoke(Object, Span`1)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)