Skip to content

Commit

Permalink
Update testing docs
Browse files Browse the repository at this point in the history
Signed-off-by: WuJun2016 <WuJun2016@users.noreply.github.com>
  • Loading branch information
WuJun2016 committed Jul 19, 2023
1 parent 8bb803f commit 871b49b
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 11 deletions.
21 changes: 21 additions & 0 deletions integration/assets/highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
--dark-hl-6: #9CDCFE;
--light-hl-7: #0070C1;
--dark-hl-7: #4FC1FF;
--light-hl-8: #800000;
--dark-hl-8: #569CD6;
--light-hl-9: #0000FF;
--dark-hl-9: #CE9178;
--light-hl-10: #098658;
--dark-hl-10: #B5CEA8;
--light-code-background: #F5F5F5;
--dark-code-background: #1E1E1E;
}
Expand All @@ -28,6 +34,9 @@
--hl-5: var(--light-hl-5);
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--code-background: var(--light-code-background);
} }

Expand All @@ -40,6 +49,9 @@
--hl-5: var(--dark-hl-5);
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--code-background: var(--dark-code-background);
} }

Expand All @@ -52,6 +64,9 @@ body.light {
--hl-5: var(--light-hl-5);
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--code-background: var(--light-code-background);
}

Expand All @@ -64,6 +79,9 @@ body.dark {
--hl-5: var(--dark-hl-5);
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--code-background: var(--dark-code-background);
}

