Skip to content

Commit

Permalink
FUSETOOLS2-2201
Browse files Browse the repository at this point in the history
  • Loading branch information
pospisilf committed Dec 19, 2023
1 parent b54504a commit 4bdfd61
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 7 deletions.
60 changes: 55 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Main CI

on:
push:
branches: [ main ]
branches: [ main, FUSETOOLS2-2201 ]
pull_request:
branches: [ main ]
workflow_dispatch:
Expand All @@ -14,16 +14,63 @@ concurrency:
jobs:
main:
strategy:
matrix:
os: [ ubuntu-latest, macos-13, windows-latest ]
version: [ "1.82.3", max ] # [ "x.x.x" | latest | max ]
type: [ stable ] # [ stable | insider ]
fail-fast: false
matrix:
# os: [ ubuntu-latest, macos-13, windows-latest ]
# version: [ "1.82.3", max ] # [ "x.x.x" | latest | max ]
# type: [ stable ] # [ stable | insider ]
include:
- os: ubuntu-latest
version: "1.82.3"
type: stable
- os: ubuntu-latest
version: max
camelversion: "4.2.0"
type: stable
- os: ubuntu-latest
version: max
camelversion: "4.0.0.redhat-00031"
type: stable
- os: ubuntu-latest
version: max
camelversion: "4.0.0"
type: stable
- os: macos-13
version: "1.82.3"
type: stable
- os: macos-13
version: max
camelversion: "4.2.0"
type: stable
- os: macos-13
version: max
camelversion: "4.0.0.redhat-00031"
type: stable
- os: macos-13
version: max
camelversion: "4.0.0"
type: stable
- os: windows-latest
version: "1.82.3"
type: stable
- os: windows-latest
version: max
camelversion: "4.2.0"
type: stable
- os: windows-latest
version: max
camelversion: "4.0.0.redhat-00031"
type: stable
- os: windows-latest
version: max
camelversion: "4.0.0"
type: stable

env:
CODE_VERSION: ${{ matrix.version }}
CODE_TYPE: ${{ matrix.type }}
TEST_RESOURCES: test-resources
CAMEL_VERSION: ${{ matrix.camelversion }}

runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -70,6 +117,9 @@ jobs:

- name: npm-vscode:prepublish
run: npm run vscode:prepublish

- name: show camel version
run: echo $CAMEL_VERSION

- name: test (ubuntu)
id: test_Ubuntu
Expand Down
62 changes: 62 additions & 0 deletions src/ui-test/tests/00_set.camel.version.test.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License", destination); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

//import { assert } from 'chai';
import {
CATALOG_VERSION_ID,
CATALOG_VERSION_UI,
RESOURCES,
closeEditor,
readUserSetting,
waitUntilExtensionIsActivated,
} from '../utils/testUtils';
import {
ActivityBar,
before,
VSBrowser,
WebDriver,
TextSetting,
Workbench,
DefaultWait
} from 'vscode-uitests-tooling';
import * as pjson from '../../../package.json';

describe('set camel version', function () {
this.timeout(300000);

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('set and check value', async function () {
const settings = await new Workbench().openSettings();
const textSetting = await settings.findSetting(CATALOG_VERSION_UI, 'Camel') as TextSetting;
await textSetting.setValue(process.env.CAMEL_VERSION);
console.log("Value settd at beggining in UI" + await textSetting.getValue());
await closeEditor('Settings', true);
await DefaultWait.sleep(5000); // todo: dynamicke cekani nez tam bude verze propsana
console.log("Value settd at beggining from readUserSetting" + readUserSetting(CATALOG_VERSION_ID));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
initXMLFileWithJBang,
JBANG_VERSION_ID,
killTerminal,
readUserSetting,
resetUserSettings,
RESOURCES,
setAdditionalComponents,
Expand Down Expand Up @@ -119,9 +120,17 @@ describe('User preferences', function () {
describe('Camel Catalog version', function () {
this.timeout(90000);

let defaultCatalogVersion;

before(async function() {
defaultCatalogVersion = readUserSetting(CATALOG_VERSION_ID);
console.log("Value saved in defaultCatalogVersion variable" +defaultCatalogVersion )
})

after(async function () {
await new EditorView().closeAllEditors();
resetUserSettings(CATALOG_VERSION_ID);
resetUserSettings(defaultCatalogVersion);
console.log("Value returned in after using readUserSetting" + readUserSetting(CATALOG_VERSION_ID))
});

afterEach(async function () {
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions src/ui-test/tests/xx_check.camel.version.test.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License", destination); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {
CATALOG_VERSION_ID,
readUserSetting,
} from '../utils/testUtils';

describe('check camel version at end', function () {
this.timeout(300000);

it('actual version at end ', async function () {
console.log("Value readed from readusersetting at end" + readUserSetting(CATALOG_VERSION_ID));
// todo checknout, ze to odpovida env variable?
});
});
2 changes: 1 addition & 1 deletion src/ui-test/uitest_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const extensionFolder = path.join(projectPath, '.test-extensions');

async function main(): Promise<void> {
const tester = new ExTester(storageFolder, releaseType, extensionFolder);
await tester.setupAndRunTests('out/src/ui-test/tests/*.test.js',
await tester.setupAndRunTests('out/src/ui-test/tests/*.test.dev.js',
process.env.CODE_VERSION,
{
'installDependencies': true
Expand Down
19 changes: 19 additions & 0 deletions src/ui-test/utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,25 @@ export function resetUserSettings(id: string): void {
fs.writeFileSync(settingsPath, reset, 'utf-8');
}

/**
* TODO
*
* @param id TODO.
*/
export function readUserSetting(id: string): string | null {
const settingsPath = path.resolve(storageFolder, 'settings', 'User', 'settings.json');
const settingsContent = fs.readFileSync(settingsPath, 'utf-8');

//console.log("text\n\n" + settingsContent + "\n\n");

const regex = new RegExp(`"${id}":\\s*"(.*?)"`, 'i');
const match = settingsContent.match(regex);

console.log("readUserSetting: Value readed" + match);

return match ? match[1] : null;
}

/**
* Delete file from folder.
*
Expand Down

0 comments on commit 4bdfd61

Please sign in to comment.