Skip to content

Commit

Permalink
Merge pull request #540 from Satellite-im/luis/emoji-suggestions
Browse files Browse the repository at this point in the history
test(update): add more methods for emoji suggestion tests
  • Loading branch information
luisecm authored Nov 25, 2023
2 parents 968c97a + f7dd035 commit d9aa824
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
17 changes: 17 additions & 0 deletions tests/screenobjects/chats/EmojiSuggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,21 @@ export default class EmojiSuggestions extends UplinkMainScreen {
async pressEscKey() {
await keyboard.type(Key.Escape);
}

async validateEmojiSuggestionsContainerIsShown() {
await browser.pause(1000);
const emojiSuggestionsContainer = await this.emojiSuggestionsContainer;
await emojiSuggestionsContainer.waitForDisplayed();
}

async validateEmojiSuggestionsHeader(expectedHeader: string) {
const emojiSuggestionsHeader = await this.emojiSuggestionsHeader;
await expect(emojiSuggestionsHeader).toBeDisplayed();
await expect(emojiSuggestionsHeader).toHaveTextContaining(expectedHeader);
}

async validateEmojiSuggestionsReceived(expectedEmojiList: string[]) {
const emojiSuggestedList = await this.getEmojisSuggested();
await expect(emojiSuggestedList).toEqual(expectedEmojiList);
}
}
4 changes: 2 additions & 2 deletions tests/screenobjects/chats/InputBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ export default class InputBar extends UplinkMainScreen {
}

async selectUploadFromLocalDisk() {
const uploadButtonLocalDisk = await this.uploadButtonLocalDisk;
await uploadButtonLocalDisk.click();
await this.uploadButtonLocalDisk.waitForDisplayed();
await this.uploadButtonLocalDisk.click();
}

async selectUploadFromStorage() {
Expand Down
13 changes: 6 additions & 7 deletions tests/specs/reusable-accounts/04-message-input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,24 @@ export default async function messageInputTests() {
it("Emoji Suggested List - Displays expected data", async () => {
// Type :en to show emoji suggestions starting with "en"
await chatsInputFirstUser.typeMessageOnInput(":en");
await emojiSuggestionsFirstUser.waitForIsShown(true);
await emojiSuggestionsFirstUser.validateEmojiSuggestionsContainerIsShown();

// Validate header text from Emoji Suggested List
const emojiSuggestionsHeader =
await emojiSuggestionsFirstUser.emojiSuggestionsHeader;
await expect(emojiSuggestionsHeader).toHaveTextContaining(
await emojiSuggestionsFirstUser.validateEmojiSuggestionsHeader(
"SUGGESTED EMOJI",
);

// Validate results are correct in Emoji Suggestion List
const currentEmojiSuggestedList =
await emojiSuggestionsFirstUser.getEmojisSuggested();
const expectedEmojiSuggestedList = [
"✉️ :envelope:",
"🏴󠁧󠁢󠁥󠁮󠁧󠁿 :england:",
"📩 :envelope_with_arrow:",
"🔚 :end:",
];
await expect(currentEmojiSuggestedList).toEqual(expectedEmojiSuggestedList);

await emojiSuggestionsFirstUser.validateEmojiSuggestionsReceived(
expectedEmojiSuggestedList,
);
});

it("Emoji Suggested List - Can be closed without choosing suggestion", async () => {
Expand Down

0 comments on commit d9aa824

Please sign in to comment.