Skip to content

Commit

Permalink
strict on and local test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
pospisilf committed Feb 29, 2024
1 parent 39391cd commit f701469
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 70 deletions.
86 changes: 17 additions & 69 deletions src/ui-test/tests/code.navigation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,89 +149,37 @@ describe('Code navigation', function () {
*/

// tohle funguje jenom orio
// async function allSymbolsAreAvailableInQuickpickCommand(listOfAvailableSymbols: (string | number)[][]): Promise<void> {
// await new Workbench().executeCommand('workbench.action.gotoSymbol');

// await driver.wait(async function () {
// input = await InputBox.create();
// return (await input.isDisplayed());
// }, 30000);

// quickPicks = await input.getQuickPicks();
// for (const quickpick of quickPicks) {
// const nameFromField = listOfAvailableSymbols.at(quickpick.getIndex()).at(0);
// assert.equal((await quickpick.getLabel()).slice(1), nameFromField);
// }

// await input.cancel();
// }

async function allSymbolsAreAvailableInQuickpickCommand(listOfAvailableSymbols: (string | number)[][]): Promise<void> {
let input: InputBox | undefined;

await new Workbench().executeCommand('workbench.action.gotoSymbol');

await driver.wait(async function () {
input = await InputBox.create();
return (input !== undefined && await input.isDisplayed());
return (await input.isDisplayed());
}, 30000);

// if (input !== undefined) {
// const symbols = await input.getQuickPicks();
// for (const symbol of symbols) {
// const label = (await symbol.getLabel()).slice(1);
// if (label === proposal) {
// await symbol.select();
// }
// }
// }

if (input !== undefined) {
const symbols = await input.getQuickPicks();
for (const symbol of symbols) {
// const label = (await symbol.getLabel()).slice(1);
// console.log("lejbl " + label);
const index = symbol.getIndex();
if (typeof index === 'number') {
console.log("je to numbeeer");
const nameFromField = listOfAvailableSymbols?.[index]?.[0];
if (typeof nameFromField === 'string') {
const label = await symbol.getLabel();
console.log("lejvl" + label);
assert.equal(label?.slice(1), nameFromField);
}
}
}

quickPicks = await input.getQuickPicks();
for (const quickpick of quickPicks) {
// Check if quickpick.getIndex() and listOfAvailableSymbols[quickpick.getIndex()] are defined
const nameFromField = listOfAvailableSymbols[quickpick.getIndex()]?.[0];
if (nameFromField !== undefined) {
assert.equal((await quickpick.getLabel()).slice(1), nameFromField);
} else {
// Handle the case where the index is out of range or listOfAvailableSymbols is undefined
console.error(`Unable to retrieve name from field for index ${quickpick.getIndex()}`);
}

}

// if (input !== undefined) {
// console.log("input neni undefined");
// const quickPicks = await input.getQuickPicks();
// //console.log

// for (const quickpick of quickPicks) {
// console.log("uvnitr smykcy");
// // const index = quickpick.getIndex();
// // if (typeof index === 'number') { // Check if index is a number
// // const nameFromField = listOfAvailableSymbols?.[index]?.[0];
// // if (typeof nameFromField === 'string') {
// // const label = await quickpick.getLabel();
// // assert.equal(label?.slice(1), nameFromField);
// // }
// // }
// }
// await input.cancel();
// }
await input.cancel();
}


/**
* Check if all symbols references are working in Quick Pick command.
*
* @param listOfAvailableSymbols List of expected symbols with line number of occurence.
*/

//upraveny?? funguje ok
// predelat at to neni overkill???
async function gotoSymbolsUsingQuickpickCommand(listOfAvailableSymbols: (string | number)[][], title: string): Promise<void> {
for (const quickpick of quickPicks) {
if (listOfAvailableSymbols && quickpick) {
Expand All @@ -257,7 +205,7 @@ describe('Code navigation', function () {
*
* @param listOfAvailableSymbols List of expected symbols with line number of occurence.
*/
//upraveny?? ok
// predelat at to neni overkill???
async function allSymbolsAreAvailableInOutlineSideBar(listOfAvailableSymbols: (string | number)[][]): Promise<void> {
const actions = await section.getVisibleItems();
for (let i = 0; i < actions.length; i++) {
Expand Down Expand Up @@ -308,7 +256,7 @@ describe('Code navigation', function () {
* @param proposal Required symbol for selction.
*/

// upraveny? ok
// predelat at to neni overkill???
async function selectSymbolFromProposals(proposal: string): Promise<void> {
let input: InputBox | undefined;

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"outDir": "out",
"resolveJsonModule": true,
"strict": false, // true causes like million errors here
"strict": true, // true causes like million errors here
"forceConsistentCasingInFileNames": true
},
"include": [
Expand Down

0 comments on commit f701469

Please sign in to comment.