Skip to content

Commit

Permalink
test: add new sample remote ui test
Browse files Browse the repository at this point in the history
  • Loading branch information
v-ivanchen_microsoft committed Nov 27, 2023
1 parent 60d3bfb commit cb86d6c
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/**
* @author Ivan Chen <[email protected]>
*/

import { TemplateProject } from "../../utils/constants";
import { CaseFactory } from "./sampleCaseFactory";
import { SampledebugContext } from "./sampledebugContext";
import * as path from "path";
import * as fs from "fs";

class ChefBotTestCase extends CaseFactory {
public override async onAfterCreate(
sampledebugContext: SampledebugContext,
env: "local" | "dev"
): Promise<void> {
const envFile = path.resolve(
sampledebugContext.projectPath,
"env",
`.env.${env}`
);
let OPENAI_API_KEY = fs.readFileSync(envFile, "utf-8");
OPENAI_API_KEY += "\nSECRET_OPENAI_API_KEY=yourapikey";
fs.writeFileSync(envFile, OPENAI_API_KEY);
console.log(`add OPENAI_API_KEY ${OPENAI_API_KEY} to .env.${env} file`);
}
}

new ChefBotTestCase(
TemplateProject.ChefBot,
24409842,
"[email protected]",
"dev"
).test();
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/**
* @author Ivan Chen <[email protected]>
*/

import { TemplateProject } from "../../utils/constants";
import { CaseFactory } from "./sampleCaseFactory";

class DiceRollerTestCase extends CaseFactory {}

new DiceRollerTestCase(
TemplateProject.GraphConnectorBot,
24121529,
"[email protected]",
"dev",
[],
{ skipValidation: true }
).test();
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/**
* @author Ivan Chen <[email protected]>
*/

import { Page } from "playwright";
import { TemplateProject, ValidationContent } from "../../utils/constants";
import { validateBot } from "../../utils/playwrightOperation";
import { CaseFactory } from "./sampleCaseFactory";

class GraphConnectorBotTestCase extends CaseFactory {
override async onValidate(page: Page): Promise<void> {
return await validateBot(page, {
botCommand: "welcome",
expected: ValidationContent.GraphBot,
});
}
}

new GraphConnectorBotTestCase(
TemplateProject.GraphConnectorBot,
25960851,
"[email protected]",
"dev"
).test();
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/**
* @author Ivan Chen <[email protected]>
*/

import { TemplateProject } from "../../utils/constants";
import { CaseFactory } from "./sampleCaseFactory";
import { SampledebugContext } from "./sampledebugContext";
import * as path from "path";
import * as fs from "fs";

class BotSSOTestCase extends CaseFactory {
public override async onAfterCreate(
sampledebugContext: SampledebugContext,
env: "local" | "dev"
): Promise<void> {
const envFile = path.resolve(
sampledebugContext.projectPath,
"env",
`.env.${env}`
);
let ENDPOINT = fs.readFileSync(envFile, "utf-8");
ENDPOINT += "\nSERVICE_BUS_QUEUE_NAME=test-service-bus";
fs.writeFileSync(envFile, ENDPOINT);
console.log(`add endpoint ${ENDPOINT} to .env.${env} file`);
}
}

new BotSSOTestCase(
TemplateProject.LargeScaleBot,
25960873,
"[email protected]",
"dev",
[],
{ skipInit: true }
).test();

0 comments on commit cb86d6c

Please sign in to comment.