From f7014692cf19e19da6ef961845fe124c5d176c44 Mon Sep 17 00:00:00 2001 From: Filip Pospisil Date: Thu, 29 Feb 2024 08:59:22 +0100 Subject: [PATCH] strict on and local test passing --- src/ui-test/tests/code.navigation.test.ts | 86 +++++------------------ tsconfig.json | 2 +- 2 files changed, 18 insertions(+), 70 deletions(-) diff --git a/src/ui-test/tests/code.navigation.test.ts b/src/ui-test/tests/code.navigation.test.ts index 85315c124..dc0f25968 100644 --- a/src/ui-test/tests/code.navigation.test.ts +++ b/src/ui-test/tests/code.navigation.test.ts @@ -149,81 +149,29 @@ describe('Code navigation', function () { */ // tohle funguje jenom orio - // async function allSymbolsAreAvailableInQuickpickCommand(listOfAvailableSymbols: (string | number)[][]): Promise { - // 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 { - 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. @@ -231,7 +179,7 @@ describe('Code navigation', function () { * @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 { for (const quickpick of quickPicks) { if (listOfAvailableSymbols && quickpick) { @@ -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 { const actions = await section.getVisibleItems(); for (let i = 0; i < actions.length; i++) { @@ -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 { let input: InputBox | undefined; diff --git a/tsconfig.json b/tsconfig.json index 3ed80f662..c13aefa30 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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": [