Expand All @@ -75,4 +93,7 @@ body.dark {
.hl-5 { color: var(--hl-5); }
.hl-6 { color: var(--hl-6); }
.hl-7 { color: var(--hl-7); }
.hl-8 { color: var(--hl-8); }
.hl-9 { color: var(--hl-9); }
.hl-10 { color: var(--hl-10); }
pre, code { background: var(--code-background); }
33 changes: 33 additions & 0 deletions integration/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,37 @@ <h2>Frontend test skeletons <a name="test_skeletons"></h2>
<p>Here&#39;s an example with both a <code>describe</code> and an <code>it</code> block from <a href="cypress/testcases/support.spec.ts">support.spec.ts</a></p>
<pre><code class="language-typescript"><span class="hl-1">/**</span><br/><span class="hl-1"> * 1. Login</span><br/><span class="hl-1"> * 2. Navigate to the support page</span><br/><span class="hl-1"> * 3. Validate the URL</span><br/><span class="hl-1"> */</span><br/><span class="hl-3">export</span><span class="hl-0"> </span><span class="hl-2">function</span><span class="hl-0"> </span><span class="hl-4">checkSupportPage</span><span class="hl-0">() {}</span><br/><span class="hl-4">describe</span><span class="hl-0">(</span><span class="hl-5">&#39;Support Page&#39;</span><span class="hl-0">, () </span><span class="hl-2">=&gt;</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-4">it</span><span class="hl-0">(</span><span class="hl-5">&#39;Check suport page&#39;</span><span class="hl-0">, () </span><span class="hl-2">=&gt;</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-6">login</span><span class="hl-0">.</span><span class="hl-4">login</span><span class="hl-0">();</span><br/><span class="hl-0"> </span><span class="hl-6">support</span><span class="hl-0">.</span><span class="hl-4">visitSupportPage</span><span class="hl-0">();</span><br/><span class="hl-0"> });</span><br/><span class="hl-0">});</span><br/><br/><span class="hl-1">/**</span><br/><span class="hl-1"> * 1. Login</span><br/><span class="hl-1"> * 2. Navigate to the support page</span><br/><span class="hl-1"> * 3. Click Generate Support Bundle</span><br/><span class="hl-1"> * 4. Input Description</span><br/><span class="hl-1"> * 5. Click Generate</span><br/><span class="hl-1"> * 6. Wait for download</span><br/><span class="hl-1"> * 7. Verify Downlaod</span><br/><span class="hl-1"> * </span><span class="hl-2">@notImplementedFully</span><br/><span class="hl-1"> */</span><br/><span class="hl-3">export</span><span class="hl-0"> </span><span class="hl-2">function</span><span class="hl-0"> </span><span class="hl-4">generateSupportBundle</span><span class="hl-0">() {}</span><br/><span class="hl-4">it</span><span class="hl-0">(</span><span class="hl-5">&#39;Generate Support Bundle&#39;</span><span class="hl-0">, () </span><span class="hl-2">=&gt;</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-6">login</span><span class="hl-0">.</span><span class="hl-4">login</span><span class="hl-0">();</span><br/><span class="hl-0"> </span><span class="hl-6">support</span><span class="hl-0">.</span><span class="hl-4">generateSupportBundle</span><span class="hl-0">(</span><span class="hl-5">&#39;this ia a test description&#39;</span><span class="hl-0">);</span><br/><span class="hl-0">});</span><br/>
</code></pre>

<a href="#how-to-use-docker-image" id="how-to-use-docker-image" style="color: inherit; text-decoration: none;">
<h2>How to use docker image</h2>
</a>

<a href="#build-docker-image" id="build-docker-image" style="color: inherit; text-decoration: none;">
<h3>Build docker image</h3>
</a>
<pre><code class="language-bash"><span class="hl-0">docker build </span><span class="hl-4">.</span><span class="hl-0"> -t harvester/cypress-e2e</span>
</code></pre>

<a href="#run-docker-image" id="run-docker-image" style="color: inherit; text-decoration: none;">
<h3>Run docker image</h3>
</a>
<p>The following environment variables are required to run the docker image:</p>
<ul>
<li><code>MINIO_ENDPOINT</code>: The endpoint of the minio server</li>
<li><code>MINIO_ACCESS_KEY</code>: The access key of the minio server</li>
<li><code>MINIO_SECRET_KEY</code>: The secret key of the minio server</li>
</ul>
<pre><code class="language-YAML"><span class="hl-8">apiVersion</span><span class="hl-0">: </span><span class="hl-9">apps/v1</span><br/><span class="hl-8">kind</span><span class="hl-0">: </span><span class="hl-9">Deployment</span><br/><span class="hl-8">metadata</span><span class="hl-0">:</span><br/><span class="hl-0"> </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">cypress-e2e</span><br/><span class="hl-0"> </span><span class="hl-8">namespace</span><span class="hl-0">: </span><span class="hl-9">harvester</span><br/><span class="hl-8">spec</span><span class="hl-0">:</span><br/><span class="hl-0"> </span><span class="hl-8">template</span><span class="hl-0">:</span><br/><span class="hl-0"> </span><span class="hl-8">spec</span><span class="hl-0">:</span><br/><span class="hl-0"> </span><span class="hl-8">containers</span><span class="hl-0">:</span><br/><span class="hl-0"> - </span><span class="hl-8">env</span><span class="hl-0">:</span><br/><span class="hl-0"> - </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">MINIO_ENDPOINT</span><br/><span class="hl-0"> </span><span class="hl-8">value</span><span class="hl-0">: </span><br/><span class="hl-0"> - </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">MINIO_ACCESS_KEY</span><br/><span class="hl-0"> </span><span class="hl-8">value</span><span class="hl-0">: </span><br/><span class="hl-0"> - </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">MINIO_SECRET_KEY</span><br/><span class="hl-0"> </span><span class="hl-8">value</span><span class="hl-0">: </span><br/><span class="hl-0"> </span><span class="hl-8">image</span><span class="hl-0">: </span><span class="hl-9">harvester/cypress-e2e</span><br/><span class="hl-0"> </span><span class="hl-8">imagePullPolicy</span><span class="hl-0">: </span><span class="hl-9">Always</span><br/><span class="hl-0"> </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">container-0</span><br/><span class="hl-0"> </span><span class="hl-8">volumeMounts</span><span class="hl-0">:</span><br/><span class="hl-0"> - </span><span class="hl-8">mountPath</span><span class="hl-0">: </span><span class="hl-9">/src/cypress.env.json</span><br/><span class="hl-0"> </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">vol-e2e</span><br/><span class="hl-0"> </span><span class="hl-8">subPath</span><span class="hl-0">: </span><span class="hl-9">cypress.env.json</span><br/><span class="hl-0"> </span><span class="hl-8">volumes</span><span class="hl-0">:</span><br/><span class="hl-0"> - </span><span class="hl-8">configMap</span><span class="hl-0">:</span><br/><span class="hl-0"> </span><span class="hl-8">defaultMode</span><span class="hl-0">: </span><span class="hl-10">420</span><br/><span class="hl-0"> </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">cypress-config</span><br/><span class="hl-0"> </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">vol-e2e</span>
</code></pre>
<pre><code class="language-YAML"><span class="hl-8">apiVersion</span><span class="hl-0">: </span><span class="hl-9">v1</span><br/><span class="hl-8">data</span><span class="hl-0">:</span><br/><span class="hl-0"> </span><span class="hl-8">cypress.env.json</span><span class="hl-0">: </span><span class="hl-3">|</span><span class="hl-2">-</span><br/><span class="hl-9"> {</span><br/><span class="hl-9"> &quot;username&quot;: &quot;admin&quot;,</span><br/><span class="hl-9"> &quot;password&quot;: &quot;password1234&quot;,</span><br/><span class="hl-9"> &quot;baseUrl&quot;: &quot;https://192.0.0.1&quot;,</span><br/><span class="hl-9"> }</span><br/><span class="hl-8">kind</span><span class="hl-0">: </span><span class="hl-9">ConfigMap</span><br/><span class="hl-8">metadata</span><span class="hl-0">:</span><br/><span class="hl-0"> </span><span class="hl-8">name</span><span class="hl-0">: </span><span class="hl-9">cypress-config</span><br/><span class="hl-0"> </span><span class="hl-8">namespace</span><span class="hl-0">: </span><span class="hl-9">harvester</span><br/>
</code></pre>

<a href="#view-the-test-result" id="view-the-test-result" style="color: inherit; text-decoration: none;">
<h3>View the test result</h3>
</a>
<p>The docker image will automatically run cypress test and upload the test result to the minio server.
The default bucket name is <code>cypress-test-report</code>, and the default dir path is <code>cypress/results/</code>.</p>
<p>You can view the test result by clicking <a href="https://minio.provo.rancherlabs.com:31524/cypress-test-report/index.html">here</a> for or using the following command:</p>
<pre><code class="language-bash"><span class="hl-0">./scripts/list-reporters</span>
</code></pre>
</div></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="modules.html">Modules</a></li><li class=" tsd-kind-module"><a href="modules/skel_skel_spec.html">skel/skel.spec</a></li><li class=" tsd-kind-module"><a href="modules/testcases_VM_settings_cloud_config_templates_spec.html">testcases/VM settings/cloud-<wbr/>config-<wbr/>templates.spec</a></li><li class=" tsd-kind-module"><a href="modules/testcases_VM_settings_ssh_keys_spec.html">testcases/VM settings/ssh-<wbr/>keys.spec</a></li><li class=" tsd-kind-module"><a href="modules/testcases_dashboard_hosts_spec.html">testcases/dashboard/hosts.spec</a></li><li class=" tsd-kind-module"><a href="modules/testcases_networks_network_spec.html">testcases/networks/network.spec</a></li><li class=" tsd-kind-module"><a href="modules/testcases_virtualmachines_virtual_machine_spec.html">testcases/virtualmachines/virtual-<wbr/>machine.spec</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="assets/main.js"></script></body></html>
Loading

0 comments on commit 871b49b

Please sign in to comment.