Skip to content

Commit

Permalink
test: update linkunfurling validate (#11940)
Browse files Browse the repository at this point in the history
  • Loading branch information
Annefch authored Jul 2, 2024
1 parent 7f213fd commit 88b09fb
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("Local Debug Tests", function () {
Env.password
);
await localDebugTestContext.validateLocalStateForBot();
await validateUnfurlCard(page);
await validateUnfurlCard(page, localDebugTestContext.appName);
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("Local Debug Tests", function () {
Env.password
);
await localDebugTestContext.validateLocalStateForBot();
await validateUnfurlCard(page);
await validateUnfurlCard(page, localDebugTestContext.appName);
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import * as path from "path";
import { startDebugging, waitForTerminal } from "../../utils/vscodeOperation";
import { initPage, validateMsg } from "../../utils/playwrightOperation";
import { initPage, validateNpm } from "../../utils/playwrightOperation";
import { LocalDebugTestContext } from "./localdebugContext";
import { Timeout, LocalDebugTaskLabel } from "../../utils/constants";
import { Env } from "../../utils/env";
Expand Down Expand Up @@ -52,7 +52,10 @@ describe("Local Debug Tests", function () {
Env.password
);
await localDebugTestContext.validateLocalStateForBot();
await validateMsg(page);
await validateNpm(page, {
npmName: "axios",
appName: localDebugTestContext.appName,
});
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import * as path from "path";
import { startDebugging, waitForTerminal } from "../../utils/vscodeOperation";
import { initPage, validateMsg } from "../../utils/playwrightOperation";
import { initPage, validateNpm } from "../../utils/playwrightOperation";
import { LocalDebugTestContext } from "./localdebugContext";
import { Timeout, LocalDebugTaskLabel } from "../../utils/constants";
import { Env } from "../../utils/env";
Expand Down Expand Up @@ -52,7 +52,10 @@ describe("Local Debug Tests", function () {
Env.password
);
await localDebugTestContext.validateLocalStateForBot();
await validateMsg(page);
await validateNpm(page, {
npmName: "axios",
appName: localDebugTestContext.appName,
});
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe("Remote debug Tests", function () {
Env.username,
Env.password
);
await validateUnfurlCard(page);
await validateUnfurlCard(page, remoteDebugTestContext.appName);
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe("Remote debug Tests", function () {
Env.username,
Env.password
);
await validateUnfurlCard(page);
await validateUnfurlCard(page, remoteDebugTestContext.appName);
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
createNewProject,
} from "../../utils/vscodeOperation";
import { it } from "../../utils/it";
import { initPage, validateMsg } from "../../utils/playwrightOperation";
import { initPage, validateNpm } from "../../utils/playwrightOperation";
import { Env } from "../../utils/env";

describe("Remote debug Tests", function () {
Expand Down Expand Up @@ -76,7 +76,10 @@ describe("Remote debug Tests", function () {
Env.username,
Env.password
);
await validateMsg(page);
await validateNpm(page, {
npmName: "axios",
appName: remoteDebugTestContext.appName,
});
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
createNewProject,
} from "../../utils/vscodeOperation";
import { it } from "../../utils/it";
import { initPage, validateMsg } from "../../utils/playwrightOperation";
import { initPage, validateNpm } from "../../utils/playwrightOperation";
import { Env } from "../../utils/env";

describe("Remote debug Tests", function () {
Expand Down Expand Up @@ -77,7 +77,10 @@ describe("Remote debug Tests", function () {
Env.username,
Env.password
);
await validateMsg(page);
await validateNpm(page, {
npmName: "axios",
appName: remoteDebugTestContext.appName,
});
}
);
});
12 changes: 5 additions & 7 deletions packages/tests/src/utils/playwrightOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,8 @@ export async function validateNpm(
`span:has-text("${searchPack}")`
);
await targetItem?.click();
await page?.waitForSelector(`card span:has-text("${searchPack}")`);
await page.waitForTimeout(Timeout.shortTimeWait);
await page?.waitForSelector(`card:has-text("${searchPack}")`);
const sendBtn = await frame?.waitForSelector('button[name="send"]');
await sendBtn?.click();
console.log("verify npm search successfully!!!");
Expand Down Expand Up @@ -2530,15 +2531,12 @@ export async function validateCreatedCard(page: Page, appName: string) {
}
}

export async function validateUnfurlCard(page: Page) {
export async function validateUnfurlCard(page: Page, appName: string) {
try {
const frameElementHandle = await page.waitForSelector(
"iframe.embedded-page-content"
);
const frame = await frameElementHandle?.contentFrame();
const frame = await page.waitForSelector("div#app");
console.log("start to validate unfurl an adaptive card");
const unfurlurl = "https://www.botframework.com/";
await frame?.press("div.ui-box input.ui-box", "Escape");
//await frame?.press("div.ui-box input.ui-box", "Escape");
const msgTxtbox = await frame?.waitForSelector("div[data-tid='ckeditor']");
await msgTxtbox?.focus();
await msgTxtbox?.fill(unfurlurl);
Expand Down

0 comments on commit 88b09fb

Please sign in to comment.