Skip to content

Commit

Permalink
Use dom to find the server ready status button
Browse files Browse the repository at this point in the history
  • Loading branch information
testforstephen committed Jan 4, 2024
1 parent 663bec6 commit 9c141c3
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions test/ui/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import * as fse from "fs-extra";
import { platform, tmpdir } from "os";
import * as path from "path";
import * as seleniumWebdriver from "selenium-webdriver";
import { ActivityBar, By, InputBox, ModalDialog, SideBarView, TextEditor, TreeItem, VSBrowser, ViewSection, Workbench } from "vscode-extension-tester";
import { ActivityBar, By, InputBox, ModalDialog, SideBarView, StatusBar, TextEditor, TreeItem, VSBrowser, ViewSection, Workbench } from "vscode-extension-tester";
import { sleep } from "../util";
import { extensions } from "vscode";

// tslint:disable: only-arrow-functions
const newProjectName = "helloworld";
Expand Down Expand Up @@ -49,13 +48,25 @@ describe("Command Tests", function() {
}

async function waitForLanguageServerReady() {
const extension = extensions.getExtension("redhat.java");
if (!extension) {
throw new Error(`Extension "redhat.java" is not installed.`);
const statusBar = new StatusBar();
while (true) {
const language = await statusBar.getCurrentLanguage();
if (language === 'Java') {
break;
}
}
while (true) {
try {
const serverStatus = await statusBar.findElement(By.xpath('//*[@id="redhat.java.java.serverStatus"]'));
await serverStatus.findElement(By.xpath('//a[contains(@class, "statusbar-item-label")]//span[contains(@class, "codicon-thumbsup")]'));
// const languageStatus = await statusBar.findElement(By.xpath('//*[@id="status.languageStatus"]'));
// await languageStatus.click();
// await languageStatus.findElement(By.xpath(`//div[contains(@id, 'context-view')]//div[contains(@class, 'hover-language-status')]//span[contains(@class, 'codicon-thumbsup')]`));
break;
} catch (e) {
await sleep(100);
}
}

const api = await extension.activate();
await api?.serverReady();
}

before(async function() {
Expand Down

0 comments on commit 9c141c3

Please sign in to comment.