Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starts disappearing messages tests for all media types #15

Merged

Conversation

burtonemily
Copy link
Collaborator

Send disappearing

  • image
  • video
  • gif
  • document
  • voice message
  • link preview
  • community invite

package.json Outdated
@@ -30,6 +31,7 @@
},
"scripts": {
"lint": "yarn prettier . --write && yarn eslint .",
"build": "yarn tsc --watch",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually we name that one dev, and not build.
usually, build is build without watch
and dev is build with watch.

also you have a watch command on line 36

Comment on lines 34 to 60
[
{
mediaType: 'image',
path: 'fixtures/test-image.png',
attachmentType: 'media',
},
{
mediaType: 'video',
path: 'fixtures/test-video.mp4',
attachmentType: 'media',
},
{
mediaType: 'gif',
path: 'fixtures/test-gif.gif',
attachmentType: 'media',
},
{
mediaType: 'document',
path: 'fixtures/test-file.pdf',
attachmentType: 'file',
},
{
mediaType: 'voice',
path: '',
attachmentType: 'audio',
},
].forEach(({ mediaType, path, attachmentType }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await sendMedia(aliceWindow1, path, testMessage);
}
// Click on untrusted attachment
await trustUser(bobWindow1, alice.userName, attachmentType as MediaType);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you make the attachmentType: 'document' as const (and the others too), you should be able to get rid of that as MediaType. Let me know if not.

@@ -240,7 +242,7 @@ test_Alice_2W_Bob_1W(
// Set disappearing messages to on
await setDisappearingMessages(
aliceWindow1,
['1:1', 'disappear-after-send-option', 'time-option-10-seconds'],
['1:1', 'disappear-after-send-option', 'time-option-10-seconds', 'sent'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that you are not using that last item on the array in setDisappearingMessages.
Can you just get rid of it everywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was waiting for the modal description to be merged before using this but it should be merged now

Comment on lines 42 to 61
{
mediaType: 'video',
path: 'fixtures/test-video.mp4',
mediaTag: 'media',
},
{
mediaType: 'gif',
path: 'fixtures/test-gif.gif',
mediaTag: 'media',
},
{
mediaType: 'document',
path: 'fixtures/test-file.pdf',
mediaTag: 'file',
},
{
mediaType: 'voice',
path: '',
mediaTag: 'audio',
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could make those a constant and import the array in each testfile that needs to run the same tests.

i.e. this one and tests/automation/disappearing_message_checks.spec.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
// Click on untrusted attachment in window B
await sleepFor(1000);
await trustUser(bobWindow1, alice.userName, mediaTag as MediaType);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as in tests/automation/disappearing_message_checks.spec.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

tests/automation/types/testing.ts Show resolved Hide resolved
Comment on lines 18 to 19
};
export const sendMessage = async (window: Page, message: string) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line before the export const please

Comment on lines 77 to 80
await selc.click({ button: 'right' });
await clickOnMatchingText(
senderWindow,
englishStrippedStr('reply').toString(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure I had to add a sleepFor between the await selc.click and the clickOnMatchingText to avoid a layout shift. Could you add it too? Maybe 100ms should be enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah i couldn't remember how you solved the layout shift, but that seems to be have fixed it 👌

Comment on lines 92 to 105
// Need test tag of modal-description for this to work
// let action;
// if (disappearAction) {
// action = englishStrippedStr('disappearingMessagesTypeRead').toString();
// } else {
// action = englishStrippedStr('disappearingMessagesTypeSent').toString();
// }

// await checkModalStrings(
// windowB,
// englishStrippedStr('disappearingMessagesFollowSetting').toString(),
// action,
// );
await clickOnElement({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be merged now?

@burtonemily burtonemily merged commit 4a73226 into session-foundation:main Jan 7, 2025
@burtonemily burtonemily deleted the disappearing_messages_all branch January 10, 2025 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants