Elffuss BraidHub

kikocis/continue public

main · 2.8 KiBRawPermalink
1import { By, WebDriver } from "vscode-extension-tester";
2
3export class NextEditSelectors {
4 /**
5 * Get the SVG decoration element if present (for next edit).
6 */
7 public static async getSvgDecoration(driver: WebDriver) {
8 console.log("===");
9 // return SelectorUtils.getElementByClassName(
10 // driver,
11 // "TextEditorDecorationType",
12 // );
13 return Promise.any([
14 await driver.findElement(By.css("[class*='TextEditorDecorationType']")),
15 await driver.findElement(By.css("[class*=TextEditorDecorationType]")),
16 await driver.findElement(By.css("*[class*='TextEditorDecorationType']")),
17 await driver.findElement(By.css("*[class*=TextEditorDecorationType]")),
18 await driver.findElement(
19 By.css("span[class*='TextEditorDecorationType']"),
20 ),
21 await driver.findElement(By.css("span[class*=TextEditorDecorationType]")),
22 await driver.findElement(
23 By.xpath(`//span[contains(@class, 'TextEditorDecorationType')]`),
24 ),
25 await driver.findElement(
26 By.xpath(`//span[contains(@class, TextEditorDecorationType)]`),
27 ),
28 await driver.findElement(
29 By.xpath(`//*[contains(@class, 'TextEditorDecorationType')]`),
30 ),
31 await driver.findElement(
32 By.xpath(`//*[contains(@class, TextEditorDecorationType)]`),
33 ),
34 ]);
35 // try {
36 // const decorations = await driver.findElement(
37 // // By.xpath("//*[contains(@class, 'ced-') and matches(@class, 'ced-2-TextEditorDecorationType[0-9]+-4')]")
38 // By.css("[class*='TextEditorDecorationType']"),
39 // // By.css("div[class*='TextEditorDecorationType'][style*='filter']")
40 // );
41
42 // if (!decorations) {
43 // throw new Error("SVG decoraton not found");
44 // }
45
46 // return decorations;
47 // } catch (error) {
48 // throw error;
49 // }
50 }
51
52 // public static async getSvgDecoration(driver: WebDriver) {
53 // console.log("Attempting to find SVG decoration");
54 // try {
55 // // First check if any decoration elements exist at all
56 // try {
57 // const allDecorations = await driver.findElements(By.css("[class*='TextEditorDecorationType']"));
58 // console.log(`Found ${allDecorations.length} elements with TextEditorDecorationType class`);
59 // } catch (e) {
60 // console.log("No decoration elements found:", e.message);
61 // }
62
63 // const decorations = await driver.findElement(
64 // By.css("[class*='TextEditorDecorationType']"),
65 // );
66
67 // if (!decorations) {
68 // console.log("SVG decoration not found (null returned)");
69 // throw new Error("SVG decoration not found (null returned)");
70 // }
71
72 // console.log("SVG decoration found");
73 // return decorations;
74 // } catch (error) {
75 // console.log(`Error finding SVG decoration: ${error.message}`);
76 // throw error;
77 // }
78 // }
79}