Merge pull request #3191 from continuedev/tomasz/e2e
Set up e2e tests for gui
This commit is contained in:
commit
7e2dfb9dd8
9 changed files with 1686 additions and 7 deletions
9
.github/workflows/pr_checks.yaml
vendored
9
.github/workflows/pr_checks.yaml
vendored
|
|
@ -88,6 +88,15 @@ jobs:
|
|||
npx tsc --noEmit
|
||||
npm run lint
|
||||
|
||||
- name: Install Xvfb for Linux and run e2e tests
|
||||
run: |
|
||||
sudo apt-get install -y xvfb # Install Xvfb
|
||||
Xvfb :99 & # Start Xvfb
|
||||
export DISPLAY=:99 # Export the display number to the environment
|
||||
cd extensions/vscode
|
||||
npm run package
|
||||
npm run e2e:ci
|
||||
|
||||
- name: core checks
|
||||
run: |
|
||||
cd core
|
||||
|
|
|
|||
8
extensions/vscode/.gitignore
vendored
8
extensions/vscode/.gitignore
vendored
|
|
@ -16,4 +16,10 @@ gui/**
|
|||
.devcontainer
|
||||
.github
|
||||
|
||||
continue_rc_schema.json
|
||||
continue_rc_schema.json
|
||||
|
||||
|
||||
e2e/_output
|
||||
e2e/.test-extensions
|
||||
e2e/storage
|
||||
e2e/vsix
|
||||
|
|
|
|||
86
extensions/vscode/e2e/GUI.test.ts
Normal file
86
extensions/vscode/e2e/GUI.test.ts
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
import {
|
||||
Workbench,
|
||||
EditorView,
|
||||
WebView,
|
||||
By,
|
||||
WebElement,
|
||||
WebDriver,
|
||||
Key,
|
||||
} from "vscode-extension-tester";
|
||||
import { expect } from "chai";
|
||||
|
||||
const switchToReactIframe = async (driver: WebDriver) => {
|
||||
const iframes = await driver.findElements(By.css("iframe"));
|
||||
let continueIFrame: WebElement | undefined = undefined;
|
||||
for (let i = 0; i < iframes.length; i++) {
|
||||
const iframe = iframes[i];
|
||||
const src = await iframe.getAttribute("src");
|
||||
if (src.includes("extensionId=Continue.continue")) {
|
||||
continueIFrame = iframe;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!continueIFrame) {
|
||||
throw new Error("Could not find continue iframe");
|
||||
}
|
||||
|
||||
await driver.switchTo().frame(continueIFrame);
|
||||
|
||||
await new Promise((res) => {
|
||||
setTimeout(res, 500);
|
||||
});
|
||||
|
||||
const reactIFrame = await driver.findElement(By.css("iframe"));
|
||||
|
||||
if (!reactIFrame) {
|
||||
throw new Error("Could not find React iframe");
|
||||
}
|
||||
|
||||
await driver.switchTo().frame(reactIFrame);
|
||||
};
|
||||
|
||||
describe("GUI Test", () => {
|
||||
let view: WebView;
|
||||
let driver: WebDriver;
|
||||
|
||||
before(async function () {
|
||||
this.timeout(10000);
|
||||
|
||||
await new Workbench().executeCommand("continue.focusContinueInput");
|
||||
|
||||
view = new WebView();
|
||||
driver = view.getDriver();
|
||||
|
||||
await switchToReactIframe(driver);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await view.switchBack();
|
||||
await new EditorView().closeAllEditors();
|
||||
});
|
||||
|
||||
it("should display correct panel description", async () => {
|
||||
const description = await view.findWebElement(
|
||||
By.xpath("//*[contains(text(), 'Quickly')]"),
|
||||
);
|
||||
|
||||
expect(await description.getText()).has.string(
|
||||
"Quickly get up and running using our API keys.",
|
||||
);
|
||||
});
|
||||
|
||||
it("should allow typing text in the editor", async () => {
|
||||
const tiptap = await view.findWebElement(By.className("tiptap"));
|
||||
|
||||
await tiptap.sendKeys("Hello world!");
|
||||
|
||||
expect(await tiptap.getText()).has.string("Hello world!");
|
||||
|
||||
// Just to show that we can
|
||||
await tiptap.sendKeys(Key.ENTER);
|
||||
await new Promise((res) => {
|
||||
setTimeout(res, 5000);
|
||||
});
|
||||
}).timeout(6000);
|
||||
});
|
||||
18
extensions/vscode/e2e/get-latest-vsix.sh
Executable file
18
extensions/vscode/e2e/get-latest-vsix.sh
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# echo pwd
|
||||
echo "Current directory: $(pwd)"
|
||||
|
||||
# Find the latest VSIX file in the build directory
|
||||
latest_vsix=$(ls -t ./build/continue-*.vsix | head -n1)
|
||||
|
||||
if [ -z "$latest_vsix" ]; then
|
||||
echo "No VSIX file found in build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create e2e/vsix directory if it doesn't exist
|
||||
mkdir -p "./e2e/vsix"
|
||||
|
||||
# Copy the file to e2e directory with fixed name
|
||||
cp "$latest_vsix" "./e2e/vsix/continue.vsix"
|
||||
16
extensions/vscode/entitlements.plist
Normal file
16
extensions/vscode/entitlements.plist
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-write</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.downloads.read-write</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.documents.read-write</key>
|
||||
<true/>
|
||||
<key>com.apple.security.automation.apple-events</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
1510
extensions/vscode/package-lock.json
generated
1510
extensions/vscode/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "0.9.242",
|
||||
"version": "0.9.244",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
@ -617,12 +617,23 @@
|
|||
"package:pre-release": "node scripts/package.js --pre-release",
|
||||
"build:rust": "cargo-cp-artifact -ac sync sync.node -- cargo build --manifest-path ../../sync/Cargo.toml --message-format=json-render-diagnostics",
|
||||
"build-debug:rust": "npm run build:rust --",
|
||||
"build-release:rust": "npm run build:rust -- --release"
|
||||
"build-release:rust": "npm run build:rust -- --release",
|
||||
"e2e:compile": "tsc -p ./tsconfig.e2e.json",
|
||||
"e2e:create-storage": "mkdir -p ./e2e/storage",
|
||||
"e2e:get-chromedriver": "extest get-chromedriver --storage ./e2e/storage",
|
||||
"e2e:get-vscode": "extest get-vscode --storage ./e2e/storage",
|
||||
"e2e:sign-vscode": "codesign --entitlements entitlements.plist --deep --force -s - './e2e/storage/Visual Studio Code.app'",
|
||||
"e2e:copy-vsix": "chmod +x ./e2e/get-latest-vsix.sh && bash ./e2e/get-latest-vsix.sh",
|
||||
"e2e:install-vsix": "extest install-vsix -f ./e2e/vsix/continue.vsix --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage",
|
||||
"e2e:test": "extest run-tests './e2e/_output/*.test.js' --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage",
|
||||
"e2e:all": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:test",
|
||||
"e2e:ci": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.6.4",
|
||||
"@nestjs/common": "^8.4.7",
|
||||
"@openapitools/openapi-generator-cli": "^2.5.2",
|
||||
"@types/chai": "^5.0.1",
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/follow-redirects": "^1.14.4",
|
||||
|
|
@ -636,6 +647,7 @@
|
|||
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||
"@vscode/vsce": "^2.22.0",
|
||||
"cargo-cp-artifact": "^0.1",
|
||||
"chai": "^4.5.0",
|
||||
"esbuild": "0.17.19",
|
||||
"eslint": "^8.28.0",
|
||||
"glob": "^8.0.3",
|
||||
|
|
@ -645,7 +657,8 @@
|
|||
"rimraf": "^5.0.5",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^4.3.9",
|
||||
"vsce": "^2.15.0"
|
||||
"vsce": "^2.15.0",
|
||||
"vscode-extension-tester": "^8.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
|
|||
8
extensions/vscode/settings.json
Normal file
8
extensions/vscode/settings.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"typescript.updateImportsOnFileMove.enabled": "always",
|
||||
"workbench.editor.enablePreview": true,
|
||||
"git.autoRepositoryDetection": false,
|
||||
"terminal.integrated.sendKeybindingsToShell": true,
|
||||
"workbench.remoteIndicator.showExtensionRecommendations": false,
|
||||
"extensions.ignoreRecommendations": true
|
||||
}
|
||||
19
extensions/vscode/tsconfig.e2e.json
Normal file
19
extensions/vscode/tsconfig.e2e.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"target": "ES2022",
|
||||
"outDir": "e2e/_output",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"rootDir": "e2e",
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
".vscode-test",
|
||||
"e2e/resources/**",
|
||||
".test-extensions"
|
||||
],
|
||||
"include": ["e2e"]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue