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
25 changes: 18 additions & 7 deletions appium/tests/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,24 @@ export const CommonData = {
email: 'revoked@flowcrypt.com'
},
errors: {
noPublicKey: 'Could not compose message One or more of your recipients are missing a public key (marked in gray). ' +
'Please ask them to share it with you, or ask them to also set up FlowCrypt.',
wrongPassPhrase: 'Could not compose message This pass phrase did not match your signing private key',
expiredPublicKey: 'Could not compose message One or more of your recipients have expired public keys (marked in orange).' +
' Please ask them to send you updated public key. If this is an enterprise installation, please ask your systems admin.',
revokedPublicKey: 'Could not compose message One or more of your recipients have revoked public keys (marked in red).' +
' Please ask them to send you a new public key. If this is an enterprise installation, please ask your systems admin.'
noPublicKey: 'Could not compose message\n' +
'\n' +
'One or more of your recipients are missing a public key (marked in gray).\n' +
'\n' +
'Please ask them to share it with you, or ask them to also set up FlowCrypt.',
wrongPassPhrase: 'Could not compose message\n' +
'\n' +
'This pass phrase did not match your signing private key',
expiredPublicKey: 'Could not compose message\n' +
'\n' +
'One or more of your recipients have expired public keys (marked in orange).\n' +
'\n' +
'Please ask them to send you updated public key. If this is an enterprise installation, please ask your systems admin.',
revokedPublicKey: 'Could not compose message\n' +
'\n' +
'One or more of your recipients have revoked public keys (marked in red).\n' +
'\n' +
'Please ask them to send you a new public key. If this is an enterprise installation, please ask your systems admin.'
},
decryptErrorBadge: {
badgeText: 'decrypt error'
Expand Down
4 changes: 2 additions & 2 deletions appium/tests/screenobjects/all-screens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import ContactScreen from './contacts.screen';
import ContactPublicKeyScreen from './contact-public-key.screen';
import PublicKeyScreen from './public-key.screen';
import AttachmentScreen from './attachment.screen';
import MailFolderScreen from './mail-folder.screen'
import SearchScreen from './search.screen'
import MailFolderScreen from './mail-folder.screen';
import SearchScreen from './search.screen';

export {
SplashScreen,
Expand Down
46 changes: 46 additions & 0 deletions appium/tests/screenobjects/base.screen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { DEFAULT_TIMEOUT } from '../constants';
import ElementHelper from "../helpers/ElementHelper";


const SELECTORS = {
ERROR_HEADER: '-ios class chain:**/XCUIElementTypeStaticText[`label == "Error"`]',
OK_BUTTON: '~OK',
ERROR_FES_HEADER: '-ios class chain:**/XCUIElementTypeStaticText[`label == "Startup Error"`]',
RETRY_BUTTON: '~Retry'
};

export default class BaseScreen {

Expand All @@ -7,10 +16,47 @@ export default class BaseScreen {
this.locator = selector;
}

static get errorHeader() {
return $(SELECTORS.ERROR_HEADER)
}

static get errorFESHeader() {
return $(SELECTORS.ERROR_FES_HEADER)
}

static get okButton() {
return $(SELECTORS.OK_BUTTON);
}

static get retryButton() {
return $(SELECTORS.RETRY_BUTTON)
}

waitForScreen = async (isShown = true) => {
await (await $(this.locator)).waitForDisplayed({
timeout: DEFAULT_TIMEOUT,
reverse: !isShown,
});
}

static checkErrorModal = async (errorText: string) => {
const message = '-ios class chain:**/XCUIElementTypeAlert/XCUIElementTypeOther/XCUIElementTypeOther/' +
'XCUIElementTypeOther[2]/XCUIElementTypeScrollView[1]/XCUIElementTypeOther[1]/XCUIElementTypeStaticText[2]';//it works only with this selector
await expect(await this.errorHeader).toBeDisplayed();
expect(await (await $(message)).getAttribute('value')).toContain(errorText);
await expect(await this.okButton).toBeDisplayed();
}

static checkErrorModalForFES = async (errorText: string) => {
const message = '-ios class chain:**/XCUIElementTypeAlert/XCUIElementTypeOther/XCUIElementTypeOther/' +
'XCUIElementTypeOther[2]/XCUIElementTypeScrollView[1]/XCUIElementTypeOther[1]/XCUIElementTypeStaticText[2]';//it works only with this selector
await expect(await this.errorFESHeader).toBeDisplayed();
expect(await (await $(message)).getAttribute('value')).toContain(errorText);
await expect(await this.retryButton).toBeDisplayed();
}

static clickOkButtonOnError = async () => {
await ElementHelper.waitAndClick(await this.okButton)
}

}
6 changes: 3 additions & 3 deletions appium/tests/screenobjects/mail-folder.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import TouchHelper from "../helpers/TouchHelper";
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
TRASH_HEADER: '-ios class chain:**/XCUIElementTypeNavigationBar[`name == "TRASH"`]',
SENT_HEADER: '-ios class chain:**/XCUIElementTypeNavigationBar[`name == "SENT"`]',
TRASH_HEADER: '~Navigationitemtrash',
SENT_HEADER: '~Navigationitemsent',
CREATE_EMAIL_BUTTON: '-ios class chain:**/XCUIElementTypeButton[`label == "+"`]',
INBOX_HEADER: '-ios class chain:**/XCUIElementTypeStaticText[`label == "INBOX"`]',
INBOX_HEADER: '~Navigationiteminbox',
SEARCH_ICON: '~search icn',
HELP_ICON: '~help icn',
SEARCH_FIELD: '~searchAllEmailField'
Expand Down
22 changes: 0 additions & 22 deletions appium/tests/screenobjects/new-message.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const SELECTORS = {
RETURN_BUTTON: '~Return',
BACK_BUTTON: '~arrow left c',
SEND_BUTTON: '~android send',
ERROR_HEADER: '-ios class chain:**/XCUIElementTypeStaticText[`label == "Error"`]',
OK_BUTTON: '~OK'
};

class NewMessageScreen extends BaseScreen {
Expand Down Expand Up @@ -65,14 +63,6 @@ class NewMessageScreen extends BaseScreen {
return $(SELECTORS.SEND_BUTTON);
}

get errorHeader() {
return $(SELECTORS.ERROR_HEADER)
}

get okButton() {
return $(SELECTORS.OK_BUTTON);
}

setAddRecipient = async (recipient: string) => {
await (await this.addRecipientField).setValue(recipient);
await browser.pause(2000);
Expand Down Expand Up @@ -151,18 +141,6 @@ class NewMessageScreen extends BaseScreen {
clickSendButton = async () => {
await ElementHelper.waitAndClick(await this.sendButton);
}

checkError = async (errorText: string) => {
const message = '-ios class chain:**/XCUIElementTypeAlert/XCUIElementTypeOther/XCUIElementTypeOther/' +
'XCUIElementTypeOther[2]/XCUIElementTypeScrollView[1]/XCUIElementTypeOther[1]/XCUIElementTypeStaticText[2]';//it works only with this selector
await expect(await this.errorHeader).toBeDisplayed();
await expect(await $(message)).toHaveAttribute('value', `${errorText}`);
await expect(await this.okButton).toBeDisplayed();
}

clickOkButtonOnError = async () => {
await ElementHelper.waitAndClick(await this.okButton)
}
}

export default new NewMessageScreen();
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '../../../screenobjects/all-screens';

import { CommonData } from '../../../data';
import BaseScreen from "../../../screenobjects/base.screen";

describe('COMPOSE EMAIL: ', () => {

Expand All @@ -28,9 +29,9 @@ describe('COMPOSE EMAIL: ', () => {
await NewMessageScreen.checkFilledComposeEmailInfo(expiredPublicKey, emailSubject, emailText);
await NewMessageScreen.clickSendButton();

await NewMessageScreen.checkError(expiredPublicKeyError);
await BaseScreen.checkErrorModal(expiredPublicKeyError);

await NewMessageScreen.clickOkButtonOnError();
await BaseScreen.clickOkButtonOnError();
await NewMessageScreen.clickBackButton();
await MailFolderScreen.checkInboxScreen();

Expand All @@ -39,6 +40,6 @@ describe('COMPOSE EMAIL: ', () => {
await NewMessageScreen.checkFilledComposeEmailInfo(revokedpublicKey, emailSubject, emailText);
await NewMessageScreen.clickSendButton();

await NewMessageScreen.checkError(revokedPublicKeyError);
await BaseScreen.checkErrorModal(revokedPublicKeyError);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '../../../screenobjects/all-screens';

import { CommonData } from '../../../data';
import BaseScreen from "../../../screenobjects/base.screen";

describe('COMPOSE EMAIL: ', () => {

Expand All @@ -25,6 +26,6 @@ describe('COMPOSE EMAIL: ', () => {
await NewMessageScreen.checkFilledComposeEmailInfo(noPublicKeyRecipient, emailSubject, emailText);
await NewMessageScreen.clickSendButton();

await NewMessageScreen.checkError(noPublicKeyError);
await BaseScreen.checkErrorModal(noPublicKeyError);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {

import { CommonData } from '../../../data';
import DataHelper from "../../../helpers/DataHelper";
import BaseScreen from "../../../screenobjects/base.screen";

describe('COMPOSE EMAIL: ', () => {

Expand Down Expand Up @@ -39,8 +40,8 @@ describe('COMPOSE EMAIL: ', () => {
await NewMessageScreen.clickSendButton();
await EmailScreen.enterPassPhrase(wrongPassPhrase);
await EmailScreen.clickOkButton();
await NewMessageScreen.checkError(wrongPassPhraseError);
await NewMessageScreen.clickOkButtonOnError();
await BaseScreen.checkErrorModal(wrongPassPhraseError);
await BaseScreen.clickOkButtonOnError();
//Set correct pass phrase
await NewMessageScreen.clickSendButton();
await EmailScreen.enterPassPhrase(passPhrase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { MockApi } from 'api-mocks/mock';
import {
SplashScreen,
} from '../../../screenobjects/all-screens';
import BaseScreen from "../../../screenobjects/base.screen";


describe('SETUP: ', () => {
Expand All @@ -11,9 +12,7 @@ describe('SETUP: ', () => {
mockApi.fesConfig = { clientConfiguration: { key_manager_url: 'INTENTIONAL BAD URL' } };
await mockApi.withMockedApis(async () => {
await SplashScreen.login();
// todo - replace the following pause with wait for modal error
// that says "Please check if key manager url set correctly"
await browser.pause(5000);
await BaseScreen.checkErrorModal('Please check if key manager url set correctly');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { MockApi } from 'api-mocks/mock';
import {
SplashScreen,
} from '../../../screenobjects/all-screens';
import BaseScreen from "../../../screenobjects/base.screen";


describe('SETUP: ', () => {
Expand All @@ -11,9 +12,7 @@ describe('SETUP: ', () => {
mockApi.fesConfig = { returnError: { code: 400, message: "some client err" } };
await mockApi.withMockedApis(async () => {
await SplashScreen.login();
// todo - replace the following pause with wait for modal error
await browser.pause(5000);
await BaseScreen.checkErrorModalForFES('EnterpriseServerApi 400 message:some client err get http://127.0.0.1:8001/fes/api/');
});
});

});