Skip to content

Commit 3c731de

Browse files
authored
[CI-5849] Enable test video upload feature for everyone (#256)
* [CI-5849] Enable test video upload feature for everyone * fix: pr comment * fix: failing tests * fix: timestamps in test attachements filenames
1 parent 5583d1e commit 3c731de

File tree

3 files changed

+29
-64
lines changed

3 files changed

+29
-64
lines changed

test/test_test.go

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -326,53 +326,25 @@ func Test_ParseXctest3Results(t *testing.T) {
326326
}
327327

328328
func Test_findSupportedAttachments(t *testing.T) {
329-
t.Run("without video upload enabled", func(t *testing.T) {
330-
os.Unsetenv("ENABLE_TEST_VIDEO_UPLOAD")
331-
332-
tempDir, err := pathutil.NormalizedOSTempDirPath("test_attachments")
333-
require.NoError(t, err)
334-
defer os.RemoveAll(tempDir)
335-
336-
files := []string{
337-
"screenshot1.JPG",
338-
"screenshot2.png",
339-
"log.txt",
340-
"video.mp4",
341-
"recording.webm",
342-
"subfolder/nested.jpg",
343-
"subfolder/nested.mp4",
344-
"subfolder/deep/image.png",
345-
}
346-
err = createDummyFilesInDirWithContent(tempDir, "test", files)
347-
require.NoError(t, err)
348-
349-
result := findSupportedAttachments(tempDir, logV2.NewLogger())
350-
351-
assert.Len(t, result, 5) // jpg, png, txt, nested jpg, nested png (no videos)
352-
})
353-
354-
t.Run("with video upload enabled", func(t *testing.T) {
355-
os.Setenv("ENABLE_TEST_VIDEO_UPLOAD", "true")
356-
defer os.Unsetenv("ENABLE_TEST_VIDEO_UPLOAD")
357-
358-
tempDir, err := pathutil.NormalizedOSTempDirPath("test_attachments")
359-
require.NoError(t, err)
360-
defer os.RemoveAll(tempDir)
361-
362-
files := []string{
363-
"screenshot.JPG",
364-
"video.mp4",
365-
"recording.webm",
366-
"subfolder/nested.png",
367-
"subfolder/clip.ogg",
368-
"subfolder/deep/image.jpg",
369-
"subfolder/deep/movie.mp4",
370-
}
371-
err = createDummyFilesInDirWithContent(tempDir, "test", files)
372-
require.NoError(t, err)
329+
tempDir, err := pathutil.NormalizedOSTempDirPath("test_attachments")
330+
require.NoError(t, err)
331+
defer os.RemoveAll(tempDir)
332+
333+
files := []string{
334+
"screenshot.JPG",
335+
"screenshot2.png",
336+
"log.txt",
337+
"video.mp4",
338+
"recording.webm",
339+
"subfolder/nested.jpg",
340+
"subfolder/clip.ogg",
341+
"subfolder/deep/image.png",
342+
"subfolder/deep/movie.mp4",
343+
}
344+
err = createDummyFilesInDirWithContent(tempDir, "test", files)
345+
require.NoError(t, err)
373346

374-
result := findSupportedAttachments(tempDir, logV2.NewLogger())
347+
result := findSupportedAttachments(tempDir, logV2.NewLogger())
375348

376-
assert.Len(t, result, 7) // all files including videos
377-
})
349+
assert.Len(t, result, 9) // all supported files including videos
378350
}

test/testasset/testasset.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
11
package testasset
22

33
import (
4-
"os"
54
"path/filepath"
65
"slices"
76
"strings"
87
)
98

10-
var AssetTypes = []string{".jpg", ".jpeg", ".png", ".txt", ".log"}
11-
var VideoTypes = []string{".mp4", ".webm", ".ogg"} // These video types are also supported on the UI
9+
var AssetTypes = []string{".jpg", ".jpeg", ".png", ".txt", ".log", ".mp4", ".webm", ".ogg"}
1210

1311
func IsSupportedAssetType(fileName string) bool {
1412
ext := filepath.Ext(fileName)
15-
16-
if slices.Contains(AssetTypes, strings.ToLower(ext)) {
17-
return true
18-
}
19-
20-
if os.Getenv("ENABLE_TEST_VIDEO_UPLOAD") == "true" {
21-
return slices.Contains(VideoTypes, strings.ToLower(ext))
22-
}
23-
24-
return false
13+
return slices.Contains(AssetTypes, strings.ToLower(ext))
2514
}

test/testdata/ios_device_config_xml_output.golden

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313
<testcase name="testLaunch()" classname="DarkAndLightModeUITestsLaunchTests" time="5">
1414
<failure></failure>
1515
<properties>
16-
<property name="attachment_0" value="Launch Screen_1_FD1B9BC4-364B-4191-88F9-48DD5B4B251F_1702394166035000085.png"></property>
17-
<property name="attachment_1" value="Launch Screen_1_1FDDCFCB-A490-4773-ABC1-96BC97459F6A_1702394182316999912.png"></property>
18-
<property name="attachment_2" value="Launch Screen_1_CEFDE93C-2C43-4D5B-80B5-0B27AD09CCC5_1702394197773999929.png"></property>
19-
<property name="attachment_3" value="Launch Screen_1_6CD9C2FF-7FFC-4C37-B82A-D208F800193B_1702394211733000040.png"></property>
16+
<property name="attachment_0" value="Screen Recording 2023-12-12 at 03.16.02 PM_1702394162331000089.mp4"></property>
17+
<property name="attachment_1" value="Launch Screen_1_FD1B9BC4-364B-4191-88F9-48DD5B4B251F_1702394166035000085.png"></property>
18+
<property name="attachment_2" value="Screen Recording 2023-12-12 at 03.16.18 PM_1702394178290999889.mp4"></property>
19+
<property name="attachment_3" value="Launch Screen_1_1FDDCFCB-A490-4773-ABC1-96BC97459F6A_1702394182316999912.png"></property>
20+
<property name="attachment_4" value="Screen Recording 2023-12-12 at 03.16.33 PM_1702394193904999971.mp4"></property>
21+
<property name="attachment_5" value="Launch Screen_1_CEFDE93C-2C43-4D5B-80B5-0B27AD09CCC5_1702394197773999929.png"></property>
22+
<property name="attachment_6" value="Screen Recording 2023-12-12 at 03.16.47 PM_1702394207775000095.mp4"></property>
23+
<property name="attachment_7" value="Launch Screen_1_6CD9C2FF-7FFC-4C37-B82A-D208F800193B_1702394211733000040.png"></property>
2024
</properties>
2125
</testcase>
2226
</testsuite>

0 commit comments

Comments
 (0)