In general, the imperfect tense is used for descriptions and ongoing\repeated actions in the past, for example:
Description - It was raining: Il pleuvait
Ongoing - I was reading my book: Je lisais mon livre
Repeated action - When I was young I used to go to the park with my friend: Quand j'étais petit(e), j'allais au parc avec mon ami
Whereas the perfect tense is for one-off, individual actions, for example:
Yesterday I went to the cinema: Hier je suis allé(e) au cinéma.
Here is an example that shows the two different tenses used together to talk about past events:
I was watching television when my sister arrived: Je regardais la télé quand ma soeur est arrivée.
Watching television is an ongoing action (imperfect tense), and the sister arriving is a one-off event (perfect tense).