// Notice that you should have a phonebook contact with phone number +358123456781 in Phonebook.
// That very same contact should have internet telephone field with value MSN:tester1@msn.com.
// Otherwise you should modify the script below.
// If you already have MSN service and the user then you do not run the first two test cases that
// initiates the test environment for actual tests.

[Test]
title Create test MSN service*
create ContactPresenceApiTester client
client CreateTestServicesL
pause 1000
delete client
[Endtest]

[Test]
title Create test user*
create ContactPresenceApiTester client
client OpenStoresL
waittestclass client
client CreateTestContactsL
waittestclass client
delete client
[Endtest]

[Test]
title Subscribe info
create ContactPresenceApiTester client
client OpenStoresL
waittestclass client
client FeedPresenceL Identity: MSN:tester1@msn.com ServiceId: MSN Availability: 2 Text: available
client DoWaitSec 1
waittestclass client
client FetchContactL Contact: +358123456781
waittestclass client
client GetIconInfoL 
waittestclass client
delete client
[Endtest]

[Test]
title Get info *
create ContactPresenceApiTester client
client OpenStoresL
waittestclass client
client FeedPresenceL Identity: MSN:tester1@msn.com ServiceId: MSN Availability: 2 Text: available
client DoWaitSec 1
waittestclass client
client FetchContactL Contact: +358123456781
waittestclass client
client GetIconInfoL  GetOnce: 1
waittestclass client
delete client
[Endtest]

[Test]
title Subscribe info given PbkManager
create ContactPresenceApiTester client
client OpenStoresL
waittestclass client
client FeedPresenceL Identity: MSN:tester1@msn.com ServiceId: MSN Availability: 2 Text: available
client DoWaitSec 1
waittestclass client
client FetchContactL Contact: +358123456781 
waittestclass client
client GetIconInfoL MgrGiven: 1
waittestclass client
delete client
[Endtest]

[Test]
title Fetch branded icon
create ContactPresenceApiTester client
client GetBrandedIconL 
waittestclass client
delete client
[Endtest]

[Test]
title Subscribe info and cancel
create ContactPresenceApiTester client
client OpenStoresL
waittestclass client
client FeedPresenceL Identity: MSN:tester1@msn.com ServiceId: MSN Availability: 2 Text: available
client DoWaitSec 1
waittestclass client
client FetchContactL Contact: +358123456781
waittestclass client
client GetIconInfoL Cancel: 1
waittestclass client
delete client
[Endtest]

[Test]
title Fetch branded icon and cancel
create ContactPresenceApiTester client
client OpenStoresL
waittestclass client
client GetBrandedIconL Cancel: 1
waittestclass client
delete client
[Endtest]

[Test]
title Subscribe info and cancel all
create ContactPresenceApiTester client
client OpenStoresL
waittestclass client
client FeedPresenceL Identity: MSN:tester1@msn.com ServiceId: MSN Availability: 2 Text: available
pause 1000
client FetchContactL Contact: +358123456781
waittestclass client
client GetIconInfoL Cancel: 2
waittestclass client
// This makes a new notification
client FeedPresenceL Identity: MSN:tester1@msn.com ServiceId: MSN Availability: 0 Text: notavailable
waittestclass client
client CancelAll
// No new notifications since subscription is cancelled
client FeedPresenceL Identity: MSN:tester1@msn.com ServiceId: MSN Availability: 0 Text: notavailable
pause 1000
delete client
[Endtest]

