Read the examples:
Because they had been working so well together,
they became really good friends. (= after this had been happening for a while ...this working together)
It turned out later that the two guys had been having similar problems for some time.