From adb9d7cac993cb97a505625226614b7c15f607f3 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 15:53:36 -0800 Subject: [PATCH 1/8] ci: cache vscode and chromedriver --- .github/workflows/pr_checks.yaml | 25 ++++++++++++++++++++++++- extensions/vscode/package.json | 3 ++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 660960077..25f11a950 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -202,14 +202,35 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" + - uses: actions/cache@v4 + id: vscode-node-modules-cache with: path: extensions/vscode/node_modules key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} + - uses: actions/cache@v4 + id: core-node-modules-cache with: path: core/node_modules key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} + + - uses: actions/cache@v4 + id: chromedriver-cache + with: + path: ~/.cache/chromedriver + key: ${{ runner.os }}-chromedriver-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - uses: actions/cache@v4 + id: vscode-cache + with: + path: ~/.vscode-test + key: ${{ runner.os }}-vscode-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Download Dependencies if Cache Miss + if: steps.chromedriver-cache.outputs.cache-hit != 'true' || steps.vscode-cache.outputs.cache-hit != 'true' + run: npm run e2e:ci:download + - name: Set up SSH env: SSH_KEY: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} @@ -220,6 +241,7 @@ jobs: chmod 600 ~/.ssh/id_rsa ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config + - name: Install Xvfb for Linux and run e2e tests run: | sudo apt-get install -y xvfb # Install Xvfb @@ -227,7 +249,8 @@ jobs: export DISPLAY=:99 # Export the display number to the environment cd extensions/vscode npm run package - npm run e2e:ci + npm run e2e:ci:run + - name: Upload e2e test screenshots if: failure() uses: actions/upload-artifact@v4 diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index ba3b4e2e2..9aa7c22ae 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -633,7 +633,8 @@ "e2e:clean": "rm -rf ./e2e/_output", "e2e:all": "npm run e2e:build && 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:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:quick": "npm run e2e:compile && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", - "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:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test" + "e2e:ci:download": "npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode", + "e2e:ci:run": "npm run e2e:compile && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test" }, "devDependencies": { "@biomejs/biome": "1.6.4", From 0d88b8f379d161962a72626fe2af583cce0f3fe0 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 16:20:02 -0800 Subject: [PATCH 2/8] fix: missing cd --- .github/workflows/pr_checks.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 25f11a950..31d18a1b4 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -229,7 +229,9 @@ jobs: - name: Download Dependencies if Cache Miss if: steps.chromedriver-cache.outputs.cache-hit != 'true' || steps.vscode-cache.outputs.cache-hit != 'true' - run: npm run e2e:ci:download + run: | + cd extensions/vscode + npm run e2e:ci:download - name: Set up SSH env: From 368d264d221793b7f2439678cef9b8b032135529 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 16:34:01 -0800 Subject: [PATCH 3/8] fix: cache --- .github/workflows/pr_checks.yaml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 31d18a1b4..21e043c7a 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -216,19 +216,13 @@ jobs: key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - uses: actions/cache@v4 - id: chromedriver-cache + id: storage-cache with: - path: ~/.cache/chromedriver - key: ${{ runner.os }}-chromedriver-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: vscode-cache - with: - path: ~/.vscode-test + path: extensions/vscode/e2e/storage key: ${{ runner.os }}-vscode-${{ hashFiles('extensions/vscode/package-lock.json') }} - name: Download Dependencies if Cache Miss - if: steps.chromedriver-cache.outputs.cache-hit != 'true' || steps.vscode-cache.outputs.cache-hit != 'true' + if: steps.storage.outputs.cache-hit != 'true' run: | cd extensions/vscode npm run e2e:ci:download From a1d7c0e561579f81c871d8d6ffcb9c73fd9ab827 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 16:46:15 -0800 Subject: [PATCH 4/8] ci: test --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 9aa7c22ae..ced753f29 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -629,7 +629,7 @@ "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:install-extensions": "extest install-from-marketplace ms-vscode-remote.remote-ssh --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-containers --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-wsl --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", - "e2e:test": "extest run-tests './e2e/_output/tests/*.test.js' --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", + "e2e:test": "extest run-tests './e2e/_output/tests/GUI.test.js' --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", "e2e:clean": "rm -rf ./e2e/_output", "e2e:all": "npm run e2e:build && 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:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:quick": "npm run e2e:compile && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", From 4d50da0f7aa71656de31f84ba8f5ca44e2c96736 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 16:53:23 -0800 Subject: [PATCH 5/8] ci: update cache --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 21e043c7a..a61552cf7 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -219,7 +219,7 @@ jobs: id: storage-cache with: path: extensions/vscode/e2e/storage - key: ${{ runner.os }}-vscode-${{ hashFiles('extensions/vscode/package-lock.json') }} + key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} - name: Download Dependencies if Cache Miss if: steps.storage.outputs.cache-hit != 'true' From 1fd48c7a6fc225ec6cfc2fff928b0ef2ec56a0c4 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 17:10:18 -0800 Subject: [PATCH 6/8] ci: fix cache id --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index a61552cf7..a9546e849 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -222,7 +222,7 @@ jobs: key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} - name: Download Dependencies if Cache Miss - if: steps.storage.outputs.cache-hit != 'true' + if: steps.storage-cache.outputs.cache-hit != 'true' run: | cd extensions/vscode npm run e2e:ci:download From 0b0cd213238de19fd0cdc521ef911c4fee8b3ef9 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 17:17:01 -0800 Subject: [PATCH 7/8] ci: restore all tests --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index ced753f29..9aa7c22ae 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -629,7 +629,7 @@ "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:install-extensions": "extest install-from-marketplace ms-vscode-remote.remote-ssh --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-containers --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-wsl --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", - "e2e:test": "extest run-tests './e2e/_output/tests/GUI.test.js' --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", + "e2e:test": "extest run-tests './e2e/_output/tests/*.test.js' --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", "e2e:clean": "rm -rf ./e2e/_output", "e2e:all": "npm run e2e:build && 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:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:quick": "npm run e2e:compile && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", From 8d3aac314ef68fe8d99b7ce87603c3c2d3dc580f Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 17:28:12 -0800 Subject: [PATCH 8/8] ci: fix flaky ssh test --- extensions/vscode/e2e/tests/SSH.test.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/extensions/vscode/e2e/tests/SSH.test.ts b/extensions/vscode/e2e/tests/SSH.test.ts index 261f9ab90..664776a9c 100644 --- a/extensions/vscode/e2e/tests/SSH.test.ts +++ b/extensions/vscode/e2e/tests/SSH.test.ts @@ -13,11 +13,7 @@ import { SSHSelectors } from "../selectors/SSH.selectors"; import { AutocompleteActions } from "../actions/Autocomplete.actions"; describe("SSH", function () { - this.retries(2); - - beforeEach(async function () { - this.timeout(DEFAULT_TIMEOUT.XL); - + it("Should display completions", async () => { await TestUtils.waitForSuccess(async () => { await new Workbench().executeCommand( "Remote-SSH: Connect Current Window to Host...", @@ -32,13 +28,6 @@ describe("SSH", function () { DEFAULT_TIMEOUT.XL, ); - // await TestUtils.waitForSuccess(async () => { - // await new Workbench().executeCommand("File: Open Folder..."); - // const inputBox = await InputBox.create(DEFAULT_TIMEOUT.MD); - // await inputBox.setText("/home/ec2-user/test-folder"); - // await inputBox.sendKeys(Key.ENTER); - // }); - await TestUtils.waitForSuccess(async () => { await new Workbench().executeCommand("File: Open File..."); const inputBox = await InputBox.create(DEFAULT_TIMEOUT.MD); @@ -46,9 +35,7 @@ describe("SSH", function () { await inputBox.selectQuickPick("main.py"); await inputBox.sendKeys(Key.ENTER); }, DEFAULT_TIMEOUT.XL); - }); - it("Should display completions", async () => { const editor = await TestUtils.waitForSuccess( async () => (await new EditorView().openEditor("main.py")) as TextEditor, ); @@ -57,5 +44,7 @@ describe("SSH", function () { await editor.clearText(); await AutocompleteActions.testCompletions(editor); await editor.setText(text); - }).timeout(DEFAULT_TIMEOUT.XL); + }) + .timeout(DEFAULT_TIMEOUT.XL) + .retries(2); });