An immediate short-term workaround is to use the TSFC form representation, as discussed in my answer here. (This can also result in more efficient code than UFLACS.) However, TSFC can fail in other places, like integration over interior facets with quad/hex elements. It is possible to assemble different terms with different form representations, though, e.g.,
print("Trying test 6")
# Need to switch back to UFLACS for interior facets; comment this line for
# an error:
parameters["form_compiler"]["representation"] = 'uflacs'
S = assemble(inner(avg(u),avg(v))*dS)
print("Test 6 worked")