Skip to content

Commit b53decc

Browse files
Add pixel threshold to UI tests
1 parent 740d9c9 commit b53decc

File tree

7 files changed

+6
-5
lines changed

7 files changed

+6
-5
lines changed

.github/workflows/ui_notebooks_test.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ jobs:
8686
jq -r 'del(.cells[] | select(.source[] | contains("Create authentication object for user permissions")))' 3_widget_example.ipynb > 3_widget_example.ipynb.tmp && mv 3_widget_example.ipynb.tmp 3_widget_example.ipynb
8787
jq -r 'del(.cells[] | select(.source[] | contains("auth.logout()")))' 3_widget_example.ipynb > 3_widget_example.ipynb.tmp && mv 3_widget_example.ipynb.tmp 3_widget_example.ipynb
8888
# Set explicit namespace as SDK need it (currently) to resolve local queues
89-
sed -i "s|head_memory_limits=2,|head_memory_limits=2, namespace='default',|" 3_widget_example.ipynb
89+
kubectl create namespace "ui-test-namespace"
90+
sed -i "s|head_memory_limits=2,|head_memory_limits=2, namespace='ui-test-namespace',|" 3_widget_example.ipynb
9091
sed -i "s|view_clusters()|view_clusters('default')|" 3_widget_example.ipynb
9192
working-directory: demo-notebooks/guided-demos
9293

ui-tests/tests/widget_notebook_example.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test.describe("Visual Regression", () => {
3030
tmpPath,
3131
}) => {
3232
const notebook = "3_widget_example.ipynb";
33-
const namespace = 'default';
33+
const namespace = 'ui-test-namespace';
3434
await page.notebook.openByPath(`${tmpPath}/${notebook}`);
3535
await page.notebook.activate(notebook);
3636

@@ -60,14 +60,14 @@ test.describe("Visual Regression", () => {
6060
const image = `widgets-cell-${i}.png`;
6161

6262
if (captures[i]) {
63-
expect.soft(captures[i]).toMatchSnapshot(image); // Compare pre-existing capture
63+
expect.soft(captures[i]).toMatchSnapshot(image, { threshold: 0.7}); // Compare pre-existing capture
6464
continue;
6565
}
6666
}
6767

6868
// At this point, all cells have been ran, and their screenshots have been captured.
6969
// We now interact with the widgets in the notebook.
70-
const upDownWidgetCellIndex = 3; // 4 on OpenShift
70+
const upDownWidgetCellIndex = 4; // 4 on OpenShift
7171

7272
await waitForWidget(page, upDownWidgetCellIndex, 'input[type="checkbox"]');
7373
await waitForWidget(page, upDownWidgetCellIndex, 'button:has-text("Cluster Down")');
@@ -122,7 +122,7 @@ test.describe("Visual Regression", () => {
122122
expect(successMessage).not.toBeNull();
123123
});
124124

125-
const viewClustersCellIndex = 4; // 5 on OpenShift
125+
const viewClustersCellIndex = 5; // 5 on OpenShift
126126
await page.notebook.runCell(cellCount - 2, true);
127127

128128
// Wait until the RayCluster status in the table updates to "Ready"
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)