github.com/redhat-appstudio/e2e-tests@v0.0.0-20240520140907-9709f6f59323/templates/test_output_spec.tmpl (about)

     1  package {{ .CustomData.PackageName }}
     2  
     3  /* This was generated from a template file. Please feel free to update as necessary!
     4     a couple things to note:
     5      - Remember to implement specific logic of the service/domain you are trying to test if it not already there in the pkg/
     6  
     7      - To include the tests as part of the E2E Test suite:
     8         - Update the pkg/framework/describe.go to include the `Describe func` of this new test suite, If you haven't already done so.
     9         - Import this new package into the cmd/e2e_test.go 
    10  */
    11  
    12  import (
    13  	. "github.com/onsi/ginkgo/v2"
    14  	. "github.com/onsi/gomega"
    15  
    16      "fmt"
    17  	"strings"
    18  	"time"
    19      "encoding/json"
    20      "context"
    21  
    22  
    23      "github.com/redhat-appstudio/e2e-tests/pkg/framework"
    24      //framework imports edit as required
    25      "github.com/redhat-appstudio/e2e-tests/pkg/constants"
    26  	"github.com/redhat-appstudio/e2e-tests/pkg/utils"
    27  
    28  )
    29  
    30  {{ range .CustomData.Outline }}
    31  var _ = framework.{{ .Name }}("{{ .Text }}", {{range .Labels }}Label("{{.}}"), {{ end }} func() {
    32  
    33  	defer GinkgoRecover()
    34      var err error
    35      var f *framework.Framework
    36      // use 'f' to access common controllers or the specific service controllers within the framework
    37  	BeforeAll(func() {
    38  		// Initialize the tests controllers
    39  		f, err = framework.NewFramework()
    40  		Expect(err).NotTo(HaveOccurred())
    41  	})
    42  
    43      {{ range .Nodes }}
    44      {{ if eq .Name "DescribeTable" }}
    45      {{ .Name }}("{{ .Text }} is table", 
    46          func() {
    47          {{range .Nodes }}
    48          {{ if eq .Name "By" }}
    49          {{ .Name }}("{{ .Text }}")
    50          {{ end -}}
    51          {{ end -}}
    52  
    53          },
    54          {{range .Nodes }}
    55          {{ if eq .Name "Entry" }}
    56          {{ .Name }}("{{ .Text }}",),
    57          {{ end -}}
    58          {{ end -}}
    59      )
    60      {{ end }}
    61      {{ if ne .Name "DescribeTable" }}
    62      {{ .Name }}("{{ .Text }}", {{range .Labels }}Label("{{.}}"), {{ end }}func() {
    63          // Declare variables here.
    64  
    65          {{range .Nodes }}
    66          {{ if eq .Name "DescribeTable" }}
    67          {{ .Name }}("{{ .Text }}", 
    68          func() {
    69          {{range .Nodes }}
    70          {{ if eq .Name "By" }}
    71          {{ .Name }}("{{ .Text }}")
    72          {{ end -}}
    73          {{ end -}}
    74  
    75          },
    76          {{range .Nodes }}
    77          {{ if eq .Name "Entry" }}
    78          {{ .Name }}("{{ .Text }}",),
    79          {{ end -}}
    80          {{ end -}}
    81          )
    82          {{ end }}
    83          {{ if eq .Name "By" }}
    84          {{ .Name }}("{{ .Text }}")
    85          {{ continue }}
    86          {{ end }}
    87          {{ if eq .Name "Entry" }}
    88          {{ continue }}
    89          {{ end }}
    90          {{ if ne .Name "DescribeTable" }}
    91          {{ .Name }}("{{ .Text }}", {{range .Labels }}Label("{{.}}"), {{ end }} func() { 
    92          {{ if eq .Name "It" }}
    93          // Implement test and assertions here
    94          {{ end }}
    95              {{ range .Nodes }}
    96              {{ if eq .Name "DescribeTable" }}
    97              {{ .Name }}("{{ .Text }}", 
    98              func() {
    99              {{range .Nodes }}
   100              {{ if eq .Name "By" }}
   101              {{ .Name }}("{{ .Text }}")
   102              {{ end -}}
   103              {{ end -}}
   104  
   105              },
   106              {{range .Nodes }}
   107              {{ if eq .Name "Entry" }}
   108              {{ .Name }}("{{ .Text }}",),
   109              {{ end -}}
   110              {{ end -}}
   111              )
   112              {{ end }}
   113              {{ if eq .Name "By" }}
   114              {{ .Name }}("{{ .Text }}")
   115              {{ continue }}
   116              {{ end }}
   117              {{ if eq .Name "Entry" }}
   118              {{ continue }}
   119              {{ end }}
   120              {{ if ne .Name "DescribeTable" }}
   121              {{ .Name }}("{{ .Text }}", {{range .Labels }}Label("{{.}}"), {{ end }} func() {
   122              {{ if eq .Name "It" }}
   123              // Implement test and assertions here
   124              {{ end }}
   125                   {{ range .Nodes }}
   126                   {{ if eq .Name "DescribeTable" }}
   127                   {{ .Name }}("{{ .Text }}", 
   128                   func() {
   129                   {{range .Nodes }}
   130                   {{ if eq .Name "By" }}
   131                   {{ .Name }}("{{ .Text }}")
   132                   {{ end -}}
   133                   {{ end -}}
   134  
   135                   },
   136                   {{range .Nodes }}
   137                   {{ if eq .Name "Entry" }}
   138                   {{ .Name }}("{{ .Text }}",),
   139                   {{ end -}}
   140                   {{ end -}}
   141                   )
   142                   {{ end }}
   143                   {{ if eq .Name "By" }}
   144                   {{ .Name }}("{{ .Text }}")
   145                   {{ continue }}
   146                   {{ end }}
   147                   {{ if eq .Name "Entry" }}
   148                   {{ continue }}
   149                   {{ end }}
   150                   {{ if ne .Name "DescribeTable" }}
   151                   {{ .Name }}("{{ .Text }}", {{range .Labels }}Label("{{.}}"), {{ end }} func() {
   152                   {{ if eq .Name "It" }}
   153                   // Implement test and assertions here
   154                   {{ end }}
   155  
   156                   })
   157                   {{ end }}
   158                   {{ end }}
   159              })
   160              {{ end }}
   161              {{ end }}
   162          
   163          })
   164          {{ end }}
   165          {{ end }}
   166      
   167      })
   168      {{ end }}
   169      {{ end }}
   170  
   171  })
   172  {{ end }}