Skip to content

Commit

Permalink
chore:user should sign in for the e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya-eddy <aditya282003@gmail.com>
  • Loading branch information
Aditya-eddy committed Sep 18, 2024
1 parent 88dbcb8 commit 4e0c1d7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 22 deletions.
35 changes: 22 additions & 13 deletions sidebar/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const viewTestLogsButton = document.getElementById('viewTestLogsButton');
const viewRecordLogsButton = document.getElementById('viewRecordLogsButton');
const apiResponseElement = document.getElementById('apiResponseDisplay');
const backConfigbutton = document.getElementById('backConfig');
let actionStarted = false;
// const apiResponseDisplayLog = document.getElementById('apiResponseDisplay');
// const selectRecordFolderButton = document.getElementById('selectRecordFolderButton');
// const selectTestFolderButton = document.getElementById('selectTestFolderButton');
Expand Down Expand Up @@ -134,22 +135,28 @@ if(backConfigbutton){
console.log("selectedIconButton: " , selectedIconButton.textContent );
console.log("backconfig button clicked")

vscode.postMessage({
type: "stopRecordingCommand",
value: `Stop Recording`
});


vscode.postMessage({
type: "stopTestingCommand",
value: `Stop Testing`
});
if(actionStarted == true){
vscode.postMessage({
type: "stopRecordingCommand",
value: `Stop Recording`
});
vscode.postMessage({
type: "stopTestingCommand",
value: `Stop Testing`
});

vscode.postMessage({
type:"navigate",
value:"Config"
value:"IntegrationTest"
})

}else{
vscode.postMessage({
type:"navigate",
value:"Config"
})
}
}else{


Expand Down Expand Up @@ -228,6 +235,7 @@ if (viewRecordLogsButton) {
if (startRecordingButton) {
startRecordingButton.addEventListener('click', async () => {
console.log("startRecordingButton clicked");
actionStarted = true;
resetUI();
// let commandValue = appCommand.value;

Expand All @@ -250,6 +258,7 @@ if (startRecordingButton) {
if (stopRecordingButton) {
stopRecordingButton.addEventListener('click', async () => {
console.log("stopRecordingButton clicked");
actionStarted = false;
vscode.postMessage({
type: "stopRecordingCommand",
value: `Stop Recording`
Expand All @@ -259,6 +268,7 @@ if (stopRecordingButton) {
if (startTestButton) {
startTestButton.addEventListener('click', async () => {
console.log("startTestButton clicked");
actionStarted = true;
resetUI();

// const commandValue = appCommand.value;
Expand All @@ -280,7 +290,7 @@ if (startTestButton) {
if (stopTestButton) {
stopTestButton.addEventListener('click', async () => {
console.log("stopTestButton clicked");

actionStarted = false;
vscode.postMessage({
type: "stopTestingCommand",
value: `Stop Testing`
Expand Down Expand Up @@ -374,7 +384,6 @@ if (setupConfigButton) {
});
}


document.addEventListener('ciCdStepClick', function (e) {
// Logic to handle CI/CD setup click event
if (e.detail.step === 'ci-cd-setup') {
Expand Down
4 changes: 1 addition & 3 deletions src/SidebarProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,7 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
}

case "openLink":{
if (!data.url) {
return;
}

try {
console.log("Opening external link: " + data.url);
vscode.env.openExternal(vscode.Uri.parse(data.url));
Expand Down
49 changes: 46 additions & 3 deletions webviews/components/Config.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
<script>
let showSettings = false;
import { onMount } from "svelte";
let showSettings = false;
const vscode = acquireVsCodeApi();
let userSignedIn = false;
function handleTestSelection(testType) {
function navigateToKeploy() {
vscode.postMessage({
type: "openLink",
url: "https://app.keploy.io/signin", // Replace this with the URL you want to navigate to
});
}
onMount(() => {
// Add event listener for messages from the VSCode extension
window.addEventListener("message", (event) => {
const message = event.data;
if(message.type === "signedIn"){
const signedInResponse = message.value;
if(signedInResponse == "false"){
userSignedIn = false;
// console.log("Progress Bar is not Visible")
}else{
// console.log("Progress Bar is Visible")
userSignedIn = true;
}
}
});
});
function handleTestSelection(testType) {
if(testType != "Unit Testing"){
if(userSignedIn){
vscode.postMessage({
type: "navigate",
value: testType === "Unit Testing" ? "UtgDocs" : "IntegrationTest",
value: testType === "IntegrationTest",
});
}else{
navigateToKeploy();
}
}else{
vscode.postMessage({
type: "navigate",
value: testType === "UtgDocs"
});
}
}
</script>

Expand Down
10 changes: 7 additions & 3 deletions webviews/components/KeployHome.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@
}
};
function navigateToConfig() {
selectedIconButton = 1;
console.log("In the main screen");
if(isRecording || isTesting){
isRecording = false;
isTesting = false;
showSteps = false;
}
}
const clearLastTestResults = () => {
Expand Down Expand Up @@ -176,7 +180,7 @@
<h1 class="main-heading">Running integration tests</h1>
<div>
<h1 id="selectedIconNumber" class="selectedIconClass">{selectedIconButton}</h1>
<button class="back-button" id="backConfig" >
<button class="back-button" id="backConfig" on:click={navigateToConfig} >
<svg
xmlns="http://www.w3.org/2000/svg"
width="32"
Expand Down

0 comments on commit 4e0c1d7

Please sign in to comment.