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
40 changes: 22 additions & 18 deletions appium/tests/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,28 @@ export const CommonData = {
email: 'revoked@flowcrypt.com'
},
errors: {
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.'
noPublicKey: 'Error\n' +
'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: 'Error\n' +
'Could not compose message\n' +
'\n' +
'This pass phrase did not match your signing private key',
expiredPublicKey: 'Error\n' +
'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: 'Error\n' +
'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
33 changes: 8 additions & 25 deletions appium/tests/screenobjects/base.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ 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'
RETRY_BUTTON: '~Retry',
CURRENT_MODAL: '-ios predicate string:type == "XCUIElementTypeAlert"'
};

export default class BaseScreen {
Expand All @@ -16,20 +17,12 @@ 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)
static get currentModal() {
return $(SELECTORS.CURRENT_MODAL);
}

waitForScreen = async (isShown = true) => {
Expand All @@ -39,20 +32,10 @@ export default class BaseScreen {
});
}

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 checkModalMessage = async (message: string) => {
await expect(await this.currentModal).toBeDisplayed();
const alertText = await driver.getAlertText();
await expect(alertText).toEqual(message);
}

static clickOkButtonOnError = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('COMPOSE EMAIL: ', () => {
await NewMessageScreen.checkFilledComposeEmailInfo(expiredPublicKey, emailSubject, emailText);
await NewMessageScreen.clickSendButton();

await BaseScreen.checkErrorModal(expiredPublicKeyError);
await BaseScreen.checkModalMessage(expiredPublicKeyError);

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

await BaseScreen.checkErrorModal(revokedPublicKeyError);
await BaseScreen.checkModalMessage(revokedPublicKeyError);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ describe('COMPOSE EMAIL: ', () => {
await NewMessageScreen.checkFilledComposeEmailInfo(noPublicKeyRecipient, emailSubject, emailText);
await NewMessageScreen.clickSendButton();

await BaseScreen.checkErrorModal(noPublicKeyError);
await BaseScreen.checkModalMessage(noPublicKeyError);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('COMPOSE EMAIL: ', () => {
await NewMessageScreen.clickSendButton();
await EmailScreen.enterPassPhrase(wrongPassPhrase);
await EmailScreen.clickOkButton();
await BaseScreen.checkErrorModal(wrongPassPhraseError);
await BaseScreen.checkModalMessage(wrongPassPhraseError);
await BaseScreen.clickOkButtonOnError();
//Set correct pass phrase
await NewMessageScreen.clickSendButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('SETUP: ', () => {
};
await mockApi.withMockedApis(async () => {
await SplashScreen.login();
await BaseScreen.checkErrorModal('Please check if key manager url set correctly');
await BaseScreen.checkModalMessage('Error\n' + 'Please check if key manager url set correctly');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ describe('SETUP: ', () => {
};
await mockApi.withMockedApis(async () => {
await SplashScreen.login();
await BaseScreen.checkErrorModalForFES('EnterpriseServerApi 400 message:some client err get http://127.0.0.1:8001/fes/api/');
await BaseScreen.checkModalMessage('Startup Error\n' +
'EnterpriseServerApi 400 message:some client err get http://127.0.0.1:8001/fes/api/');
});
});
});