Skip to content

Commit

Permalink
test: add chef bot verify (#10857)
Browse files Browse the repository at this point in the history
* test: add chef bot verify
  • Loading branch information
ayachensiyuan authored Feb 10, 2024
1 parent c78c81c commit 68bcc61
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/tests/scripts/randomCases.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
},
"ubuntu-latest": {
"node-18": []
},
"macos-latest": {
"node-18": []
}
},
"cases": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
* @author Ivan Chen <[email protected]>
*/

import { TemplateProject, LocalDebugTaskLabel } from "../../utils/constants";
import { Page } from "playwright";
import {
TemplateProject,
LocalDebugTaskLabel,
ValidationContent,
} from "../../utils/constants";
import { CaseFactory } from "./sampleCaseFactory";
import { SampledebugContext } from "./sampledebugContext";
import { validateWelcomeAndReplyBot } from "../../utils/playwrightOperation";
import * as path from "path";
import * as fs from "fs";
import * as os from "os";
Expand All @@ -27,6 +33,22 @@ class ChefBotTestCase extends CaseFactory {
fs.writeFileSync(envFile, OPENAI_API_KEY);
console.log(`add OPENAI_API_KEY ${OPENAI_API_KEY} to .env.${env} file`);
}
override async onValidate(page: Page): Promise<void> {
console.log("Moked api key. Only verify happy path...");
return await validateWelcomeAndReplyBot(page, {
hasCommandReplyValidation: true,
botCommand: "helloWorld",
expectedReplyMessage: ValidationContent.AiBotErrorMessage,
});
}
public override async onCliValidate(page: Page): Promise<void> {
console.log("Mocked api key. Only verify happy path...");
return await validateWelcomeAndReplyBot(page, {
hasCommandReplyValidation: true,
botCommand: "helloWorld",
expectedReplyMessage: ValidationContent.AiBotErrorMessage,
});
}
}

new ChefBotTestCase(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* @author Ivan Chen <[email protected]>
*/

import { TemplateProject } from "../../utils/constants";
import { Page } from "playwright";
import { TemplateProject, ValidationContent } from "../../utils/constants";
import { CaseFactory } from "./sampleCaseFactory";
import { SampledebugContext } from "./sampledebugContext";
import { validateWelcomeAndReplyBot } from "../../utils/playwrightOperation";
import * as path from "path";
import * as fs from "fs";
import * as os from "os";
Expand All @@ -27,6 +29,14 @@ class ChefBotTestCase extends CaseFactory {
fs.writeFileSync(envFile, OPENAI_API_KEY);
console.log(`add OPENAI_API_KEY ${OPENAI_API_KEY} to .env.${env} file`);
}
override async onValidate(page: Page): Promise<void> {
console.log("Mocked api key. Only verify happy path...");
return await validateWelcomeAndReplyBot(page, {
hasCommandReplyValidation: true,
botCommand: "helloWorld",
expectedReplyMessage: ValidationContent.AiBotErrorMessage,
});
}
}

new ChefBotTestCase(
Expand Down

0 comments on commit 68bcc61

Please sign in to comment.