Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix failure ui test case #12841

Merged
merged 9 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions packages/tests/scripts/randomCases.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,6 @@
"sample-remotedebug-outlook-signature",
"sample-localdebug-reddit-link",
"sample-remotedebug-reddit-link",
"sample-localdebug-intelligent-data-chart",
"sample-remotedebug-intelligent-data-chart"
]
},
{
"os": {
"windows-latest": {
"node-18": []
},
"ubuntu-latest": {
"node-18": []
},
"macos-latest": {
"node-18": []
}
},
"cases": [
"sample-localdebug-chef-bot",
"sample-remotedebug-chef-bot"
]
Expand All @@ -73,7 +56,9 @@
"sample-localdebug-contact-exporter",
"sample-localdebug-hello-world-meeting",
"sample-localdebug-food-catalog",
"sample-remotedebug-food-catalog"
"sample-remotedebug-food-catalog",
"sample-localdebug-intelligent-data-chart",
"sample-remotedebug-intelligent-data-chart"
]
},
{
Expand Down Expand Up @@ -114,7 +99,6 @@
"sample-localdebug-hello-world-tab-outlook",
"sample-localdebug-one-productivity-hub",
"sample-localdebug-assistant-dashboard",
"sample-localdebug-large-scale-notification",
"sample-localdebug-todo-list-sql",
"sample-remotedebug-share-now",
"sample-remotedebug-todo-list-sql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ new DashboardTestCase(
],
{
dashboardFlag: true,
debug: "cli",
}
).test();
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @author Ivan Chen <[email protected]>
*/

// this test case diposed due to cancel local debug
import { Page } from "playwright";
import { TemplateProject, LocalDebugTaskLabel } from "../../utils/constants";
import { CaseFactory } from "./sampleCaseFactory";
Expand Down Expand Up @@ -41,6 +42,10 @@ class LargeNotiTestCase extends CaseFactory {
"env",
`.env.${env}.user`
);
// create envuserfile
if (!fs.existsSync(envUserFile)) {
fs.writeFileSync(envUserFile, "");
}
let envUserFileString = fs.readFileSync(envUserFile, "utf-8");
envUserFileString += `\nSECRET_STORAGE_ACCOUNT_KEY=${process.env["STORAGE_ACCOUNT_KEY"]}`;
fs.writeFileSync(envUserFile, envUserFileString);
Expand Down Expand Up @@ -92,4 +97,4 @@ new LargeNotiTestCase(
{
debug: "ttk",
}
).test();
);
1 change: 1 addition & 0 deletions packages/tests/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ export enum LocalDebugError {
WarningError = "Warning",
WarningCapError = "WARNING",
DeprecatedError = "npm warn deprecated",
CompiledWithWarningError = "Compiled with warnings",
}

export class LocalDebugTaskInfo {
Expand Down
3 changes: 2 additions & 1 deletion packages/tests/src/utils/playwrightOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2367,6 +2367,7 @@ export async function validateDashboardTab(page: Page) {
}
}
});

console.log("start to verify dashboard tab");
await page.waitForTimeout(Timeout.longTimeWait);
const frameElementHandle = await page.waitForSelector(
Expand Down Expand Up @@ -2728,7 +2729,7 @@ export async function validateLargeNotificationBot(
console.log(e);
}
try {
await frame?.waitForSelector('p:has-text("Hello World")');
await frame?.waitForSelector('p:has-text("New Event Occurred!")');
} catch (e) {
throw e;
}
Expand Down
34 changes: 30 additions & 4 deletions packages/tests/src/utils/vscodeOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,36 @@ export async function findWordFromTerminal(word: string): Promise<boolean> {
return true;
}
} else {
await VSBrowser.instance.takeScreenshot(
getScreenshotName("debug failed")
);
assert.fail("[failed] error message found !!!");
try {
await searchInput.clear();
await searchInput.sendKeys("Compiled with warnings");
console.log("send key: Compiled with warnings");
} catch (error) {
console.log("[Pending]: Input error, try to find next...");
continue;
}
// verify warning error message
result = await (
await searchBox.findElement(By.className("matchesCount"))
).getText();
if (result.includes("No results")) {
await VSBrowser.instance.takeScreenshot(
getScreenshotName("debug failed")
);
assert.fail("[failed] error message found !!!");
}
// verify success message
await searchInput.clear();
await searchInput.sendKeys("No issues found");
console.log("send key: ", "No issues found.");
await VSBrowser.instance.driver.sleep(Timeout.webView);
result = await (
await searchBox.findElement(By.className("matchesCount"))
).getText();
if (result.includes("No results") == false) {
console.log("[Pass]: verify " + word + " success !!!");
return true;
}
}
}
return false;
Expand Down
Loading