You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you click on it, you should see the following view:
49
+
50
+

51
+
52
+
## Debugging webviews
53
+
54
+
The first thing to note about webviews is that breakpoints setin VS Code in the webview code won't work.
55
+
This is because the extension code and the webview JavaScript are run in separate processes.
56
+
Any code in a `.tsx` file or under `./src/webview/common` is webview code.
57
+
Note that not all the code under `./src/webview` is webview code;
58
+
some of it is code used on the extension side in order to load and interact with the webview.
59
+
60
+
In order watch or inspect values in webview code,
61
+
it's easiest to use `console.log()` statements.
62
+
The output from these statements can be inspected by opening Chrome debug tools
63
+
(by running the command"Developer: Toggle Developer Tools"),
64
+
then selecting the "Console" tab.
65
+
66
+

67
+
68
+
The Chrome debug tools can also be used to help with writing the layout of webviews.
69
+
In order to inspect the layout, switch to the "Elements" view.
70
+
Then, you will need to walk through the tree in order to locate the webview HTML.
71
+
It should be nested in two `<iframe>` elements (in order to sandbox it from the rest of VS Code).
72
+
It will look something like this:
73
+
74
+

75
+
76
+
Then, you can modify the CSS and attributes of elements in order to experiment with the layout of the webview.
77
+
78
+
## Running the tests
79
+
80
+
### Running the unit test suite
81
+
82
+
You don't need to be connected to a cluster in order for the tests to work properly.
83
+
In order to run the unit test suite, run:
84
+
```
85
+
npm test
86
+
```
87
+
88
+
In order to run the UI test suite and collect test coverage information, run:
89
+
90
+
```
91
+
npm run test:coverage
92
+
```
93
+
94
+
### Running the UI tests
95
+
96
+
There are two sets of UI tests: ones that don't require a connection to a cluster,
97
+
and ones that do require a connection to a cluster.
98
+
99
+
In order to run the UI tests that don't require a cluster,
100
+
make sure that you aren't logged into any cluster by running `oc logout`,
101
+
then run:
102
+
103
+
```
104
+
npm run public-ui-test
105
+
```
106
+
107
+
In order to run the cluster-dependant UI tests,
108
+
you need an OpenShift cluster where you can create and delete projects.
109
+
This means that OpenShift Developer Sandbox won't work.
110
+
`minikube`, `kind`, and MicroShift clusters also won't work,
111
+
since the UI tests some OpenShift-specific features,
112
+
such as logging in to the cluster.
113
+
The tests will create and delete resources on the cluster,
114
+
so please make sure nothing important is running on the cluster.
115
+
116
+
Then, you need to configure the following environment variables to point to your cluster:
117
+
- `CLUSTER_URL`: the URL pointing to the API of the cluster, defaults to `https://api.crc.testing:6443` (the default `crc` address)
118
+
- `CLUSTER_USER`: the username to use to login to the cluster, defaults to `developer`
119
+
- `CLUSTER_PASSWORD`: the password to use to login to the cluster, default to `developer`
120
+
121
+
Note that if you are running `crc`, the defaults should work.
122
+
123
+
Once, you've configured your cluster, run:
124
+
125
+
```
126
+
npm run cluster-ui-test
127
+
```
128
+
129
+
### Running the Integration Test Suite
49
130
50
131
In order to run the integration test suite, you need access to an OpenShift cluster
51
132
where you can create and delete projects.
@@ -56,7 +137,7 @@ The tests will create and delete resources on the cluster,
56
137
so please make sure nothing important is running on the cluster.
57
138
58
139
First, set the following environment variables to point the tests to your cluster:
59
-
- `CLUSTER_URL`: the URL pointing to the API of the cluster, defaults to `https://192.168.130.11:6443` (the default `crc` IP address)
140
+
- `CLUSTER_URL`: the URL pointing to the API of the cluster, defaults to `https://api.crc.testing:6443` (the default `crc` IP address)
60
141
- `CLUSTER_USER`: the username to use to login to the cluster, defaults to `developer`
61
142
- `CLUSTER_PASSWORD`: the password to use to login to the cluster, default to `developer`
0 commit comments