Skip to content

Commit

Permalink
Merge branch 'main' into add-setup-dvc-section
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 authored Apr 11, 2023
2 parents 395f31f + 239a1fb commit 3eaf979
Show file tree
Hide file tree
Showing 8 changed files with 514 additions and 482 deletions.
2 changes: 1 addition & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@
"vscode-languageclient": "8.1.0"
},
"devDependencies": {
"@swc/core": "1.3.44",
"@swc/core": "1.3.45",
"@swc/jest": "0.2.24",
"@types/chai": "4.3.4",
"@types/chai-as-promised": "7.1.5",
Expand Down
60 changes: 47 additions & 13 deletions extension/src/test/e2e/extension.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { join } from 'path'
import {
closeAllEditors,
createCustomPlot,
deleteAllExistingExperiments,
deleteCustomPlot,
dismissAllNotifications,
expectAllPlotsToBeFilled,
findDecorationTooltip,
findScmTreeItems,
getDVCActivityBarIcon,
getLabel,
runModifiedExperiment,
waitForAllPlotsToRender,
waitForDvcToFinish,
waitForViewContainerToLoad
} from './util.js'
Expand All @@ -21,8 +25,14 @@ before('should finish loading the extension', async function () {
return dismissAllNotifications()
})

after(function () {
after(async function () {
this.timeout(60000)

try {
await deleteCustomPlot()
} catch {}
await dismissAllNotifications()

return waitForDvcToFinish()
})

Expand Down Expand Up @@ -130,32 +140,56 @@ describe('Experiments Table Webview', function () {
})

describe('Plots Webview', function () {
const webview = new PlotsWebview('plots')

// eslint-disable-next-line jest/expect-expect
it('should load the plots webview with non-empty plots', async function () {
this.timeout(60000)
const webview = new PlotsWebview('plots')
const workbench = await browser.getWorkbench()
await workbench.openCommandPrompt()
await browser.keys([...'DVC: Show Plots', 'ArrowDown', 'Enter'])

await waitForDvcToFinish()
await webview.focus()

await waitForAllPlotsToRender(webview, 5)

await expectAllPlotsToBeFilled(webview)

await webview.unfocus()
await closeAllEditors()
})

// eslint-disable-next-line jest/expect-expect
it('should create and delete a custom plot', async function () {
this.timeout(60000)
await createCustomPlot()
const workbench = await browser.getWorkbench()
await workbench.openCommandPrompt()
await workbench.executeCommand('DVC: Show Plots')

await waitForDvcToFinish()
await webview.focus()

await browser.waitUntil(
async () => {
return (await webview.vegaVisualization$$.length) === 5
},
{ timeout: 30000 }
)
await waitForAllPlotsToRender(webview, 6)

await expectAllPlotsToBeFilled(webview)

await webview.unfocus()
await closeAllEditors()

const plots = await webview.vegaVisualization$$
await deleteCustomPlot()
await workbench.executeCommand('DVC: Show Plots')

for (const plot of plots) {
const plotNotEmpty = await webview.plotNotEmpty(plot)
expect(plotNotEmpty).toBe(true)
}
await waitForDvcToFinish()
await webview.focus()

await waitForAllPlotsToRender(webview, 5)

await expectAllPlotsToBeFilled(webview)

await webview.unfocus()
await closeAllEditors()
})
})

Expand Down
41 changes: 41 additions & 0 deletions extension/src/test/e2e/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Key } from 'webdriverio'
import { ViewControl } from 'wdio-vscode-service'
import { PlotsWebview } from './pageObjects/plotsWebview'

const findProgressBars = () => $$('.monaco-progress-container')

Expand Down Expand Up @@ -153,6 +154,46 @@ export const closeAllEditors = async (): Promise<void> => {
return editorView.closeAllEditors()
}

export const createCustomPlot = async (): Promise<void> => {
const workbench = await browser.getWorkbench()
const addCustomPlot = await workbench.executeCommand('DVC: Add Custom Plot')
await browser.waitUntil(() => addCustomPlot.elem.isDisplayed())
await browser.keys('Enter')
await browser.waitUntil(() => addCustomPlot.elem.isDisplayed())
return browser.keys('Enter')
}

export const deleteCustomPlot = async (): Promise<void> => {
const workbench = await browser.getWorkbench()
const removeCustomPlot = await workbench.executeCommand(
'DVC: Remove Custom Plot(s)'
)
await browser.waitUntil(() => removeCustomPlot.elem.isDisplayed())
await browser.keys('ArrowDown')
await browser.keys('Space')
return browser.keys('Enter')
}

export const waitForAllPlotsToRender = (
webview: PlotsWebview,
plotsAmount: number
): Promise<true | void> => {
return browser.waitUntil(
async () => {
return (await webview.vegaVisualization$$.length) === plotsAmount
},
{ timeout: 30000 }
)
}

export const expectAllPlotsToBeFilled = async (webview: PlotsWebview) => {
const plots = await webview.vegaVisualization$$
for (const plot of plots) {
const plotNotEmpty = await webview.plotNotEmpty(plot)
expect(plotNotEmpty).toBe(true)
}
}

export const findScmTreeItems = async () => {
const workspace = await browser.getWorkbench()
const activityBar = workspace.getActivityBar()
Expand Down
2 changes: 1 addition & 1 deletion languageServer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test": "jest --collect-coverage"
},
"devDependencies": {
"@swc/core": "1.3.44",
"@swc/core": "1.3.45",
"@swc/jest": "0.2.24",
"@types/jest": "29.5.0",
"clean-webpack-plugin": "4.0.0",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
"svgr": "yarn workspace dvc-vscode-webview svgr"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "5.57.0",
"@typescript-eslint/parser": "5.57.0",
"@typescript-eslint/eslint-plugin": "5.57.1",
"@typescript-eslint/parser": "5.57.1",
"@vscode/codicons": "0.0.32",
"eslint": "8.37.0",
"eslint-config-prettier": "8.8.0",
"eslint-config-prettier-standard": "4.0.1",
"eslint-config-standard": "17.0.0",
"eslint-plugin-check-file": "2.1.0",
"eslint-plugin-check-file": "2.2.0",
"eslint-plugin-etc": "2.0.2",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jest": "27.2.1",
Expand Down Expand Up @@ -69,7 +69,7 @@
},
"resolutions": {
"decode-uri-component": "0.2.2",
"@types/react": "18.0.31",
"@types/react": "18.0.33",
"**/recursive-readdir/minimatch": "6.2.0",
"fastify": "3.29.5",
"json5": "2.2.3",
Expand Down
8 changes: 4 additions & 4 deletions webview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"@reduxjs/toolkit": "1.9.3",
"@tanstack/react-table": "8.8.4",
"@tanstack/react-table": "8.8.5",
"@tippyjs/react": "4.2.6",
"@vscode/webview-ui-toolkit": "1.2.2",
"classnames": "2.3.2",
Expand All @@ -47,14 +47,14 @@
"@storybook/react": "6.5.16",
"@storybook/testing-library": "0.0.13",
"@svgr/cli": "7.0.0",
"@swc/core": "1.3.44",
"@swc/core": "1.3.45",
"@swc/jest": "0.2.24",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "14.0.0",
"@types/jest": "29.5.0",
"@types/jsdom": "21.1.1",
"@types/node": "16.x",
"@types/react": "18.0.31",
"@types/react": "18.0.33",
"@types/react-dom": "18.0.11",
"@types/react-measure": "2.0.8",
"@types/react-virtualized": "9.21.21",
Expand All @@ -78,7 +78,7 @@
"ts-loader": "9.4.2",
"webpack": "5.77.0",
"webpack-cli": "5.0.1",
"webpack-dev-server": "4.13.1"
"webpack-dev-server": "4.13.2"
},
"svgr": {
"typescript": true,
Expand Down
Loading

0 comments on commit 3eaf979

Please sign in to comment.