Best Ginkgo code snippet using outline.BackpropagateUnfocus
ginkgo.go
Source:ginkgo.go
...61 }62 }63 })64}65// BackpropagateUnfocus propagates the Focused property through the subtree66// rooted at n. It applies the rule described in the Ginkgo docs:67// > Nested programmatically focused specs follow a simple rule: if a68// > leaf-node is marked focused, any of its ancestor nodes that are marked69// > focus will be unfocused.70func (n *ginkgoNode) BackpropagateUnfocus() {71 focusedSpecInSubtreeStack := []bool{}72 n.PostOrder(func(thisNode *ginkgoNode) {73 if thisNode.Spec {74 focusedSpecInSubtreeStack = append(focusedSpecInSubtreeStack, thisNode.Focused)75 return76 }77 focusedSpecInSubtree := false78 for range thisNode.Nodes {79 focusedSpecInSubtree = focusedSpecInSubtree || focusedSpecInSubtreeStack[len(focusedSpecInSubtreeStack)-1]80 focusedSpecInSubtreeStack = focusedSpecInSubtreeStack[0 : len(focusedSpecInSubtreeStack)-1]81 }82 focusedSpecInSubtreeStack = append(focusedSpecInSubtreeStack, focusedSpecInSubtree)83 if focusedSpecInSubtree {84 thisNode.Focused = false...
outline.go
Source:outline.go
...56 return &outline{[]*ginkgoNode{}}, nil57 }58 // Derive the final focused property for all nodes. This must be done59 // _before_ propagating the inherited focused property.60 root.BackpropagateUnfocus()61 // Now, propagate inherited properties, including focused and pending.62 root.PropagateInheritedProperties()63 return &outline{root.Nodes}, nil64}65type outline struct {66 Nodes []*ginkgoNode `json:"nodes"`67}68func (o *outline) MarshalJSON() ([]byte, error) {69 return json.Marshal(o.Nodes)70}71// String returns a CSV-formatted outline. Spec or container are output in72// depth-first order.73func (o *outline) String() string {74 return o.StringIndent(0)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!