Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions appium/tests/screenobjects/attachment.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import BaseScreen from './base.screen';
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
BACK_BTN: '~arrow left c'
BACK_BTN: '~arrow left c',
SAVE_BTN: '-ios class chain:**/XCUIElementTypeButton[`label == "Save"`]',
CANCEL_BTN: '~Cancel',
};
Comment on lines 4 to 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll file issue to add accessibility ids to these three, aid-back-icon, aid-save-attachment-to-device and aid-cancel-saving-attachment


class AttachmentScreen extends BaseScreen {
Expand All @@ -14,15 +16,38 @@ class AttachmentScreen extends BaseScreen {
return $(SELECTORS.BACK_BTN);
}

get saveButton() {
return $(SELECTORS.SAVE_BTN);
}

get cancelButton() {
return $(SELECTORS.CANCEL_BTN)
}

checkDownloadPopUp = async (name: string) => {
await (await this.backButton).waitForDisplayed();
await (await this.cancelButton).waitForDisplayed();
const attachment = `-ios class chain:**/XCUIElementTypeNavigationBar[\`name == "com_apple_DocumentManager_Service.DOCServiceTargetSelectionBrowserView"\`]/XCUIElementTypeButton/XCUIElementTypeStaticText`;//it works only with this selector
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need accessibility id aid-attachment-name-container

expect(await $(attachment)).toHaveAttribute('value', `${name}`);
}

clickBackButton = async () => {
await ElementHelper.waitAndClick(await this.backButton);
}

clickCancelButton = async () => {
await ElementHelper.waitAndClick(await this.cancelButton);
}

checkAttachment = async (name: string) => {
await (await this.backButton).waitForDisplayed();
const attachmentHeader = `-ios class chain:**/XCUIElementTypeNavigationBar[\`name == "${name}"\`]`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

aid-attachment-header-name

expect(await $(attachmentHeader)).toBeDisplayed();
await (await this.saveButton).waitForDisplayed();
}

clickSaveButton = async () => {
await ElementHelper.waitAndClick(await this.saveButton);
}
}

export default new AttachmentScreen();
2 changes: 1 addition & 1 deletion appium/tests/screenobjects/email.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const SELECTORS = {
OK_BUTTON: '~Ok',
WRONG_PASS_PHRASE_MESSAGE: '-ios class chain:**/XCUIElementTypeStaticText[`label == "Wrong pass phrase, please try again"`]',
ATTACHMENT_CELL: '~attachmentCell0',
ATTACHMENT_TITLE: 'attachmentTitleLabel0',
ATTACHMENT_TITLE: '~attachmentTitleLabel0',
Copy link
Collaborator

Choose a reason for hiding this comment

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

aid-attachment-title-label-0

REPLY_BUTTON: '~replyButton',
RECIPIENTS_BUTTON: '~messageRecipientButton',
Comment on lines 12 to 13
Copy link
Collaborator

Choose a reason for hiding this comment

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

aid-reply-icon and aid-message-recipients-tappable-area

RECIPIENTS_TO_LABEL: '~toLabel0',
Expand Down
19 changes: 13 additions & 6 deletions appium/tests/specs/live/inbox/ReadAttachmentEmail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('INBOX: ', () => {
await MailFolderScreen.searchEmailBySubject(emailSubject);
await MailFolderScreen.clickOnEmailBySubject(emailSubject);
await EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText);
// FIXME await EmailScreen.checkAttachment(attachmentName);
await EmailScreen.checkAttachment(attachmentName);

await driver.terminateApp(bundleId);
await driver.activateApp(bundleId);
Expand All @@ -46,21 +46,28 @@ describe('INBOX: ', () => {
await EmailScreen.enterPassPhrase(correctPassPhrase);
await EmailScreen.clickOkButton();
await EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText);
// FIXME await EmailScreen.checkAttachment(attachmentName);
await EmailScreen.checkAttachment(attachmentName);
await EmailScreen.clickOnAttachmentCell();
await AttachmentScreen.checkAttachment(attachmentName);

// FIXME await AttachmentScreen.checkDownloadPopUp(attachmentName);
await browser.pause(2000); // TODO
await AttachmentScreen.clickSaveButton();

await AttachmentScreen.checkDownloadPopUp(attachmentName);
await AttachmentScreen.clickCancelButton();
await AttachmentScreen.checkAttachment(attachmentName);
await AttachmentScreen.clickBackButton();

// FIXME await EmailScreen.checkAttachment(attachmentName);
await EmailScreen.checkAttachment(attachmentName);
await EmailScreen.clickBackButton();

await MailFolderScreen.clickOnEmailBySubject(emailSubject);
await EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText);
// FIXME await EmailScreen.checkAttachment(attachmentName);
await EmailScreen.checkAttachment(attachmentName);
await EmailScreen.clickOnAttachmentCell();

await AttachmentScreen.checkAttachment(attachmentName);

await AttachmentScreen.clickSaveButton();
await AttachmentScreen.checkDownloadPopUp(attachmentName);
});
});