1
- import type { TestInfo } from '@playwright/test' ;
1
+ import { test , type TestInfo } from '@playwright/test' ;
2
2
3
3
import { englishStrippedStr } from '../../localizer/englishStrippedStr' ;
4
+ import { TestSteps } from '../../types/allure' ;
4
5
import { bothPlatformsIt } from '../../types/sessionIt' ;
5
6
import { DisappearActions , DISAPPEARING_TIMES } from '../../types/testing' ;
6
7
import { MessageBody } from './locators/conversation' ;
@@ -27,42 +28,53 @@ async function disappearAfterSendGroups(platform: SupportedPlatformsType, testIn
27
28
const controlMode : DisappearActions = 'sent' ;
28
29
const time = DISAPPEARING_TIMES . THIRTY_SECONDS ;
29
30
const maxWait = 35_000 ; // 30s plus buffer
31
+ let sentTimestamp : number ;
30
32
const {
31
33
devices : { alice1, bob1, charlie1 } ,
32
34
prebuilt : { alice } ,
33
- } = await open_Alice1_Bob1_Charlie1_friends_group ( {
34
- platform,
35
- groupName : testGroupName ,
36
- focusGroupConvo : true ,
37
- testInfo,
35
+ } = await test . step ( TestSteps . SETUP . QA_SEEDER , async ( ) => {
36
+ return open_Alice1_Bob1_Charlie1_friends_group ( {
37
+ platform,
38
+ groupName : testGroupName ,
39
+ focusGroupConvo : true ,
40
+ testInfo,
41
+ } ) ;
42
+ } ) ;
43
+ await test . step ( TestSteps . DISAPPEARING_MESSAGES . SET ( time ) , async ( ) => {
44
+ await setDisappearingMessage ( platform , alice1 , [ 'Group' , `Disappear after send option` , time ] ) ;
45
+ } ) ;
46
+ await test . step ( TestSteps . VERIFY . DISAPPEARING_CONTROL_MESSAGES , async ( ) => {
47
+ // Get correct control message for You setting disappearing messages
48
+ const disappearingMessagesSetYou = englishStrippedStr ( 'disappearingMessagesSetYou' )
49
+ . withArgs ( { time, disappearing_messages_type : controlMode } )
50
+ . toString ( ) ;
51
+ // Get correct control message for alice setting disappearing messages
52
+ const disappearingMessagesSetControl = englishStrippedStr ( 'disappearingMessagesSet' )
53
+ . withArgs ( { name : alice . userName , time, disappearing_messages_type : controlMode } )
54
+ . toString ( ) ;
55
+ // Check control message is correct on device 1, 2 and 3
56
+ await Promise . all ( [
57
+ alice1 . waitForControlMessageToBePresent ( disappearingMessagesSetYou ) ,
58
+ bob1 . waitForControlMessageToBePresent ( disappearingMessagesSetControl ) ,
59
+ charlie1 . waitForControlMessageToBePresent ( disappearingMessagesSetControl ) ,
60
+ ] ) ;
38
61
} ) ;
39
-
40
- await setDisappearingMessage ( platform , alice1 , [ 'Group' , `Disappear after send option` , time ] ) ;
41
- // Get correct control message for You setting disappearing messages
42
- const disappearingMessagesSetYou = englishStrippedStr ( 'disappearingMessagesSetYou' )
43
- . withArgs ( { time, disappearing_messages_type : controlMode } )
44
- . toString ( ) ;
45
- // Get correct control message for alice setting disappearing messages
46
- const disappearingMessagesSetControl = englishStrippedStr ( 'disappearingMessagesSet' )
47
- . withArgs ( { name : alice . userName , time, disappearing_messages_type : controlMode } )
48
- . toString ( ) ;
49
- // Check control message is correct on device 1, 2 and 3
50
- await Promise . all ( [
51
- alice1 . waitForControlMessageToBePresent ( disappearingMessagesSetYou ) ,
52
- bob1 . waitForControlMessageToBePresent ( disappearingMessagesSetControl ) ,
53
- charlie1 . waitForControlMessageToBePresent ( disappearingMessagesSetControl ) ,
54
- ] ) ;
55
62
// Check for test messages (should be deleted)
56
- const sentTimestamp = await alice1 . sendMessage ( testMessage ) ;
57
- await Promise . all (
58
- [ alice1 , bob1 , charlie1 ] . map ( device =>
59
- device . hasElementDisappeared ( {
60
- ...new MessageBody ( device , testMessage ) . build ( ) ,
61
- maxWait,
62
- actualStartTime : sentTimestamp ,
63
- } )
64
- )
65
- ) ;
66
- // Close server and devices
67
- await closeApp ( alice1 , bob1 , charlie1 ) ;
63
+ await test . step ( TestSteps . SEND . MESSAGE ( alice . userName , testGroupName ) , async ( ) => {
64
+ sentTimestamp = await alice1 . sendMessage ( testMessage ) ;
65
+ } ) ;
66
+ await test . step ( TestSteps . VERIFY . MESSAGE_DISAPPEARED , async ( ) => {
67
+ await Promise . all (
68
+ [ alice1 , bob1 , charlie1 ] . map ( device =>
69
+ device . hasElementDisappeared ( {
70
+ ...new MessageBody ( device , testMessage ) . build ( ) ,
71
+ maxWait,
72
+ actualStartTime : sentTimestamp ,
73
+ } )
74
+ )
75
+ ) ;
76
+ } ) ;
77
+ await test . step ( TestSteps . SETUP . CLOSE_APP , async ( ) => {
78
+ await closeApp ( alice1 , bob1 , charlie1 ) ;
79
+ } ) ;
68
80
}
0 commit comments