Skip to content

Commit d2de2e1

Browse files
authored
CI fix for Code generator (#283)
* Fix tests for CI * Update ci.yml * Add some test fixes * Revert "Add some test fixes" This reverts commit 577b083. * Changed tests * Revert "Changed tests" This reverts commit 204adcf. * Last try to fix flaky tests * Fix tests * fix tests * Changed tests * Add test fix for vis-gans * fix tests * changed the file * fix tests * check the test * changed the vis-dcgan tests * fixed tests * revert ci.yaml changes * Chages in tests * Added 10 retries for each test to fix CI * Revert "Added 10 retries for each test to fix CI" This reverts commit 621e2af. * Revert "Chages in tests" This reverts commit e1e7f03. * changed tests * 2 catch calls only for dealing with failing waitForDownload event * Adding click on code button line in catch calls for failing tests * Make catch calls in test functions async * fix fmt * Fix await calls * Change the formatting of the .catch function in tests * Revert "2 catch calls only for dealing with failing waitForDownload event" Also made the calls 3 and changed the wait time to 1000ms This reverts commit 4d81f52. * Added code button click condition for the .catch calls * Wait time to 3000ms * removed .catch functions * Changed the click button to hover option in the Code option * fmt fix * fix tests by reverting changes to 00cd4c4 * changed the click to hover * Added hover for the wget text box in tests * fix fmt * Fix the tests by adding 2nd catch method * make .catch functions sync for tests * fix tests for now with e1e7f03 commit * Test only one suit (to decrease the time in CI) * Revert "Test only one suit (to decrease the time in CI)" This reverts commit 8629ad3. * Fix tests like before * Add comments for CI changes for now * fix typo
1 parent 8286377 commit d2de2e1

File tree

4 files changed

+205
-59
lines changed

4 files changed

+205
-59
lines changed

__tests__/text-classification.spec.js

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,25 @@ test('text classification simple', async () => {
3232
await page.click('text=Loggers')
3333
await page.click('text=config.yaml')
3434

35-
await page.getByRole('button', { name: 'Code' }).click()
35+
// TODO: simplify the downloadPromise calls
36+
// Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button
3637
const downloadPromise = await page
3738
.waitForEvent('download', { timeout: 2000 })
3839
.catch(() => {
40+
page.getByRole('button', { name: 'Code' }).click()
3941
page.getByRole('button', { name: 'Download Zip' }).click()
40-
return page.waitForEvent('download')
42+
return page.waitForEvent('download', { timeout: 2000 })
43+
})
44+
.catch(() => {
45+
// these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests
46+
page.getByRole('button', { name: 'Code' }).click()
47+
page.getByRole('button', { name: 'Download Zip' }).click()
48+
return page.waitForEvent('download', { timeout: 2000 })
49+
})
50+
.catch(() => {
51+
page.getByRole('button', { name: 'Code' }).click()
52+
page.getByRole('button', { name: 'Download Zip' }).click()
53+
return page.waitForEvent('download', { timeout: 2000 })
4154
})
4255

4356
await downloadPromise.saveAs('./dist-tests/text-classification-simple.zip')
@@ -88,12 +101,22 @@ test('text classification all', async () => {
88101
await page.click('text=Loggers')
89102
await page.click('text=config.yaml')
90103

91-
await page.getByRole('button', { name: 'Code' }).click()
92104
const downloadPromise = await page
93105
.waitForEvent('download', { timeout: 2000 })
94106
.catch(() => {
107+
page.getByRole('button', { name: 'Code' }).click()
95108
page.getByRole('button', { name: 'Download Zip' }).click()
96-
return page.waitForEvent('download')
109+
return page.waitForEvent('download', { timeout: 2000 })
110+
})
111+
.catch(() => {
112+
page.getByRole('button', { name: 'Code' }).click()
113+
page.getByRole('button', { name: 'Download Zip' }).click()
114+
return page.waitForEvent('download', { timeout: 2000 })
115+
})
116+
.catch(() => {
117+
page.getByRole('button', { name: 'Code' }).click()
118+
page.getByRole('button', { name: 'Download Zip' }).click()
119+
return page.waitForEvent('download', { timeout: 2000 })
97120
})
98121
await downloadPromise.saveAs('./dist-tests/text-classification-all.zip')
99122
})
@@ -112,14 +135,24 @@ test('text classification launch', async () => {
112135
await page.click('text=Loggers')
113136
await page.click('text=config.yaml')
114137

115-
await page.getByRole('button', { name: 'Code' }).click()
116-
await page.getByRole('button', { name: 'Download Zip' }).click()
117138
const downloadPromise = await page
118139
.waitForEvent('download', { timeout: 2000 })
119140
.catch(() => {
141+
page.getByRole('button', { name: 'Code' }).click()
120142
page.getByRole('button', { name: 'Download Zip' }).click()
121-
return page.waitForEvent('download')
143+
return page.waitForEvent('download', { timeout: 2000 })
122144
})
145+
.catch(() => {
146+
page.getByRole('button', { name: 'Code' }).click()
147+
page.getByRole('button', { name: 'Download Zip' }).click()
148+
return page.waitForEvent('download', { timeout: 2000 })
149+
})
150+
.catch(() => {
151+
page.getByRole('button', { name: 'Code' }).click()
152+
page.getByRole('button', { name: 'Download Zip' }).click()
153+
return page.waitForEvent('download', { timeout: 2000 })
154+
})
155+
123156
await downloadPromise.saveAs('./dist-tests/text-classification-launch.zip')
124157
})
125158

@@ -138,13 +171,22 @@ test('text classification spawn', async () => {
138171
await page.click('text=Loggers')
139172
await page.click('text=config.yaml')
140173

141-
await page.getByRole('button', { name: 'Code' }).click()
142-
await page.getByRole('button', { name: 'Download Zip' }).click()
143174
const downloadPromise = await page
144175
.waitForEvent('download', { timeout: 2000 })
145176
.catch(() => {
177+
page.getByRole('button', { name: 'Code' }).click()
178+
page.getByRole('button', { name: 'Download Zip' }).click()
179+
return page.waitForEvent('download', { timeout: 2000 })
180+
})
181+
.catch(() => {
182+
page.getByRole('button', { name: 'Code' }).click()
183+
page.getByRole('button', { name: 'Download Zip' }).click()
184+
return page.waitForEvent('download', { timeout: 2000 })
185+
})
186+
.catch(() => {
187+
page.getByRole('button', { name: 'Code' }).click()
146188
page.getByRole('button', { name: 'Download Zip' }).click()
147-
return page.waitForEvent('download')
189+
return page.waitForEvent('download', { timeout: 2000 })
148190
})
149191
await downloadPromise.saveAs('./dist-tests/text-classification-spawn.zip')
150192
})

__tests__/vision-classification.spec.js

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,25 @@ test('vision classification simple', async () => {
3232
await page.click('text=Loggers')
3333
await page.click('text=config.yaml')
3434

35-
await page.getByRole('button', { name: 'Code' }).click()
36-
await page.getByRole('button', { name: 'Download Zip' }).click()
37-
35+
// TODO: simplify the downloadPromise calls
36+
// Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button
3837
const downloadPromise = await page
3938
.waitForEvent('download', { timeout: 2000 })
4039
.catch(() => {
40+
page.getByRole('button', { name: 'Code' }).click()
41+
page.getByRole('button', { name: 'Download Zip' }).click()
42+
return page.waitForEvent('download', { timeout: 2000 })
43+
})
44+
.catch(() => {
45+
// these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests
46+
page.getByRole('button', { name: 'Code' }).click()
47+
page.getByRole('button', { name: 'Download Zip' }).click()
48+
return page.waitForEvent('download', { timeout: 2000 })
49+
})
50+
.catch(() => {
51+
page.getByRole('button', { name: 'Code' }).click()
4152
page.getByRole('button', { name: 'Download Zip' }).click()
42-
return page.waitForEvent('download')
53+
return page.waitForEvent('download', { timeout: 2000 })
4354
})
4455

4556
await downloadPromise.saveAs('./dist-tests/vision-classification-simple.zip')
@@ -90,13 +101,22 @@ test('vision classification all', async () => {
90101
await page.click('text=Loggers')
91102
await page.click('text=config.yaml')
92103

93-
await page.getByRole('button', { name: 'Code' }).click()
94-
await page.getByRole('button', { name: 'Download Zip' }).click()
95104
const downloadPromise = await page
96105
.waitForEvent('download', { timeout: 2000 })
97106
.catch(() => {
107+
page.getByRole('button', { name: 'Code' }).click()
108+
page.getByRole('button', { name: 'Download Zip' }).click()
109+
return page.waitForEvent('download', { timeout: 2000 })
110+
})
111+
.catch(() => {
112+
page.getByRole('button', { name: 'Code' }).click()
113+
page.getByRole('button', { name: 'Download Zip' }).click()
114+
return page.waitForEvent('download', { timeout: 2000 })
115+
})
116+
.catch(() => {
117+
page.getByRole('button', { name: 'Code' }).click()
98118
page.getByRole('button', { name: 'Download Zip' }).click()
99-
return page.waitForEvent('download')
119+
return page.waitForEvent('download', { timeout: 2000 })
100120
})
101121
await downloadPromise.saveAs('./dist-tests/vision-classification-all.zip')
102122
})
@@ -115,13 +135,22 @@ test('vision classification launch', async () => {
115135
await page.click('text=Loggers')
116136
await page.click('text=config.yaml')
117137

118-
await page.getByRole('button', { name: 'Code' }).click()
119-
await page.getByRole('button', { name: 'Download Zip' }).click()
120138
const downloadPromise = await page
121139
.waitForEvent('download', { timeout: 2000 })
122140
.catch(() => {
141+
page.getByRole('button', { name: 'Code' }).click()
123142
page.getByRole('button', { name: 'Download Zip' }).click()
124-
return page.waitForEvent('download')
143+
return page.waitForEvent('download', { timeout: 2000 })
144+
})
145+
.catch(() => {
146+
page.getByRole('button', { name: 'Code' }).click()
147+
page.getByRole('button', { name: 'Download Zip' }).click()
148+
return page.waitForEvent('download', { timeout: 2000 })
149+
})
150+
.catch(() => {
151+
page.getByRole('button', { name: 'Code' }).click()
152+
page.getByRole('button', { name: 'Download Zip' }).click()
153+
return page.waitForEvent('download', { timeout: 2000 })
125154
})
126155
await downloadPromise.saveAs('./dist-tests/vision-classification-launch.zip')
127156
})
@@ -141,13 +170,22 @@ test('vision classification spawn', async () => {
141170
await page.click('text=Loggers')
142171
await page.click('text=config.yaml')
143172

144-
await page.getByRole('button', { name: 'Code' }).click()
145-
await page.getByRole('button', { name: 'Download Zip' }).click()
146173
const downloadPromise = await page
147174
.waitForEvent('download', { timeout: 2000 })
148175
.catch(() => {
176+
page.getByRole('button', { name: 'Code' }).click()
177+
page.getByRole('button', { name: 'Download Zip' }).click()
178+
return page.waitForEvent('download', { timeout: 2000 })
179+
})
180+
.catch(() => {
181+
page.getByRole('button', { name: 'Code' }).click()
182+
page.getByRole('button', { name: 'Download Zip' }).click()
183+
return page.waitForEvent('download', { timeout: 2000 })
184+
})
185+
.catch(() => {
186+
page.getByRole('button', { name: 'Code' }).click()
149187
page.getByRole('button', { name: 'Download Zip' }).click()
150-
return page.waitForEvent('download')
188+
return page.waitForEvent('download', { timeout: 2000 })
151189
})
152190
await downloadPromise.saveAs('./dist-tests/vision-classification-spawn.zip')
153191
})

__tests__/vision-dcgan.spec.js

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,25 @@ test('vision dcgan simple', async () => {
3232
await page.click('text=Loggers')
3333
await page.click('text=config.yaml')
3434

35-
await page.getByRole('button', { name: 'Code' }).click()
36-
await page.getByRole('button', { name: 'Download Zip' }).click()
37-
35+
// TODO: simplify the downloadPromise calls
36+
// Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button
3837
const downloadPromise = await page
3938
.waitForEvent('download', { timeout: 2000 })
4039
.catch(() => {
40+
page.getByRole('button', { name: 'Code' }).click()
41+
page.getByRole('button', { name: 'Download Zip' }).click()
42+
return page.waitForEvent('download', { timeout: 2000 })
43+
})
44+
.catch(() => {
45+
// these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests
46+
page.getByRole('button', { name: 'Code' }).click()
4147
page.getByRole('button', { name: 'Download Zip' }).click()
42-
return page.waitForEvent('download')
48+
return page.waitForEvent('download', { timeout: 2000 })
49+
})
50+
.catch(() => {
51+
page.getByRole('button', { name: 'Code' }).click()
52+
page.getByRole('button', { name: 'Download Zip' }).click()
53+
return page.waitForEvent('download', { timeout: 2000 })
4354
})
4455
await downloadPromise.saveAs('./dist-tests/vision-dcgan-simple.zip')
4556
})
@@ -89,16 +100,23 @@ test('vision dcgan all', async () => {
89100
await page.click('text=Loggers')
90101
await page.click('text=config.yaml')
91102

92-
await page.getByRole('button', { name: 'Code' }).click()
93-
await page.getByRole('button', { name: 'Download Zip' }).click()
94-
95103
const downloadPromise = await page
96104
.waitForEvent('download', { timeout: 2000 })
97105
.catch(() => {
106+
page.getByRole('button', { name: 'Code' }).click()
98107
page.getByRole('button', { name: 'Download Zip' }).click()
99-
return page.waitForEvent('download')
108+
return page.waitForEvent('download', { timeout: 2000 })
109+
})
110+
.catch(() => {
111+
page.getByRole('button', { name: 'Code' }).click()
112+
page.getByRole('button', { name: 'Download Zip' }).click()
113+
return page.waitForEvent('download', { timeout: 2000 })
114+
})
115+
.catch(() => {
116+
page.getByRole('button', { name: 'Code' }).click()
117+
page.getByRole('button', { name: 'Download Zip' }).click()
118+
return page.waitForEvent('download', { timeout: 2000 })
100119
})
101-
102120
await downloadPromise.saveAs('./dist-tests/vision-dcgan-all.zip')
103121
})
104122

@@ -116,16 +134,23 @@ test('vision dcgan launch', async () => {
116134
await page.click('text=Loggers')
117135
await page.click('text=config.yaml')
118136

119-
await page.getByRole('button', { name: 'Code' }).click()
120-
await page.getByRole('button', { name: 'Download Zip' }).click()
121-
122137
const downloadPromise = await page
123138
.waitForEvent('download', { timeout: 2000 })
124139
.catch(() => {
140+
page.getByRole('button', { name: 'Code' }).click()
125141
page.getByRole('button', { name: 'Download Zip' }).click()
126-
return page.waitForEvent('download')
142+
return page.waitForEvent('download', { timeout: 2000 })
143+
})
144+
.catch(() => {
145+
page.getByRole('button', { name: 'Code' }).click()
146+
page.getByRole('button', { name: 'Download Zip' }).click()
147+
return page.waitForEvent('download', { timeout: 2000 })
148+
})
149+
.catch(() => {
150+
page.getByRole('button', { name: 'Code' }).click()
151+
page.getByRole('button', { name: 'Download Zip' }).click()
152+
return page.waitForEvent('download', { timeout: 2000 })
127153
})
128-
129154
await downloadPromise.saveAs('./dist-tests/vision-dcgan-launch.zip')
130155
})
131156

@@ -144,14 +169,22 @@ test('vision dcgan spawn', async () => {
144169
await page.click('text=Loggers')
145170
await page.click('text=config.yaml')
146171

147-
await page.getByRole('button', { name: 'Code' }).click()
148-
await page.getByRole('button', { name: 'Download Zip' }).click()
149-
150172
const downloadPromise = await page
151173
.waitForEvent('download', { timeout: 2000 })
152174
.catch(() => {
175+
page.getByRole('button', { name: 'Code' }).click()
176+
page.getByRole('button', { name: 'Download Zip' }).click()
177+
return page.waitForEvent('download', { timeout: 2000 })
178+
})
179+
.catch(() => {
180+
page.getByRole('button', { name: 'Code' }).click()
181+
page.getByRole('button', { name: 'Download Zip' }).click()
182+
return page.waitForEvent('download', { timeout: 2000 })
183+
})
184+
.catch(() => {
185+
page.getByRole('button', { name: 'Code' }).click()
153186
page.getByRole('button', { name: 'Download Zip' }).click()
154-
return page.waitForEvent('download')
187+
return page.waitForEvent('download', { timeout: 2000 })
155188
})
156189
await downloadPromise.saveAs('./dist-tests/vision-dcgan-spawn.zip')
157190
})

0 commit comments

Comments
 (0)