diff --git a/tests/features/cuke-steps.cpp b/tests/features/cuke-steps.cpp --- a/tests/features/cuke-steps.cpp +++ b/tests/features/cuke-steps.cpp @@ -180,6 +180,12 @@ return m_model; } + Domain::Artifact::Ptr currentArtifact() const + { + return context->index.data(Presentation::QueryTreeModelBase::ObjectRole) + .value(); + } + void waitForEmptyJobQueue() { while (Utils::JobHandler::jobCount() != 0) { @@ -598,8 +604,7 @@ WHEN("^I open the item in the editor$") { ScenarioScope context; - auto artifact = context->index.data(Presentation::QueryTreeModelBase::ObjectRole) - .value(); + auto artifact = context->currentArtifact(); VERIFY(artifact); context->editor = context->app->property("editor").value(); VERIFY(context->editor); @@ -645,8 +650,7 @@ WHEN("^I open the item in the editor again$") { ScenarioScope context; - auto artifact = context->index.data(Presentation::QueryTreeModelBase::ObjectRole) - .value(); + auto artifact = context->currentArtifact(); VERIFY(artifact); VERIFY(context->editor->setProperty("artifact", QVariant::fromValue(Domain::Artifact::Ptr()))); VERIFY(context->editor->setProperty("artifact", QVariant::fromValue(artifact))); @@ -839,7 +843,7 @@ THEN("^the task corresponding to the item is done$") { ScenarioScope context; - auto artifact = context->index.data(Presentation::QueryTreeModelBase::ObjectRole).value(); + auto artifact = context->currentArtifact(); VERIFY(artifact); auto task = artifact.dynamicCast(); VERIFY(task);