### ImageRoot Schema Example Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/charts/common/README.md Example configuration for specifying Docker image details. ```yaml # registry: docker.io # repository: bitnami/nginx # tag: 1.16.1-debian-10-r63 # pullPolicy: IfNotPresent # debug: false ``` -------------------------------- ### Start Testkube Development Environment Source: https://github.com/kubeshop/testkube/blob/main/DEVELOPMENT.md Starts the Tilt development environment, building images, deploying the Testkube Helm chart, and setting up port forwards. ```bash tilt up ``` -------------------------------- ### Verify Go Installation Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Check if the installed Go version meets the project's requirements. ```bash go version # Should output: go version go1.26.x ... ``` -------------------------------- ### Persistence Schema Example Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/charts/common/README.md Example configuration for enabling and defining persistent volume storage. ```yaml # enabled: true # storageClass: "-" # accessMode: ReadWriteOnce # size: 8Gi # path: /bitnami ``` -------------------------------- ### Install Dependencies Source: https://github.com/kubeshop/testkube/blob/main/js/scripts/tk-release/README.md Installs project dependencies for the Testkube release script from the repository root. ```bash npm install --prefix=js ``` -------------------------------- ### Example TestWorkflow with Multiple Steps Source: https://github.com/kubeshop/testkube/blob/main/cmd/testworkflow-init/README.md An example TestWorkflow definition showcasing multiple steps, including git operations, dependency installation, unit tests with retry and timeout configurations, and cleanup operations, all managed by the testworkflow-init process. ```yaml # Example TestWorkflow with multiple steps # Group 0 is automatically created - the testworkflow-init process sets up binaries spec: content: # Group 1 - run git clone via the testworkflow-toolkit by the testworkflow-init wrapper git: uri: https://github.com/kubeshop/testkube.git mountPath: /custom/mount/path steps: # Group 2: Dependency installation wrapped by testworkflow-init - name: dependencies run: image: golang:1.21 command: ["go", "mod", "download"] # Group 3: Test execution wrapped by testworkflow-init - name: unit-tests run: image: golang:1.21 command: ["go", "test", "./..."] retry: # Init process handles retry logic count: 3 until: passed timeout: 10m # Init process enforces timeout # Group 4: Cleanup wrapped by testworkflow-init - name: cleanup run: image: alpine command: ["rm", "-rf", "/tmp/test-artifacts"] ``` -------------------------------- ### Install and Run Helm Unit Tests Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/testkube-runner/tests/README.md Installs the helm-unittest plugin and runs all unit tests for the testkube-runner chart. ```bash helm plugin install https://github.com/helm-unittest/helm-unittest.git # once helm unittest k8s/helm/testkube-runner ``` -------------------------------- ### Verify Local Setup with Testkube CLI Source: https://github.com/kubeshop/testkube/blob/main/DEVELOPMENT.md Verifies the local Testkube setup by running a command against the local API server using the compiled CLI. ```bash ./build/_local/kubectl-testkube get testworkflows ``` -------------------------------- ### Install Testkube Helm Chart Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/testkube/README.md Install the Testkube Helm chart, creating the namespace if it doesn't exist. Requires cluster administrative rights. ```sh helm install testkube kubeshop/testkube --create-namespace --namespace testkube ``` -------------------------------- ### Directory Structure Example Source: https://github.com/kubeshop/testkube/blob/main/test/README.md Illustrates the hierarchical organization of the test directory, showing tool-specific subdirectories and workflow definitions. ```bash ... ├── curl │ └── crd-workflow # workflows ├── cypress │ ├── crd-workflow # workflows │ ├── cypress-12 │ ├── cypress-13 │ └── cypress-14 ... ├── junit-pregenerated-reports # additional custom cases for junit reports (mainly edge-cases) │ ├── crd-workflow │ ├── high-level-failure.xml │ ├── high-level-testcase-both-error-and-failure.xml │ └── high-level-without-testcases.xml ... ├── postman │ ├── crd-workflow # workflows │ ├── postman-executor-smoke-negative.postman_collection.json │ ├── postman-executor-smoke-without-envs.postman_collection.json │ └── postman-executor-smoke.postman_collection.json ├── special-cases # Special cases and Edge-cases ├── testkube # Testkube-specific workflows - installation tests, E2E tests, etc. ... ``` -------------------------------- ### Install PostgreSQL Helm Chart Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/README.md Installs the PostgreSQL chart using Helm. Replace 'my-release' with your desired release name. ```console helm install my-release oci://registry-1.docker.io/bitnamicharts/postgresql ``` -------------------------------- ### Testkube Devbox Example Usage Source: https://github.com/kubeshop/testkube/blob/main/cmd/tcl/kubectl-testkube/devbox/README.md Demonstrates how to set up an alias for the Testkube CLI and run the devbox with specific parameters for synchronization and naming. ```shell # Initialize alias tk() { cd ~/projects/testkube go run cmd/kubectl-testkube/main.go $@ } # Select the proper cluster to deploy the devbox kubectx cloud-dev # Run development box, synchronising all the Test Workflows from 'test' directory in Testkube repository tk devbox -n dawid -s test ``` -------------------------------- ### Install Helm Chart with --set Parameter Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/README.md Use this command to install the Helm chart and set specific configuration values, such as the PostgreSQL password, directly on the command line. ```console helm install my-release \ --set auth.postgresPassword=secretpassword oci://REGISTRY_NAME/REPOSITORY_NAME/postgresql ``` -------------------------------- ### Example PostgreSQL Log Output Indicating Successful Data Persistence Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/README.md This log output indicates that the PostgreSQL container is starting and deploying with existing persisted data, confirming a successful upgrade. ```text $ kubectl logs $(kubectl get pods -l app.kubernetes.io/instance=postgresql,app.kubernetes.io/name=postgresql,app.kubernetes.io/component=primary -o jsonpath="{.items[0].metadata.name}") ... postgresql 08:05:12.59 INFO ==> Deploying PostgreSQL with persisted data... ... ``` -------------------------------- ### Helm Install Command with Empty Value Alerts Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/charts/common/README.md Illustrates the command to install a chart and the expected alerts when required values are left empty. ```console helm install test mychart --set path.to.value00="",path.to.value01="" 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) ``` -------------------------------- ### Install Helm Chart with values.yaml File Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/README.md Install the Helm chart by providing a YAML file containing all desired configuration values. This is useful for managing complex configurations. ```console helm install my-release -f values.yaml oci://REGISTRY_NAME/REPOSITORY_NAME/postgresql ``` -------------------------------- ### Tilt Up Options for Development Source: https://github.com/kubeshop/testkube/blob/main/DEVELOPMENT.md Demonstrates various options for starting the Tilt development environment, including enabling the debugger, changing the database backend, and disabling live reload. ```bash tilt up tilt up -- --debug tilt up -- --db=mongo tilt up -- --db=both tilt up -- --no-live-reload ``` -------------------------------- ### Example ConfigMap using common.names.fullname Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/charts/common/README.md An example of a ConfigMap that utilizes the 'common.names.fullname' helper for its name. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: {{ include "common.names.fullname" . }} data: myvalue: "Hello World" ``` -------------------------------- ### ExistingSecret Schema Example Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/charts/common/README.md Example configuration for using an existing Kubernetes Secret. ```yaml # name: mySecret # keyMapping: # password: myPasswordKey ``` -------------------------------- ### Go Import Ordering Example Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Demonstrates the required import order for Go packages: standard library, third-party, and local imports. Enforced by goimports. ```go import ( "context" "fmt" "github.com/gofiber/fiber/v2" "go.uber.org/zap" "github.com/kubeshop/testkube/pkg/api/v1/testkube" "github.com/kubeshop/testkube/pkg/log" ) ``` -------------------------------- ### Install PostgreSQL Helm Chart with Custom Registry Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/README.md Installs the PostgreSQL chart with a custom registry and repository. Ensure you replace REGISTRY_NAME and REPOSITORY_NAME with your specific values. ```console helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/postgresql ``` -------------------------------- ### Prometheus Scrape Configuration Example Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/README.md Example Prometheus scrape configuration for collecting metrics from within a Kubernetes cluster. ```yaml https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml ``` -------------------------------- ### Install Release Script Globally Source: https://github.com/kubeshop/testkube/blob/main/js/scripts/tk-release/README.md Installs the Testkube release script globally using npm, making it accessible from anywhere. ```bash sudo npm install -g js/scripts/tk-release ``` -------------------------------- ### Start MCP Server with Stdio Transport Source: https://github.com/kubeshop/testkube/blob/main/pkg/mcp/README.md Starts the MCP server using the default stdio transport. Use the --debug flag for detailed output. ```bash # Start the MCP server with stdio transport (default) ./bin/app/kubectl-testkube mcp serve # Start with debug output ./bin/app/kubectl-testkube mcp serve --debug # Use --verbose if you need to check what context is used, but this will log things to stdout ./bin/app/kubectl-testkube mcp serve --verbose ``` -------------------------------- ### Start MCP Server with SHTTP Transport Source: https://github.com/kubeshop/testkube/blob/main/pkg/mcp/README.md Starts the MCP server using the Streamable HTTP (SHTTP) transport. Custom host, port, and TLS can be configured. ```bash # Start MCP server with SHTTP transport on localhost:8080 ./bin/app/kubectl-testkube mcp serve --transport=shttp # Start SHTTP server on custom host and port ./bin/app/kubectl-testkube mcp serve --transport=shttp --shttp-host=0.0.0.0 --shttp-port=9090 # Start SHTTP server with TLS ./bin/app/kubectl-testkube mcp serve --transport=shttp --shttp-tls --shttp-cert-file=cert.pem --shttp-key-file=key.pem # Start SHTTP server with debug output ./bin/app/kubectl-testkube mcp serve --transport=shttp --debug ``` -------------------------------- ### VSCode SHTTP Configuration for MCP Server Source: https://github.com/kubeshop/testkube/blob/main/pkg/mcp/README.md Example VSCode configuration for launching the MCP server with SHTTP transport. Customize host and port as needed. ```json { "servers": { "testkube": { "command": "/path/to/your/testkube/bin/app/kubectl-testkube", "args": ["mcp", "serve", "--transport=shttp", "--shttp-host=localhost", "--shttp-port=8080"], "type": "shttp" } } } ``` -------------------------------- ### Compile and Resolve Expression Source: https://github.com/kubeshop/testkube/blob/main/pkg/expressions/README.md Demonstrates the basic workflow of compiling a string expression and then resolving it against a machine to get a result. ```go // Compile expression expr, err := expressions.Compile("name + ' is ' + string(age)") if err != nil { // Handle syntax error } // Resolve with machine result, err := expr.Resolve(machine) if err != nil { // Handle runtime error } // Get final value value := result.Value() ``` -------------------------------- ### Error Handling Examples Source: https://github.com/kubeshop/testkube/blob/main/pkg/expressions/README.md Illustrates how to handle both compile-time syntax errors and runtime resolution errors, including the use of safe resolution for missing variables. ```go // Compile-time syntax errors expr, err := expressions.Compile("invalid ++ syntax") // Runtime resolution errors result, err := expr.Resolve(machine) // Safe resolution (no error for missing variables) partial, changed, err := expr.SafeResolve(machine) ``` -------------------------------- ### VSCode Stdio Configuration for MCP Server Source: https://github.com/kubeshop/testkube/blob/main/pkg/mcp/README.md Example VSCode configuration for launching the MCP server with stdio transport. Ensure the command path is correct. ```json { "servers": { "testkube": { "command": "/path/to/your/testkube/bin/app/kubectl-testkube", "args": ["mcp", "serve", "--debug"], "type": "stdio" } } } ``` -------------------------------- ### Add and Update Helm Repository Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/testkube/README.md Add the Testkube Helm repository and update local chart information before installation. ```sh helm repo add kubeshop https://kubeshop.github.io/helm-charts helm repo update ``` -------------------------------- ### Testkube-Specific Workflows Directory Structure Source: https://github.com/kubeshop/testkube/blob/main/test/README.md Outlines the structure for Testkube-specific workflows, including installation, OSS, and E2E tests. ```bash ├── testkube │ ├── installation-tests │ ├── oss-tests │ ├── runner-targets │ └── ui-e2e ``` -------------------------------- ### Connect via LoadBalancer Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/templates/NOTES.txt These commands are for connecting to PostgreSQL when the service type is LoadBalancer. Note that it may take a few minutes for the LoadBalancer IP to become available. You can monitor its status with `kubectl get svc --namespace {{ $releaseNamespace }} -w {{ include "postgresql.v1.primary.fullname" . }}`. ```bash export SERVICE_IP=$(kubectl get svc --namespace {{ $releaseNamespace }} {{ include "postgresql.v1.primary.fullname" . }} --template "{{ \"{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}\" }}") ``` ```bash PGPASSWORD="$POSTGRES_PASSWORD" psql --host $SERVICE_IP --port {{ include "postgresql.v1.service.port" . }} -U {{ default "postgres" $customUser }} -d {{- if include "postgresql.v1.database" . }} {{ include "postgresql.v1.database" . }}{{- else }} postgres{{- end }} ``` ```bash psql --host $SERVICE_IP --port {{ include "postgresql.v1.service.port" . }} -d {{- if include "postgresql.v1.database" . }} {{ include "postgresql.v1.database" . }}{{- else }} postgres{{- end }} ``` -------------------------------- ### Variable Access Examples Source: https://github.com/kubeshop/testkube/blob/main/pkg/expressions/README.md Shows different ways to access variables within expressions, including simple lookups, nested properties, bracket notation for keys, and array indexing. ```plaintext variable // Simple variable lookup env.HOME // Nested property access config["key"] // Bracket notation array[0] // Array indexing ``` -------------------------------- ### Create and Register with a Machine Source: https://github.com/kubeshop/testkube/blob/main/pkg/expressions/README.md Demonstrates how to create a new machine and register variables, nested data, dynamic accessors, and custom functions. ```go // Basic machine machine := expressions.NewMachine() // Register simple variable machine.Register("name", "John") // Register nested data machine.Register("config", map[string]interface{}{ "timeout": 30, "enabled": true, }) // Register dynamic accessor (e.g., for env.* variables) machine.RegisterAccessor(func(name string) (interface{}, bool) { if strings.HasPrefix(name, "env.") { return os.Getenv(name[4:]), true } return nil, false }) // Register custom function machine.RegisterFunction("double", func(values ...expressions.StaticValue) (interface{}, bool, error) { if len(values) != 1 { return nil, false, errors.New("double requires 1 argument") } n, _ := values[0].IntValue() return n * 2, true, nil }) ``` -------------------------------- ### Replicating Container Startup Scripts Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/templates/NOTES.txt Execute this command to replicate the container's entrypoint and run scripts, useful for debugging startup behavior. ```bash /opt/bitnami/scripts/postgresql/entrypoint.sh /opt/bitnami/scripts/postgresql/run.sh ``` -------------------------------- ### Running Sample Test Workflows via CLI Source: https://github.com/kubeshop/testkube/blob/main/DEVELOPMENT.md Demonstrates how to run a sample Testkube workflow from the terminal using the compiled CLI. This is an alternative to using the Tilt UI's 'run-cli-command' resource. ```bash ./build/_local/kubectl-testkube run testworkflow curl-workflow-smoke ``` -------------------------------- ### Build All Binaries Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Compile all main application binaries for the project. ```bash make build ``` -------------------------------- ### Conventional Commits Examples Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Provides examples of commit messages following the Conventional Commits format for various types like feat, fix, docs, and refactor. ```text feat(api): add support for workflow templates fix(cli): correct output format for JSON responses docs(readme): update installation instructions refactor(executor): simplify step processing logic ``` -------------------------------- ### Running Tests and Linting via Make Source: https://github.com/kubeshop/testkube/blob/main/DEVELOPMENT.md Execute the full test suite or run golangci-lint directly from the terminal using make commands. These are equivalent to triggering the 'make test' and 'make lint' resources in the Tilt UI. ```bash make test make lint ``` -------------------------------- ### Run Linting and Build Checks Source: https://github.com/kubeshop/testkube/blob/main/AGENTS.md Execute linting using golangci-lint and verify compilation before committing changes. Use `make lint-fix` to auto-fix linting issues. ```bash make lint go build ./... ``` -------------------------------- ### Build Test Workflow Components Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Compile the Test Workflow toolkit and init container binaries. ```bash make build-toolkit make build-init ``` -------------------------------- ### Add NATS Helm Repository and Install Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/testkube/charts/nats/README.md Add the official NATS Helm repository and then upgrade or install the NATS chart. This is the primary command for deploying NATS using Helm. ```shell helm repo add nats https://nats-io.github.io/k8s/helm/charts/ helm upgrade --install nats nats/nats ``` -------------------------------- ### Get React Props from DOM Element Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Retrieves the props object associated with a DOM element. ```javascript function ps(e){return e[Pr]||null} ``` -------------------------------- ### ValidateValue Multiple Empty Validation Source: https://github.com/kubeshop/testkube/blob/main/k8s/helm/postgresql/charts/common/README.md Example of using the 'common.validations.values.multiple.empty' helper to enforce that specific values are not empty. ```yaml {{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}} {{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}} {{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} ``` -------------------------------- ### Build API Server Binary Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Compile only the API server binary. ```bash make build-api-server ``` -------------------------------- ### Build Kubectl Testkube Plugin Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Compile the kubectl-testkube plugin binary. ```bash make build-kubectl-testkube-cli ``` -------------------------------- ### Get React Node from DOM Element Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Extracts the React node (Fiber or Container) from a DOM element. ```javascript function Wr(e){return e[st]||e[yt]} ``` -------------------------------- ### Getting Dehydrated State Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Retrieves the dehydrated state from a fiber, typically used in server-side rendering scenarios. ```javascript function qf(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null} ``` -------------------------------- ### Build Test Workflow Init Image Source: https://github.com/kubeshop/testkube/blob/main/DEVELOPMENT.md Builds the Test Workflow init image with the production target. ```bash # Build Test Workflow images docker build -t testworkflow-init:dev --target dist \ -f build/_local/testworkflow-init.Dockerfile . ``` -------------------------------- ### Get Request Headers Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Retrieves request headers from the options, returning an object or an empty object if none are present. ```typescript function vl(e){let t=e.options.headers;if(t)return Symbol.iterator in t?Object.fromEntries(t):t} ``` -------------------------------- ### Component Instantiation and Initial State Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Creates a new component instance, sets its initial state, and handles context. ```javascript function xd(e,t,n){var r=!1,o=qt,s=t.contextType;typeof s=="object"&&s!==null?s=Ye(s):(o=be(t)?ln:we.current,r=t.contextTypes,s=(r=r!=null)?qn(e,o):qt),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=gs,e.stateNode=t,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=s),t.context=s,t.state=e.memoizedState,t.updater=gs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=s)} ``` -------------------------------- ### Filesystem Machine Source: https://github.com/kubeshop/testkube/blob/main/pkg/expressions/README.md Creates a machine that includes filesystem-related functions like `file()` and `glob()`. ```go // Adds file() and glob() functions fsMachine := libs.NewFsMachine(os.DirFS("/"), "/workspace") ``` -------------------------------- ### Getting First DOM Node Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Retrieves the first DOM node from a fiber, used for DOM manipulation and event handling. ```javascript function jf(e){return e=xg(e),e!==null?Vf(e):null} ``` ```javascript function Vf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Vf(e);if(t!==null)return t;e=e.sibling}return null} ``` -------------------------------- ### Common Expression Patterns Source: https://github.com/kubeshop/testkube/blob/main/cmd/testworkflow-init/README.md Examples of common expression patterns used for conditions, retry logic, and output references within the workflow. ```yaml # Conditions condition: "env.ENVIRONMENT == 'production'" condition: "setup-step.failed || parent1.failed" # Retry logic retry: count: 3 until: "passed" # or "self.exitCode != 1" # Output references condition: "output.testResult == 'success'" command: ["deploy", "--version", "{{output.version}}"] ``` -------------------------------- ### Create Feature Branch Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Command to create a new feature branch from the main branch. Use this for starting new development work. ```bash git checkout -b feat/your-feature-name ``` -------------------------------- ### Component Mount and Initialization Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Initializes a component upon mounting, calling lifecycle methods like `componentWillMount` and `getDerivedStateFromProps`. ```javascript function Xi(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=Ed,ql(e);var s=t.contextType;typeof s=="object"&&s!==null?o.context=Ye(s):(s=be(t)?ln:we.current,o.context=qn(e,s)),o.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Yi(e,t,s,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&gs.enqueueReplaceState(o,o.state,null),Ko(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)} ``` -------------------------------- ### Get DOM Node from React State Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Retrieves the DOM node from a React Fiber node, specifically for element and text nodes. ```javascript function Sn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(R(33))} ``` -------------------------------- ### Build CLI Binary Source: https://github.com/kubeshop/testkube/blob/main/CONTRIBUTING.md Compile only the Testkube CLI binary. ```bash make build-testkube-cli ``` -------------------------------- ### CRC32 Calculation Helper Source: https://github.com/kubeshop/testkube/blob/main/test/playwright/playwright-project/playwright-report/index.html Appends data to a CRC32 checksum calculation and provides methods to get the checksum and update internal keys. ```javascript function El(e,t){e.crcKey0.append([t]),e.keys[0]=~e.crcKey0.get(),e.keys[1]=$c(e.keys[1]+uf(e.keys[0])),e.keys[1]=$c(Math.imul(e.keys[1],134775813)+1),e.crcKey2.append([e.keys[1]>>>24]),e.keys[2]=~e.crcKey2.get()} ``` ```javascript function af(e){const t=e.keys[2]|2;return uf(Math.imul(t,t^1)>>>8)} ``` ```javascript function uf(e){return e&255} ``` ```javascript function $c(e){return e&4294967295} ``` ```javascript function cf(e,t){e.keys=[305419896,591751049,878082192],e.crcKey0=new Er(e.keys[0]),e.crcKey2=new Er(e.keys[2]);for(let n=0;n