File tree Expand file tree Collapse file tree 11 files changed +136
-28
lines changed
extensions/test-extension Expand file tree Collapse file tree 11 files changed +136
-28
lines changed Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ jobs:
381
381
382
382
- name : Run end-to-end tests
383
383
run : |
384
- ./release-packages/code-server*-linux-amd64/bin/code-server --log trace &
384
+ ./release-packages/code-server*-linux-amd64/bin/code-server --log trace --extensions-dir ./test/e2e/extensions &
385
385
yarn test:e2e
386
386
387
387
- name : Upload test artifacts
Original file line number Diff line number Diff line change @@ -5,15 +5,21 @@ main() {
5
5
cd " $( dirname " $0 " ) /../.."
6
6
source ./ci/lib.sh
7
7
8
- # This installs the dependencies needed for testing
9
- cd test
8
+ pushd test
9
+ echo " Installing dependencies for $PWD "
10
10
yarn
11
- cd ..
11
+ popd
12
12
13
- cd lib/vscode
14
- yarn ${CI+--frozen-lockfile}
13
+ pushd test/e2e/extensions/test-extension
14
+ echo " Installing dependencies for $PWD "
15
+ yarn
16
+ popd
15
17
18
+ pushd lib/vscode
19
+ echo " Installing dependencies for $PWD "
20
+ yarn ${CI+--frozen-lockfile}
16
21
symlink_asar
22
+ popd
17
23
}
18
24
19
25
main " $@ "
Original file line number Diff line number Diff line change @@ -3,10 +3,17 @@ set -euo pipefail
3
3
4
4
main () {
5
5
cd " $( dirname " $0 " ) /../.."
6
- cd test
7
- # We set these environment variables because they're used in the e2e tests
8
- # they don't have to be these values, but these are the defaults
9
- PASSWORD=e45432jklfdsab CODE_SERVER_ADDRESS=http://localhost:8080 yarn playwright test " $@ "
6
+ source ./ci/lib.sh
7
+
8
+ pushd test/e2e/extensions/test-extension
9
+ echo " Building test extension"
10
+ yarn build
11
+ popd
12
+
13
+ pushd test
14
+ echo " Running e2e tests"
15
+ yarn playwright test " $@ "
16
+ popd
10
17
}
11
18
12
19
main " $@ "
Original file line number Diff line number Diff line change 5
5
cd " $( dirname " $0 " ) /../.."
6
6
cd test/unit/test-plugin
7
7
make -s out/index.js
8
+
8
9
# We must keep jest in a sub-directory. See ../../test/package.json for more
9
10
# information. We must also run it from the root otherwise coverage will not
10
11
# include our source files.
Original file line number Diff line number Diff line change
1
+ import { CODE_SERVER_ADDRESS , storageState } from "../utils/constants"
2
+ import { test } from "./baseFixture"
3
+
4
+ test . describe ( "Extensions" , ( ) => {
5
+ test . use ( {
6
+ storageState,
7
+ } )
8
+
9
+ // This will only work if the test extension is loaded into code-server.
10
+ test ( "should have access to VSCODE_PROXY_URI" , async ( { codeServerPage } ) => {
11
+ await codeServerPage . runCommandFromPalette ( "code-server: Get proxy URI" )
12
+
13
+ await codeServerPage . page . isVisible ( `text=${ CODE_SERVER_ADDRESS } /proxy/{port}` )
14
+ } )
15
+ } )
Original file line number Diff line number Diff line change
1
+ /extension.js
Original file line number Diff line number Diff line change
1
+ import * as vscode from "vscode"
2
+
3
+ export function activate ( context : vscode . ExtensionContext ) {
4
+ context . subscriptions . push (
5
+ vscode . commands . registerCommand ( "codeServerTest.proxyUri" , ( ) => {
6
+ if ( process . env . VSCODE_PROXY_URI ) {
7
+ vscode . window . showInformationMessage ( process . env . VSCODE_PROXY_URI )
8
+ } else {
9
+ vscode . window . showErrorMessage ( "No proxy URI was set" )
10
+ }
11
+ } ) ,
12
+ )
13
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " code-server-extension" ,
3
+ "description" : " code-server test extension" ,
4
+ "version" : " 0.0.1" ,
5
+ "publisher" : " cdr" ,
6
+ "activationEvents" : [
7
+ " onCommand:codeServerTest.proxyUri"
8
+ ],
9
+ "engines" : {
10
+ "vscode" : " ^1.56.0"
11
+ },
12
+ "main" : " ./extension.js" ,
13
+ "contributes" : {
14
+ "commands" : [
15
+ {
16
+ "command" : " codeServerTest.proxyUri" ,
17
+ "title" : " Get proxy URI" ,
18
+ "category" : " code-server"
19
+ }
20
+ ]
21
+ },
22
+ "devDependencies" : {
23
+ "@types/vscode" : " ^1.56.0" ,
24
+ "typescript" : " ^4.0.5"
25
+ },
26
+ "scripts" : {
27
+ "build" : " tsc extension.ts"
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "target" : " es2020" ,
4
+ "module" : " commonjs" ,
5
+ "outDir" : " ." ,
6
+ "strict" : true ,
7
+ "baseUrl" : " ./"
8
+ },
9
+ "include" : [" ./extension.ts" ]
10
+ }
Original file line number Diff line number Diff line change
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ " @types/vscode@^1.56.0 " :
6
+ version "1.57.0"
7
+ resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.57.0.tgz#cc648e0573b92f725cd1baf2621f8da9f8bc689f"
8
+ integrity sha512-FeznBFtIDCWRluojTsi9c3LLcCHOXP5etQfBK42+ixo1CoEAchkw39tuui9zomjZuKfUVL33KZUDIwHZ/xvOkQ==
9
+
10
+ typescript@^4.0.5 :
11
+ version "4.3.2"
12
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805"
13
+ integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==
You can’t perform that action at this time.
0 commit comments