tests(e2e): Allow tests to run only on file changes

- supports glob patterns in testfiles
- only runs tests on changes
- always runs tests without specified patterns

tests(e2e): refactor global watch patterns

tests(e2e): add watch patterns to test files
This commit is contained in:
Otto Richter 2024-09-11 22:34:33 +02:00
parent f2a23c962a
commit 7765153b40
21 changed files with 260 additions and 7 deletions

View file

@ -38,6 +38,7 @@ func TestMain(m *testing.M) {
defer cancel()
tests.InitTest(true)
initChangedFiles()
testE2eWebRoutes = routers.NormalRoutes()
os.Unsetenv("GIT_AUTHOR_NAME")
@ -100,6 +101,11 @@ func TestE2e(t *testing.T) {
_, filename := filepath.Split(path)
testname := filename[:len(filename)-len(filepath.Ext(path))]
if canSkipTest(path) {
fmt.Printf("No related changes for test, skipping: %s\n", filename)
continue
}
t.Run(testname, func(t *testing.T) {
// Default 2 minute timeout
onForgejoRun(t, func(*testing.T, *url.URL) {