Skip to content

Commit

Permalink
test: use same deploy process for SPFx project (#10752)
Browse files Browse the repository at this point in the history
  • Loading branch information
hellyzh authored Jan 25, 2024
1 parent e7f19de commit 8780858
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import {
RemoteDebugTestContext,
configSpfxGlobalEnv,
runDeploy,
} from "./remotedebugContext";
import {
execCommandIfExist,
Expand Down Expand Up @@ -79,16 +80,7 @@ describe("Remote debug Tests", function () {
Notification.ProvisionSucceeded,
Timeout.shortTimeWait
);
await clearNotifications();
await execCommandIfExist(CommandPaletteCommands.DeployCommand);
try {
const deployConfirmInput = await InputBox.create();
await deployConfirmInput.confirm();
} catch (error) {
console.log("No need to confirm to deploy.");
}
await driver.sleep(Timeout.spfxDeploy);
await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait);
await runDeploy();

const teamsAppId = await remoteDebugTestContext.getTeamsAppId(
projectPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Timeout,
Notification,
} from "../../utils/constants";
import { RemoteDebugTestContext } from "./remotedebugContext";
import { RemoteDebugTestContext, runDeploy } from "./remotedebugContext";
import {
execCommandIfExist,
getNotification,
Expand Down Expand Up @@ -76,16 +76,7 @@ describe("Remote debug Tests", function () {
Notification.ProvisionSucceeded,
Timeout.shortTimeWait
);
await clearNotifications();
await execCommandIfExist(CommandPaletteCommands.DeployCommand);
try {
const deployConfirmInput = await InputBox.create();
await deployConfirmInput.confirm();
} catch (error) {
console.log("No need to confirm to deploy.");
}
await driver.sleep(Timeout.spfxDeploy);
await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait);
await runDeploy();

const teamsAppId = await remoteDebugTestContext.getTeamsAppId(
projectPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import {
RemoteDebugTestContext,
configSpfxGlobalEnv,
runDeploy,
} from "./remotedebugContext";
import {
execCommandIfExist,
Expand Down Expand Up @@ -73,16 +74,7 @@ describe("Remote debug Tests", function () {
Notification.ProvisionSucceeded,
Timeout.shortTimeWait
);
await clearNotifications();
await execCommandIfExist(CommandPaletteCommands.DeployCommand);
try {
const deployConfirmInput = await InputBox.create();
await deployConfirmInput.confirm();
} catch (error) {
console.log("No need to confirm to deploy.");
}
await driver.sleep(Timeout.spfxDeploy);
await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait);
await runDeploy();

const teamsAppId = await remoteDebugTestContext.getTeamsAppId(
projectPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Timeout,
Notification,
} from "../../utils/constants";
import { RemoteDebugTestContext } from "./remotedebugContext";
import { RemoteDebugTestContext, runDeploy } from "./remotedebugContext";
import {
execCommandIfExist,
getNotification,
Expand Down Expand Up @@ -70,16 +70,7 @@ describe("Remote debug Tests", function () {
Notification.ProvisionSucceeded,
Timeout.shortTimeWait
);
await clearNotifications();
await execCommandIfExist(CommandPaletteCommands.DeployCommand);
try {
const deployConfirmInput = await InputBox.create();
await deployConfirmInput.confirm();
} catch (error) {
console.log("No need to confirm to deploy.");
}
await driver.sleep(Timeout.spfxDeploy);
await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait);
await runDeploy();

// Verify the sppkg file path
const sppkgFolderPath = path.resolve(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Timeout,
Notification,
} from "../../utils/constants";
import { RemoteDebugTestContext } from "./remotedebugContext";
import { RemoteDebugTestContext, runDeploy } from "./remotedebugContext";
import {
execCommandIfExist,
getNotification,
Expand Down Expand Up @@ -70,16 +70,7 @@ describe("Remote debug Tests", function () {
Notification.ProvisionSucceeded,
Timeout.shortTimeWait
);
await clearNotifications();
await execCommandIfExist(CommandPaletteCommands.DeployCommand);
try {
const deployConfirmInput = await InputBox.create();
await deployConfirmInput.confirm();
} catch (error) {
console.log("No need to confirm to deploy.");
}
await driver.sleep(Timeout.spfxDeploy);
await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait);
await runDeploy();

const teamsAppId = await remoteDebugTestContext.getTeamsAppId(
projectPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Timeout,
Notification,
} from "../../utils/constants";
import { RemoteDebugTestContext } from "./remotedebugContext";
import { RemoteDebugTestContext, runDeploy } from "./remotedebugContext";
import {
execCommandIfExist,
getNotification,
Expand Down Expand Up @@ -70,16 +70,7 @@ describe("Remote debug Tests", function () {
Notification.ProvisionSucceeded,
Timeout.shortTimeWait
);
await clearNotifications();
await execCommandIfExist(CommandPaletteCommands.DeployCommand);
try {
const deployConfirmInput = await InputBox.create();
await deployConfirmInput.confirm();
} catch (error) {
console.log("No need to confirm to deploy.");
}
await driver.sleep(Timeout.spfxDeploy);
await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait);
await runDeploy();

const teamsAppId = await remoteDebugTestContext.getTeamsAppId(
projectPath
Expand Down
15 changes: 5 additions & 10 deletions packages/tests/src/ui-test/remotedebug/remotedebugContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,17 @@ export async function reRunProvision() {
await driver.sleep(waitTime);
}

export async function runDeploy(
waitTime: number = Timeout.tabDeploy,
spfx = false
) {
export async function runDeploy(waitTime: number = Timeout.tabDeploy) {
const driver = VSBrowser.instance.driver;
await clearNotifications();
console.log("start to deploy");
await execCommandIfExist(CommandPaletteCommands.DeployCommand);

await driver.sleep(Timeout.shortTimeWait);
if (!spfx) {
const dialog = new ModalDialog();
console.log("click deploy button");
await dialog.pushButton("Deploy");
await driver.sleep(waitTime);
}
const dialog = new ModalDialog();
console.log("click deploy button");
await dialog.pushButton("Deploy");
await driver.sleep(waitTime);

try {
await getNotification(
Expand Down
2 changes: 1 addition & 1 deletion packages/tests/src/ui-test/samples/sampleCaseFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export abstract class CaseFactory {
options?.type === "spfx"
);
try {
await runDeploy(Timeout.tabDeploy, options?.type === "spfx");
await runDeploy(Timeout.tabDeploy);
} catch (error) {
await reRunDeploy(Timeout.tabDeploy);
}
Expand Down

0 comments on commit 8780858

Please sign in to comment.