Skip to content

Commit b148598

Browse files
authored
Merge branch 'master' into extract-uplicate-code-as-a-common-base-class
2 parents bd75d8d + fe9ef5a commit b148598

11 files changed

Lines changed: 76 additions & 43 deletions

package-lock.json

Lines changed: 6 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/smoke/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/smoke/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"playwright": "^1.55.1",
2626
"rimraf": "^6.0.1",
2727
"shell-quote": "^1.8.3",
28-
"tar": "7.5.3",
28+
"tar": "7.5.4",
2929
"tree-kill": "^1.2.2",
3030
"ts-node": "10.9.2",
3131
"typescript": "5.9.2",

test/smoke/suites/activation.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ElementHelper } from "./helper/elementHelper";
66
import { Constant } from "./helper/constants";
77
import { BaseSmokeTest } from "./helper/baseSmokeTest";
88
import { SmokeTestLogger } from "./helper/smokeTestLogger";
9+
import { TimeoutConstants } from "./helper/timeoutConstants";
910

1011
export function startExtensionActivationTests(): void {
1112
describe("ExtensionActivationTest", () => {
@@ -18,15 +19,15 @@ export function startExtensionActivationTests(): void {
1819
try {
1920
await ElementHelper.WaitElementSelectorVisible(
2021
`[id="${Constant.previewExtensionId}"]`,
21-
10000,
22+
TimeoutConstants.ACTIVATION_TIMEOUT,
2223
);
2324
SmokeTestLogger.info("React-native preview extension is activated");
2425
isActivited = true;
2526
} catch {
2627
try {
2728
await ElementHelper.WaitElementSelectorVisible(
2829
`[id="${Constant.prodExtensionId}"]`,
29-
10000,
30+
TimeoutConstants.ACTIVATION_TIMEOUT,
3031
);
3132
SmokeTestLogger.info("React-native prod extension is activated");
3233
isActivited = true;

test/smoke/suites/cdpNodeVersionCompatibility.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ElementHelper } from "./helper/elementHelper";
77
import { Element } from "./helper/constants";
88
import { BaseSmokeTest } from "./helper/baseSmokeTest";
99
import { SmokeTestLogger } from "./helper/smokeTestLogger";
10+
import { TimeoutConstants } from "./helper/timeoutConstants";
1011

1112
export function startCDPNodeVersionCompatibilityTests(): void {
1213
describe("CDPNodeVersionCompatibilityTest", () => {
@@ -18,7 +19,7 @@ export function startCDPNodeVersionCompatibilityTests(): void {
1819
await ComponentHelper.openRunAndDebugTab();
1920
await ElementHelper.WaitElementClassNameVisible(
2021
Element.runAndDebugTabButtonClassName,
21-
5000,
22+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
2223
);
2324

2425
SmokeTestLogger.info("Run and Debug tab is accessible");
@@ -28,12 +29,15 @@ export function startCDPNodeVersionCompatibilityTests(): void {
2829
await BaseSmokeTest.initApp();
2930

3031
await ComponentHelper.openCommandPalette();
31-
await ElementHelper.WaitElementClassNameVisible(Element.commandPaletteClassName, 5000);
32+
await ElementHelper.WaitElementClassNameVisible(
33+
Element.commandPaletteClassName,
34+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
35+
);
3236

3337
await ElementHelper.inputText("debug");
3438
const option = await ElementHelper.WaitElementSelectorVisible(
3539
Element.commandPaletteFocusedItemSelector,
36-
5000,
40+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
3741
);
3842

3943
const value = await option.getAttribute("aria-label");

test/smoke/suites/commands.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as assert from "assert";
88
import { ElementHelper } from "./helper/elementHelper";
99
import { Element } from "./helper/constants";
1010
import { ComponentHelper } from "./helper/componentHelper";
11-
11+
import { TimeoutConstants } from "./helper/timeoutConstants";
1212
export function startCommandPaletteTests(): void {
1313
describe("CommandPaletteTest", () => {
1414
async function initApp(): Promise<Page> {
@@ -41,12 +41,15 @@ export function startCommandPaletteTests(): void {
4141
await initApp();
4242

4343
await ComponentHelper.openCommandPalette();
44-
await ElementHelper.WaitElementClassNameVisible(Element.commandPaletteClassName, 5000);
44+
await ElementHelper.WaitElementClassNameVisible(
45+
Element.commandPaletteClassName,
46+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
47+
);
4548

4649
await ElementHelper.inputText(text);
4750
const option = await ElementHelper.WaitElementSelectorVisible(
4851
Element.commandPaletteFocusedItemSelector,
49-
5000,
52+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
5053
);
5154

5255
const value = await option.getAttribute("aria-label");

test/smoke/suites/debugConfiguration.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as assert from "assert";
1010
import { ElementHelper } from "./helper/elementHelper";
1111
import { Element } from "./helper/constants";
1212
import { ComponentHelper } from "./helper/componentHelper";
13+
import { TimeoutConstants } from "./helper/timeoutConstants";
1314

1415
export function startDebugConfigurationTests(): void {
1516
describe("DebugConfigurationTest", () => {
@@ -89,7 +90,7 @@ export function startDebugConfigurationTests(): void {
8990

9091
const reactNativeButton = await ElementHelper.WaitElementSelectorVisible(
9192
Element.reactNativeButtonSelector,
92-
5000,
93+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
9394
);
9495
await reactNativeButton.click();
9596

@@ -120,7 +121,7 @@ export function startDebugConfigurationTests(): void {
120121
for (let attempt = 0; attempt < maxAttempts; attempt++) {
121122
const configurationElement = await ElementHelper.TryFindElement(
122123
Element.configurationElementSelector,
123-
5000,
124+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
124125
);
125126
launchContent = await configurationElement?.textContent();
126127
if (launchContent) {

test/smoke/suites/helper/application.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { SmokeTestLogger } from "./smokeTestLogger";
99
import * as fs from "fs";
1010
import * as rimraf from "rimraf";
1111
import { Element } from "./constants";
12+
import { TimeoutConstants } from "./timeoutConstants";
1213

1314
export class Application {
1415
private app: ElectronApplication | null = null;
@@ -55,7 +56,7 @@ export class Application {
5556
timeout: 30000,
5657
});
5758

58-
await utilities.sleep(10000);
59+
await utilities.sleep(TimeoutConstants.APPLICATION_INIT_SLEEP);
5960
return this.mainPage;
6061
}
6162

test/smoke/suites/helper/componentHelper.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ElementHelper } from "./elementHelper";
44
import { Constant, Element } from "./constants";
55
import { WaitHelper } from "./waitHelper";
66
import { SmokeTestLogger } from "./smokeTestLogger";
7+
import { TimeoutConstants } from "./timeoutConstants";
78

89
export class ComponentHelper {
910
static Page(): Page {
@@ -18,15 +19,18 @@ export class ComponentHelper {
1819

1920
public static async executeCommand(commandName: string) {
2021
await this.openCommandPalette();
21-
await ElementHelper.WaitElementClassNameVisible(Element.commandPaletteClassName, 5000);
22+
await ElementHelper.WaitElementClassNameVisible(
23+
Element.commandPaletteClassName,
24+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
25+
);
2226

2327
// Type the command name to search for it
2428
await ElementHelper.inputText(commandName);
2529

2630
// Wait for the command to appear in the list
2731
await ElementHelper.WaitElementSelectorVisible(
2832
Element.commandPaletteFocusedItemSelector,
29-
5000,
33+
TimeoutConstants.COMMAND_PALETTE_TIMEOUT,
3034
);
3135

3236
// Press Enter to execute the command
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for details.
3+
4+
/**
5+
* Timeout constants for smoke tests
6+
* Centralized configuration for all timeout values used across test suites
7+
*/
8+
export class TimeoutConstants {
9+
/** Activation timeout - 10 seconds */
10+
static readonly ACTIVATION_TIMEOUT = 10000;
11+
12+
/** Application initialization sleep - 10 seconds */
13+
static readonly APPLICATION_INIT_SLEEP = 10000;
14+
15+
/** Command palette visibility timeout - 5 seconds */
16+
static readonly COMMAND_PALETTE_TIMEOUT = 5000;
17+
18+
/** Package loader timeout - 4 minutes (240 seconds) */
19+
static readonly PACKAGE_LOADER_TIMEOUT = 4 * 60 * 1000;
20+
21+
/** Command executor timeout - 10 seconds */
22+
static readonly COMMAND_EXECUTOR_TIMEOUT = 10000;
23+
24+
/** Clean & Restart Packager timeout - 5 minutes (300 seconds) */
25+
static readonly PACKAGER_CLEAN_RESTART_TIMEOUT = 300000;
26+
27+
/** Packager state change timeout - 3 minutes (180 seconds) */
28+
static readonly PACKAGER_STATE_TIMEOUT = 180000;
29+
}

0 commit comments

Comments
 (0)