Skip to content

Commit

Permalink
set UI version directly - not UI
Browse files Browse the repository at this point in the history
  • Loading branch information
pospisilf committed Jan 12, 2024
1 parent 3dae953 commit ba80328
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
25 changes: 2 additions & 23 deletions src/ui-test/tests/env/set.camel.version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,24 @@
*/
import {
CATALOG_VERSION_ID,
RESOURCES,
readUserSetting,
setUserSettingsDirectly,
waitUntilExtensionIsActivated
} from '../../utils/testUtils';
import {
ActivityBar,
before,
VSBrowser,
WebDriver
} from 'vscode-uitests-tooling';
import * as pjson from '../../../../package.json';
import { assert } from 'chai';

describe('Camel version', function () {
this.timeout(150000);
this.timeout(15000);

const testDescription = process.env.CAMEL_VERSION ? `Set ${process.env.CAMEL_VERSION}` : 'Use default';

let driver: WebDriver;

before(async function () {
this.timeout(40000);
driver = VSBrowser.instance.driver;
await VSBrowser.instance.openResources(RESOURCES);
await VSBrowser.instance.waitForWorkbench();

await waitUntilExtensionIsActivated(driver, `${pjson.displayName}`);
await (await new ActivityBar().getViewControl('Explorer')).openView();
});

it(testDescription, async function () {
// no env variable set or is empty
if (process.env.CAMEL_VERSION == null || process.env.CAMEL_VERSION.length == 0) {
this.skip();
}

// set version directly
await setUserSettingsDirectly(CATALOG_VERSION_ID, process.env.CAMEL_VERSION);
setUserSettingsDirectly(CATALOG_VERSION_ID, process.env.CAMEL_VERSION);

// check if version was set
assert.equal(readUserSetting(CATALOG_VERSION_ID), process.env.CAMEL_VERSION)
Expand Down
2 changes: 1 addition & 1 deletion src/ui-test/utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export function readUserSetting(id: string): string | null {
* @param id ID of setting.
* @param value Value of setting.
*/
export async function setUserSettingsDirectly(id: string, value: string): Promise<void> {
export function setUserSettingsDirectly(id: string, value: string): void {
const settingsPath = path.resolve(storageFolder, 'settings', 'User', 'settings.json');
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
settings[id] = value;
Expand Down

0 comments on commit ba80328

Please sign in to comment.