Skip to content

Commit 0c8a8e4

Browse files
committed
test
1 parent 343ee60 commit 0c8a8e4

2 files changed

Lines changed: 21 additions & 28 deletions

File tree

test/smoke/suites/debugConfiguration.test.ts

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,19 @@ export function startDebugConfigurationTests(): void {
5555
assert.notStrictEqual(rnOption, null);
5656
});
5757

58-
it("Complete debug configuration setup workflow", async () => {
59-
const rnOptionText = "More React Native options...";
60-
const projectRoot = path.join(__dirname, "..", "resources", "sampleReactNativeProject");
58+
it.only("Complete debug configuration setup workflow", async () => {
59+
const launchFilePath = path.join(__dirname, "..", "resources", "sampleReactNativeProject", ".vscode", "launch.json");
6160

62-
fs.writeFileSync(path.join(projectRoot, ".vscode", "launch.json"), JSON.stringify({}));
61+
fs.writeFileSync(launchFilePath, JSON.stringify({}));
6362

6463
await initApp();
6564

6665
await ComponentHelper.openFileExplorer();
6766
const vscodeFolder = await ComponentHelper.WaitFileVisibleInFileExplorer(".vscode");
68-
assert.notStrictEqual(vscodeFolder, null, ".vscode folder should exist");
67+
if (!vscodeFolder) {
68+
throw new Error("vscodeFolder is null. File '.vscode' was not found in the file explorer.");
69+
}
70+
await vscodeFolder.click();
6971
await ElementHelper.clickElementByText("launch.json");
7072

7173
const debugAddConfigurationButton = await ElementHelper.WaitElementSelectorVisible(
@@ -75,41 +77,34 @@ export function startDebugConfigurationTests(): void {
7577
await debugAddConfigurationButton.click();
7678

7779
const reactNativeButton = await ElementHelper.WaitElementSelectorVisible(
78-
Element.reactNativeButtonAriaLabel,
80+
Element.reactNativeButtonSelector,
7981
3000,
8082
);
8183
await reactNativeButton.click();
8284

8385
const debugApplicationButton = await ElementHelper.WaitElementSelectorVisible(
84-
Element.debugApplicationButtonAriaLabel,
86+
Element.debugApplicationButtonSelector,
8587
1000,
8688
);
8789
await debugApplicationButton.click();
8890

8991
const androidButton = await ElementHelper.WaitElementSelectorVisible(
90-
Element.androidButtonAriaLabel,
92+
Element.androidButtonSelector,
9193
1000,
9294
);
9395
await androidButton.click();
9496

9597
const applicationInDirectModeButton = await ElementHelper.WaitElementSelectorVisible(
96-
Element.applicationInDirectModeButtonAriaLabel,
98+
Element.applicationInDirectModeButtonSelector,
9799
1000,
98100
);
99101
await applicationInDirectModeButton.click();
100-
101-
const rnOption = await ElementHelper.TryFindElement(
102-
`[aria-label="${rnOptionText}"]`,
103-
3000,
104-
);
105-
assert.notStrictEqual(rnOption, null, "React Native debug option should be available");
106-
107-
if (rnOption) {
108-
await rnOption.click();
109-
SmokeTestLogger.info(
110-
"Successfully initiated React Native debug configuration setup",
111-
);
112-
}
102+
await ElementHelper.Page().waitForLoadState("domcontentloaded");
103+
const test = await ElementHelper.TryFindElement(".monaco-mouse-cursor-text", 5000);
104+
console.log(await test?.innerText());
105+
//assert.equal((await test?.innerText())?.toString().includes("Debug Android Hermes"), true, "launch.json file is not correctly updated");
106+
const text = JSON.stringify(await test?.innerText());
107+
assert.ok(text?.includes("Debug Android Hermes"), `Expected text to include "Debug Android Hermes", but got: ${text}`);
113108
});
114109
});
115110
}

test/smoke/suites/helper/constants.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ export class Element {
1616
public static welcomeViewClassName = "welcome-view-content";
1717
public static vscodeMonacoButtonClassName = "monaco-button";
1818
public static debugAddConfigurationButtonSelector = ".floating-click-widget";
19-
public static androidButtonAriaLabel = "div[aria-label='Android']";
20-
public static reactNativeButtonAriaLabel = "div[aria-label='React Native, Enum']";
21-
public static debugApplicationButtonAriaLabel =
22-
"div[aria-label='Debug application, Debug React Native application']";
23-
public static applicationInDirectModeButtonAriaLabel =
24-
"div[aria-label='Application in direct mode(Hermes)']";
19+
public static androidButtonSelector = "div[aria-label='Android']";
20+
public static reactNativeButtonSelector = "div[aria-label='React Native, Enum']";
21+
public static debugApplicationButtonSelector ="div[aria-label='Debug application, Debug React Native application']";
22+
public static applicationInDirectModeButtonSelector = "div[aria-label='Application in direct mode(Hermes)']";
2523
}

0 commit comments

Comments
 (0)