Skip to content

Commit

Permalink
#1221 add ui test for recipient deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
sosnovsky committed Dec 27, 2021
1 parent 75d353e commit 8aeea42
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
3 changes: 2 additions & 1 deletion FlowCrypt/Controllers/Compose/ComposeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,8 @@ extension ComposeViewController {
guard selectedRecipients.isEmpty else {
// remove selected recipients
contextToSend.recipients = recipients.filter { !$0.state.isSelected }
node.reloadRows(at: [recipientsIndexPath], with: .fade)
node.reloadSections([Section.recipient.rawValue, Section.password.rawValue],
with: .automatic)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ struct ComposeMessageContext: Equatable {
private var _messagePassword: String?
}

extension ComposeMessageContext {
init(message: String? = nil,
recipients: [ComposeMessageRecipient] = [],
subject: String? = nil,
attachments: [MessageAttachment] = [],
messagePassword: String? = nil
) {
self.message = message
self.recipients = recipients
self.subject = subject
self.attachments = attachments
self.messagePassword = messagePassword
}
}

extension ComposeMessageContext {
var hasMessagePassword: Bool {
messagePassword != nil
Expand Down
4 changes: 2 additions & 2 deletions FlowCryptUI/Cell Nodes/RecipientEmailNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ final class RecipientEmailNode: CellNode {
break
}
}
imageNode.addTarget(self, action: #selector(handleTap(_:)), forControlEvents: .touchUpInside)
titleNode.addTarget(self, action: #selector(handleTap(_:)), forControlEvents: .touchUpInside)
imageNode.addTarget(self, action: #selector(handleTap), forControlEvents: .touchUpInside)
titleNode.addTarget(self, action: #selector(handleTap), forControlEvents: .touchUpInside)
}

@objc private func handleTap(_ sender: ASDisplayNode) {
Expand Down
6 changes: 6 additions & 0 deletions appium/tests/screenobjects/new-message.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ class NewMessageScreen extends BaseScreen {
expect(name).toEqual(` ${recipient} `);
}

deleteAddedRecipient = async (order: number, color: string) => {
const addedRecipientEl = await $(`~aid-to-${order}-${color}`);
await ElementHelper.waitAndClick(addedRecipientEl);
await driver.sendKeys(['\b']); // backspace
}

checkAddedAttachment = async (name: string) => {
await (await this.deleteAttachmentButton).waitForDisplayed();
const label = await this.attachmentNameLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ describe('COMPOSE EMAIL: ', () => {
await NewMessageScreen.clickCancelButton();
await NewMessageScreen.checkPasswordCell(emptyPasswordMessage);

await NewMessageScreen.deleteAddedRecipient(0, 'gray');

await NewMessageScreen.setAddRecipient(recipient);
await NewMessageScreen.clickSendButton();
await BaseScreen.checkModalMessage(passwordModalMessage);
await NewMessageScreen.clickCancelButton();
await NewMessageScreen.checkPasswordCell(emptyPasswordMessage);

await NewMessageScreen.clickPasswordCell();
await NewMessageScreen.setMessagePassword(emailPassword);
await NewMessageScreen.checkPasswordCell(addedPasswordMessage);
Expand Down

0 comments on commit 8aeea42

Please sign in to comment.