Skip to content

Commit

Permalink
test: fix can\'t find sample page element (#11857)
Browse files Browse the repository at this point in the history
* test: fix can\'t find sample page element

---------

Co-authored-by: Ivan_Chen <[email protected]>
  • Loading branch information
ayachensiyuan and Ivan_Chen authored Jun 19, 2024
1 parent ec004ad commit a9b9885
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@ class ContactExporterTestCase extends CaseFactory {
sampledebugContext: SampledebugContext,
teamsAppId: string
): Promise<Page> {
return await reopenPage(
sampledebugContext.context!,
teamsAppId,
Env.username,
Env.password,
undefined,
true,
true
);
return await reopenPage(sampledebugContext.context!, teamsAppId);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,27 @@ import { Page } from "playwright";
import { TemplateProject, LocalDebugTaskLabel } from "../../utils/constants";
import { validateNpm } from "../../utils/playwrightOperation";
import { CaseFactory } from "./sampleCaseFactory";
import { SampledebugContext } from "./sampledebugContext";

class NpmSearchTestCase extends CaseFactory {
override async onValidate(
page: Page,
options?: { npmName: string }
options?: { npmName: string; context: SampledebugContext }
): Promise<void> {
return await validateNpm(page, { npmName: options?.npmName });
return await validateNpm(page, {
npmName: options?.npmName,
appName: options?.context.appName.substring(0, 10) || "",
});
}

override async onCliValidate(
page: Page,
options?: { npmName: string }
options?: { npmName: string; context: SampledebugContext }
): Promise<void> {
return await validateNpm(page, { npmName: options?.npmName });
return await validateNpm(page, {
npmName: options?.npmName,
appName: options?.context.appName.substring(0, 10) || "",
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ import { Page } from "playwright";
import { TemplateProject } from "../../utils/constants";
import { validateNpm } from "../../utils/playwrightOperation";
import { CaseFactory } from "./sampleCaseFactory";
import { SampledebugContext } from "./sampledebugContext";

class NpmSearchTestCase extends CaseFactory {
override async onValidate(
page: Page,
options?: { npmName: string }
options?: { npmName: string; context: SampledebugContext }
): Promise<void> {
return await validateNpm(page, { npmName: options?.npmName });
}

override async onCliValidate(
page: Page,
options?: { npmName: string }
): Promise<void> {
return await validateNpm(page, { npmName: options?.npmName });
return await validateNpm(page, {
npmName: options?.npmName,
appName: options?.context.appName.substring(0, 10) || "",
});
}
}

Expand All @@ -32,5 +29,5 @@ new NpmSearchTestCase(
"[email protected]",
"dev",
[],
{ npmName: "axios", debug: "ttk" }
{ npmName: "axios" }
).test();
Loading

0 comments on commit a9b9885

Please sign in to comment.