Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Going back to the latest stable VS Code version to perform e2e tests #1623

Merged
merged 12 commits into from
Sep 30, 2024
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,19 @@ npm run bundle

The Runme project has several test stages that you can run individually or as a whole:

```sh {"id":"01HF7VQMH8ESX1EFV4PFZ87Q58","name":"test"}
```sh {"id":"01HF7VQMH8ESX1EFV4PFZ87Q58","name":"test","promptEnv":"no"}
export NODE_OPTIONS="--experimental-specifier-resolution=node --max-old-space-size=8192"
npx runme run test:format test:lint test:unit test:e2e
```

```sh {"id":"01J5VPD3TXY1EAZDCXNHN60S77"}
```sh {"id":"01J5VPD3TXY1EAZDCXNHN60S77","promptEnv":"no"}
export NODE_OPTIONS="--experimental-specifier-resolution=node --max-old-space-size=8192"
npx runme run test:format test:lint test:unit
npx runme run test:format test:lint test:unit
```

When testing in CI environment, run:

```sh {"id":"01HF7VQMH8ESX1EFV4PGJBDGG0","name":"test:ci"}
```sh {"id":"01HF7VQMH8ESX1EFV4PGJBDGG0","name":"test:ci","promptEnv":"no"}
export NODE_OPTIONS="--experimental-specifier-resolution=node --max-old-space-size=8192"
npx runme run test:format test:lint test:unit test:e2e:ci
```
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,36 @@
"category": "Runme",
"title": "Click to select your environment",
"shortTitle": "Environments"
},
{
"command": "runme.lifecycleIdentityAll",
"title": "Lifecycle Identity - All",
"category": "Runme",
"description": "Turns on Lifecycle Identity"
},
{
"command": "runme.lifecycleIdentityNone",
"title": "Lifecycle Identity - None",
"category": "Runme",
"description": "Lifecycle Identity - None"
},
{
"command": "runme.lifecycleIdentityAll",
"title": "Lifecycle Identity - All",
"category": "Runme",
"description": "Lifecycle Identity - All"
},
{
"command": "runme.lifecycleIdentityDoc",
"title": "Lifecycle Identity - Document",
"category": "Runme",
"description": "Lifecycle Identity - Document"
},
{
"command": "runme.lifecycleIdentityCell",
"title": "Lifecycle Identity - Cell",
"category": "Runme",
"description": "Lifecycle Identity - Cell"
}
],
"menus": {
Expand Down Expand Up @@ -1180,7 +1210,7 @@
"@wdio/local-runner": "^8.40.5",
"@wdio/mocha-framework": "^8.40.3",
"@wdio/spec-reporter": "^8.40.3",
"chromedriver": "^128.0.3",
"chromedriver": "^129.0.0",
"comment-json": "^4.2.5",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.0.0",
Expand Down
16 changes: 16 additions & 0 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,22 @@ export class RunmeExtension {
openFileAsRunmeNotebook(outputFilePath)
}),

RunmeExtension.registerCommand('runme.lifecycleIdentityNone', () =>
ContextState.addKey(NOTEBOOK_LIFECYCLE_ID, RunmeIdentity.UNSPECIFIED),
),

RunmeExtension.registerCommand('runme.lifecycleIdentityAll', () =>
ContextState.addKey(NOTEBOOK_LIFECYCLE_ID, RunmeIdentity.ALL),
),

RunmeExtension.registerCommand('runme.lifecycleIdentityDoc', () =>
ContextState.addKey(NOTEBOOK_LIFECYCLE_ID, RunmeIdentity.DOCUMENT),
),

RunmeExtension.registerCommand('runme.lifecycleIdentityCell', () =>
ContextState.addKey(NOTEBOOK_LIFECYCLE_ID, RunmeIdentity.CELL),
),

// Register a command to generate completions using foyle
RunmeExtension.registerCommand(
'runme.aiGenerate',
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@wdio/local-runner": "^8.40.2",
"@wdio/mocha-framework": "^8.40.3",
"@wdio/spec-reporter": "^8.27.2",
"chromedriver": "^127.0.2",
"chromedriver": "^129.0.0",
"comment-json": "^4.2.5",
"expect-webdriverio": "^4.15.4",
"runme": "^3.0.1",
Expand Down
17 changes: 4 additions & 13 deletions tests/e2e/specs/identity/identity.empty-file.all.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { Key } from 'webdriverio'

import {
assertDocumentContainsSpinner,
revertChanges,
saveFile,
updateLifecycleIdentitySetting,
} from '../../helpers/index.js'

async function reloadWindow() {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Developer: Reload Window')
}
import { assertDocumentContainsSpinner, revertChanges, saveFile } from '../../helpers/index.js'

async function removeAllNotifications() {
const workbench = await browser.getWorkbench()
Expand All @@ -24,6 +14,9 @@ describe('Test suite: Empty file with setting All (1)', async () => {
})

it('open identity markdown file', async () => {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Runme: Lifecycle Identity - All')

await browser.executeWorkbench(async (vscode) => {
const doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(`${vscode.workspace.rootPath}/tests/fixtures/identity/empty-file.md`),
Expand All @@ -45,8 +38,6 @@ describe('Test suite: Empty file with setting All (1)', async () => {
return `${vscode.workspace.rootPath}${documentPath}`
}, '/tests/fixtures/identity/empty-file.md')

await updateLifecycleIdentitySetting(1)
await reloadWindow()
await saveFile(browser)
await assertDocumentContainsSpinner(absDocPath, '')
})
Expand Down
17 changes: 4 additions & 13 deletions tests/e2e/specs/identity/identity.empty-file.cell.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { Key } from 'webdriverio'

import {
assertDocumentContainsSpinner,
revertChanges,
saveFile,
updateLifecycleIdentitySetting,
} from '../../helpers/index.js'

async function reloadWindow() {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Developer: Reload Window')
}
import { assertDocumentContainsSpinner, revertChanges, saveFile } from '../../helpers/index.js'

async function removeAllNotifications() {
const workbench = await browser.getWorkbench()
Expand All @@ -23,6 +13,9 @@ describe('Test suite: Empty file with setting Cell (3)', async () => {
await removeAllNotifications()
})
it('open identity markdown file', async () => {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Runme: Lifecycle Identity - Cell')

await browser.executeWorkbench(async (vscode) => {
const doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(`${vscode.workspace.rootPath}/tests/fixtures/identity/empty-file.md`),
Expand All @@ -44,8 +37,6 @@ describe('Test suite: Empty file with setting Cell (3)', async () => {
return `${vscode.workspace.rootPath}${documentPath}`
}, '/tests/fixtures/identity/empty-file.md')

await updateLifecycleIdentitySetting(3)
await reloadWindow()
await saveFile(browser)
await assertDocumentContainsSpinner(absDocPath, '')
})
Expand Down
17 changes: 4 additions & 13 deletions tests/e2e/specs/identity/identity.empty-file.document.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { Key } from 'webdriverio'

import {
assertDocumentContainsSpinner,
revertChanges,
saveFile,
updateLifecycleIdentitySetting,
} from '../../helpers/index.js'

async function reloadWindow() {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Developer: Reload Window')
}
import { assertDocumentContainsSpinner, revertChanges, saveFile } from '../../helpers/index.js'

async function removeAllNotifications() {
const workbench = await browser.getWorkbench()
Expand All @@ -24,6 +14,9 @@ describe('Test suite: Empty file with setting Document (2)', async () => {
})

it('open identity markdown file', async () => {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Runme: Lifecycle Identity - Doc')

await browser.executeWorkbench(async (vscode) => {
const doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(`${vscode.workspace.rootPath}/tests/fixtures/identity/empty-file.md`),
Expand All @@ -45,8 +38,6 @@ describe('Test suite: Empty file with setting Document (2)', async () => {
return `${vscode.workspace.rootPath}${documentPath}`
}, '/tests/fixtures/identity/empty-file.md')

await updateLifecycleIdentitySetting(2)
await reloadWindow()
await saveFile(browser)
await assertDocumentContainsSpinner(absDocPath, '')
})
Expand Down
17 changes: 4 additions & 13 deletions tests/e2e/specs/identity/identity.empty-file.none.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { Key } from 'webdriverio'

import {
assertDocumentContainsSpinner,
revertChanges,
saveFile,
updateLifecycleIdentitySetting,
} from '../../helpers/index.js'

async function reloadWindow() {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Developer: Reload Window')
}
import { assertDocumentContainsSpinner, revertChanges, saveFile } from '../../helpers/index.js'

async function removeAllNotifications() {
const workbench = await browser.getWorkbench()
Expand All @@ -24,6 +14,9 @@ describe('Test suite: Empty file with setting None (0)', async () => {
})

it('open identity markdown file', async () => {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Runme: Lifecycle Identity - None')

await browser.executeWorkbench(async (vscode) => {
const doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(`${vscode.workspace.rootPath}/tests/fixtures/identity/empty-file.md`),
Expand All @@ -45,8 +38,6 @@ describe('Test suite: Empty file with setting None (0)', async () => {
return `${vscode.workspace.rootPath}${documentPath}`
}, '/tests/fixtures/identity/empty-file.md')

await updateLifecycleIdentitySetting(0)
await reloadWindow()
await saveFile(browser)
await assertDocumentContainsSpinner(absDocPath, '', true)
})
Expand Down
20 changes: 6 additions & 14 deletions tests/e2e/specs/identity/identity.existent-cell.all.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import { Key } from 'webdriverio'

import { RunmeNotebook } from '../../pageobjects/notebook.page.js'
import {
assertDocumentContainsSpinner,
revertChanges,
saveFile,
updateLifecycleIdentitySetting,
} from '../../helpers/index.js'

async function reloadWindow() {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Developer: Reload Window')
}
import { assertDocumentContainsSpinner, revertChanges, saveFile } from '../../helpers/index.js'

async function removeAllNotifications() {
const workbench = await browser.getWorkbench()
Expand All @@ -25,7 +15,11 @@ describe('Test suite: Cell with existent identity and setting All (1)', async ()
})

const notebook = new RunmeNotebook()

it('open identity markdown file', async () => {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Runme: Lifecycle Identity - All')

await browser.executeWorkbench(async (vscode) => {
const doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(`${vscode.workspace.rootPath}/tests/fixtures/identity/existent-cell-id.md`),
Expand All @@ -47,10 +41,8 @@ describe('Test suite: Cell with existent identity and setting All (1)', async ()
return `${vscode.workspace.rootPath}${documentPath}`
}, '/tests/fixtures/identity/existent-cell-id.md')

await updateLifecycleIdentitySetting(1)
await reloadWindow()
await notebook.focusDocument()
const workbench = await browser.getWorkbench()
await notebook.focusDocument()
await workbench.executeCommand('Notebook: Focus First Cell')
await browser.keys([Key.Enter])
const cell = await notebook.getCell('console.log("Hello via Shebang")')
Expand Down
17 changes: 4 additions & 13 deletions tests/e2e/specs/identity/identity.existent-cell.cell.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import { Key } from 'webdriverio'

import { RunmeNotebook } from '../../pageobjects/notebook.page.js'
import {
assertDocumentContainsSpinner,
revertChanges,
saveFile,
updateLifecycleIdentitySetting,
} from '../../helpers/index.js'

async function reloadWindow() {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Developer: Reload Window')
}
import { assertDocumentContainsSpinner, revertChanges, saveFile } from '../../helpers/index.js'

async function removeAllNotifications() {
const workbench = await browser.getWorkbench()
Expand All @@ -26,6 +16,9 @@ describe('Test suite: Cell with existent identity and setting cell only (3)', as

const notebook = new RunmeNotebook()
it('open identity markdown file', async () => {
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Runme: Lifecycle Identity - Cell')

await browser.executeWorkbench(async (vscode) => {
const doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(`${vscode.workspace.rootPath}/tests/fixtures/identity/existent-cell-id.md`),
Expand All @@ -47,8 +40,6 @@ describe('Test suite: Cell with existent identity and setting cell only (3)', as
return `${vscode.workspace.rootPath}${documentPath}`
}, '/tests/fixtures/identity/existent-cell-id.md')

await updateLifecycleIdentitySetting(3)
await reloadWindow()
await notebook.focusDocument()
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Notebook: Focus First Cell')
Expand Down
Loading