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: 29 additions & 0 deletions appium/api-mocks/apis/attester/attester-endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,34 @@ T/X6OnVQdcOI7SvdQI74SxbaHnEeCLDEk7dOhWLJBLuZwK7M3cT6BX+V2v6Fm7SX0hSpDg1HK0KL
qHJuDNEmMUvx3cMUd5HtsOFO9JapCp1iCVo2p49CIXA4NUrLETNM2ZddknhbFm8bsK48tTJEH6l4
Wq3aCVXYGg==
=Ldag
-----END PGP PUBLIC KEY BLOCK-----`,
keyOlderVersion: `-----BEGIN PGP PUBLIC KEY BLOCK-----

xjMEYd8pKhYJKwYBBAHaRw8BAQdAXQ9bBzlYPwy3mQD5MIQSkuOyEomESHHo
AAiUi0enB77NKFVwZGF0aW5nIGtleSA8dXBkYXRpbmcua2V5QGV4YW1wbGUu
dGVzdD7CeAQQFgoAIAUCYd8pKgYLCQcIAwIEFQgKAgQWAgEAAhkBAhsDAh4B
AAoJEMfJkMGi6njd9HUA/0ZdZaaOFy0hM+GpEnzK+A/G3bLe9Kulh4jT8+4j
JqcKAP0V+pga+B1v98aeF8cRlgQPEyWtYUqZLcDLBQ6r3BEfDM44BGHfKSoS
CisGAQQBl1UBBQEBB0BPkVSyVsZ+vsF4e4NbVsq/YNjqL0JQI+t6OHc5YxJS
SgMBCAfCYQQYFggACQUCYd8pKgIbDAAKCRDHyZDBoup43Y+gAQDSVD/EDqCE
dSL33ptMlhwRCKHGiKcVmKwucxYkk6apFQEA018565fZcvtb339L2s/IIxLs
4621FX8Sy6kpR7mAzQo=
=3UnZ
-----END PGP PUBLIC KEY BLOCK-----`,
keyNewerVersion: `-----BEGIN PGP PUBLIC KEY BLOCK-----

xjMEYd8pKhYJKwYBBAHaRw8BAQdAXQ9bBzlYPwy3mQD5MIQSkuOyEomESHHo
AAiUi0enB77NKFVwZGF0aW5nIGtleSA8dXBkYXRpbmcua2V5QGV4YW1wbGUu
dGVzdD7CeAQQFgoAIAUCYd8pKgYLCQcIAwIEFQgKAgQWAgEAAhkBAhsDAh4B
AAoJEMfJkMGi6njd9HUA/0ZdZaaOFy0hM+GpEnzK+A/G3bLe9Kulh4jT8+4j
JqcKAP0V+pga+B1v98aeF8cRlgQPEyWtYUqZLcDLBQ6r3BEfDM44BGHfKSoS
CisGAQQBl1UBBQEBB0BPkVSyVsZ+vsF4e4NbVsq/YNjqL0JQI+t6OHc5YxJS
SgMBCAfCYQQYFggACQUCYd8pKgIbDAAKCRDHyZDBoup43Y+gAQDSVD/EDqCE
dSL33ptMlhwRCKHGiKcVmKwucxYkk6apFQEA018565fZcvtb339L2s/IIxLs
4621FX8Sy6kpR7mAzQrOOARh3yuYEgorBgEEAZdVAQUBAQdAglzBCJCRj29J
THYvVGaNESiiVKmyrTEnXonGUS58TwMDAQgHwmEEGBYIAAkFAmHfK5gCGwwA
CgkQx8mQwaLqeN3PWwD9ErvC+ufnX0O2AmZDz67QfFH6tA1t1/wUEHgzBXEe
gc8BAMaYm3AlSGbX1rJYgUtCWukkLuURdECIzerG2UuP87ID
=dQen
-----END PGP PUBLIC KEY BLOCK-----`,
};
5 changes: 3 additions & 2 deletions appium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"ts-node": "^10.4.0",
"typescript": "^4.4.4",
"wdio-video-reporter": "^3.1.3",
"webdriverio": "^7.16.10"
"webdriverio": "^7.16.10",
"moment": "^2.29.1"
}
}
}
9 changes: 9 additions & 0 deletions appium/tests/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ export const CommonData = {
longEmail: {
message: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nText'
},
updateRecipientPublicKey: {
email: 'updating.key@example.test',
oldSignatureDate: 'Jan 12, 2022 at 11:16:58 AM',//time for CI runs
newSignatureDate: 'Jan 12, 2022 at 11:27:20 AM',//time for CI runs
// oldSignatureDate: 'Jan 12, 2022 at 9:16:58 PM', //- for local run
// newSignatureDate: 'Jan 12, 2022 at 9:27:20 PM', // for local run
Comment on lines +58 to +61
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's not good. Can you make sure that tests always run the iOS app on UTC time, both locally and in CI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think it is a timezone issue

Copy link
Collaborator

Choose a reason for hiding this comment

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

Of course it is a timezone issue. Can you set in appium runner to run the iOS simulator on UTC timezone regardless of the timezone of the host? There must be settings for it.

oldFingerprints: '7E181662A26EC6748D6FDB1CC7C990C1A2EA78DD, 5C23518345A6595E81EBFEFCA71D94A76202B1D0',
newFingerprints: '7E181662A26EC6748D6FDB1CC7C990C1A2EA78DD, 5C23518345A6595E81EBFEFCA71D94A76202B1D0, 40E4EE0325E38F717737889AC54F277266650211'
},
keyMismatchEmail: {
subject: 'Encrypted message with key mismatch',
message: 'Could not decrypt:',
Expand Down
5 changes: 5 additions & 0 deletions appium/tests/helpers/DataHelper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import moment from "moment";

class DataHelper {
static uniqueValue() {
return Math.random().toString(36).substring(2);
}
static convertDateToMSec = async (date: string ) => {
return await Date.parse(moment(date.replace('at', '')).toISOString())
}
}

export default DataHelper;
40 changes: 40 additions & 0 deletions appium/tests/helpers/PublicKeyHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import MailFolderScreen from "../screenobjects/mail-folder.screen";
import NewMessageScreen from "../screenobjects/new-message.screen";
import MenuBarScreen from "../screenobjects/menu-bar.screen";
import SettingsScreen from "../screenobjects/settings.screen";
import ContactScreen from "../screenobjects/contacts.screen";
import ContactPublicKeyScreen from "../screenobjects/contact-public-key.screen";
import PublicKeyDetailsScreen from "../screenobjects/public-key-details.screen";

class PublicKeyHelper {
static loadRecipientInComposeThenCheckSignatureAndFingerprints = async (userEmail: string, signatureDate: string , fingerprintsValue: string ) => {
await MailFolderScreen.checkInboxScreen();
await MailFolderScreen.clickCreateEmail();
await NewMessageScreen.setAddRecipient(userEmail);
await NewMessageScreen.checkAddedRecipient(userEmail);
await NewMessageScreen.clickBackButton();

// Go to Contacts screen
await MenuBarScreen.clickMenuIcon();
await MenuBarScreen.checkUserEmail();

await MenuBarScreen.clickSettingsButton();
await SettingsScreen.checkSettingsScreen();
await SettingsScreen.clickOnSettingItem('Contacts');

await ContactScreen.checkContactScreen();
await ContactScreen.checkContact(userEmail);

await ContactScreen.clickOnContact(userEmail);
await ContactPublicKeyScreen.checkPgpUserId(userEmail);
await ContactPublicKeyScreen.checkPublicKeyDetailsNotEmpty();
await ContactPublicKeyScreen.clickOnFingerPrint();

await PublicKeyDetailsScreen.checkPublicKeyDetailsScreen();
await PublicKeyDetailsScreen.checkPublicKeyNotEmpty();
await PublicKeyDetailsScreen.checkSignatureDateValue(signatureDate);
await PublicKeyDetailsScreen.checkFingerPrintsValue(fingerprintsValue);
}
}

export default PublicKeyHelper;
4 changes: 3 additions & 1 deletion appium/tests/screenobjects/all-screens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import MailFolderScreen from './mail-folder.screen';
import SearchScreen from './search.screen';
import OldVersionAppScreen from './old-version-app.screen';
import EmailProviderScreen from './email-provider.screen';
import PublicKeyDetailsScreen from './public-key-details.screen';

export {
SplashScreen,
Expand All @@ -29,5 +30,6 @@ export {
MailFolderScreen,
SearchScreen,
OldVersionAppScreen,
EmailProviderScreen
EmailProviderScreen,
PublicKeyDetailsScreen
};
22 changes: 4 additions & 18 deletions appium/tests/screenobjects/contact-public-key.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
BACK_BTN: '~aid-back-button',
KEY: '~Key',
PUBLIC_KEY: '-ios class chain:**/XCUIElementTypeOther/XCUIElementTypeStaticText[2]',
FINGERPRINT_VALUE: '~fingerprintValue',
CREATED_VALUE: '~createdAtValue',
EXPIRES_VALUE: '~expiresValue',
Expand All @@ -13,7 +11,7 @@ const SELECTORS = {
EXPIRES_LABEL: '~Expires:',
PGD_USER_ID_LABEL: '~User:',
PGD_USER_ID_EMAIL: '~userEmail',
TRASH_BUTTON: '~trash'
TRASH_BUTTON: '~trash',
};

class ContactPublicKeyScreen extends BaseScreen {
Expand All @@ -29,14 +27,6 @@ class ContactPublicKeyScreen extends BaseScreen {
return $(SELECTORS.BACK_BTN);
}

get key() {
return $(SELECTORS.KEY);
}

get publicKey() {
return $(SELECTORS.PUBLIC_KEY);
}

get fingerPrintLabel() {
return $(SELECTORS.FINGERPRINT_LABEL);
}
Expand Down Expand Up @@ -69,13 +59,6 @@ class ContactPublicKeyScreen extends BaseScreen {
return $(SELECTORS.PGD_USER_ID_EMAIL);
}

checkPublicKeyNotEmpty = async () => {
await (await this.key).waitForDisplayed();
const pubkeyEl = await this.publicKey;
await pubkeyEl.waitForExist();
expect(await pubkeyEl.getAttribute('value')).toBeTruthy();
}

checkPublicKeyDetailsNotEmpty = async () => {
await (await this.fingerPrintLabel).waitForDisplayed();
expect(await (await this.fingerPrintValue).getAttribute('value')).toBeTruthy();
Expand All @@ -99,6 +82,9 @@ class ContactPublicKeyScreen extends BaseScreen {
await ElementHelper.waitAndClick(await this.backButton);
}

clickTrashButton = async () => {
await ElementHelper.waitAndClick(await this.trashButton);
}
}

export default new ContactPublicKeyScreen();
10 changes: 10 additions & 0 deletions appium/tests/screenobjects/old-version-app.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ElementHelper from "../helpers/ElementHelper";
const SELECTORS = {
BACK_BUTTON: '~arrow left c',
SENDER_EMAIL: '~messageSenderLabel',
PUBLIC_KEY: '-ios class chain:**/XCUIElementTypeOther/XCUIElementTypeStaticText[2]'
};

class OldVersionAppScreen extends BaseScreen {
Expand All @@ -18,6 +19,9 @@ class OldVersionAppScreen extends BaseScreen {
get senderEmail() {
return $(SELECTORS.SENDER_EMAIL);
}
get publicKeyValue () {
return $(SELECTORS.PUBLIC_KEY);
}

clickBackButton = async () => {
await ElementHelper.waitAndClick(await this.backButton);
Expand All @@ -42,6 +46,12 @@ class OldVersionAppScreen extends BaseScreen {
await this.checkEmailSubject(subject);
await this.checkEmailText(text);
}

checkPublicKeyNotEmpty = async () => {
const pubkeyEl = await this.publicKeyValue;
await pubkeyEl.waitForExist();
expect(await pubkeyEl.getAttribute('value')).toBeTruthy();
}
}

export default new OldVersionAppScreen();
112 changes: 112 additions & 0 deletions appium/tests/screenobjects/public-key-details.screen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import BaseScreen from './base.screen';
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
BACK_BTN: '~aid-back-button',
SHARE_BUTTON: '~share',
COPY_BUTTON: '~copy',
KEY_LABEL: '~Key',
PUBLIC_KEY_VALUE: '~aid-signature-key',
TRASH_BUTTON: '~trash',
SIGNATURE_LABEL: '~Signature',
SIGNATURE_VALUE: '~aid-signature-date',
LAST_FETCHED_DATE_LABEL: '~Last fetched',
LAST_FETCHED_DATE_VALUE: '~aid-signature-fetched-date',
FINGERPRINTS_VALUE: '~aid-signature-fingerprints',
FINGERPRINTS_LABEL: '~Fingerprints'
};

class PublicKeyDetailsScreen extends BaseScreen {
constructor() {
super(SELECTORS.BACK_BTN);
}

get trashButton() {
return $(SELECTORS.TRASH_BUTTON);
}

get copyButton() {
return $(SELECTORS.COPY_BUTTON);
}

get shareButton() {
return $(SELECTORS.SHARE_BUTTON)
}

get backButton() {
return $(SELECTORS.BACK_BTN);
}

get keyLabel() {
return $(SELECTORS.KEY_LABEL);
}

get signatureLabel() {
return $(SELECTORS.SIGNATURE_LABEL)
}

get signatureValue() {
return $(SELECTORS.SIGNATURE_VALUE);
}

get publicKeyValue() {
return $(SELECTORS.PUBLIC_KEY_VALUE);
}

get lastFetchedDateLabel() {
return $(SELECTORS.LAST_FETCHED_DATE_LABEL)
}

get lastFetchedDateValue() {
return $(SELECTORS.LAST_FETCHED_DATE_VALUE)
}

get fingerprintsLabel() {
return $(SELECTORS.FINGERPRINTS_LABEL);
}

get fingerprintsValue() {
return $(SELECTORS.FINGERPRINTS_VALUE)
}

checkPublicKeyDetailsScreen = async () => {
await (await this.trashButton).waitForDisplayed();
await (await this.copyButton).waitForDisplayed();
await (await this.shareButton).waitForDisplayed();
await expect(await this.keyLabel).toBePresent();
await expect(await this.signatureLabel).toBePresent();
await expect(await this.lastFetchedDateLabel).toBePresent();
await expect(await this.fingerprintsLabel).toBePresent();
}

checkPublicKeyNotEmpty = async () => {
const pubkeyEl = await this.publicKeyValue;
await pubkeyEl.waitForExist();
expect(await pubkeyEl.getAttribute('value')).toBeTruthy();
}

checkSignatureDateValue = async (value: string) => {
const signatureValue = await this.signatureValue;
await signatureValue.waitForExist();
expect(await signatureValue.getValue()).toEqual(value);
}

getLastFetchedDateValue = async () => {
await (await this.lastFetchedDateLabel).waitForDisplayed();
const lastFetchedDate = await this.lastFetchedDateValue;
return (await lastFetchedDate.getAttribute('value'));
}

checkFingerPrintsValue = async (value: string) => {
const fingerprints = await this.fingerprintsValue;
await fingerprints.waitForExist();
expect(await fingerprints.getAttribute('value')).toEqual(value);
}

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

}

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

import { CommonData } from '../../../data';
Expand Down Expand Up @@ -73,6 +74,7 @@ describe('COMPOSE EMAIL: ', () => {
await ContactPublicKeyScreen.checkPgpUserId(firstContactEmail);
await ContactPublicKeyScreen.checkPublicKeyDetailsNotEmpty();
await ContactPublicKeyScreen.clickOnFingerPrint();
await ContactPublicKeyScreen.checkPublicKeyNotEmpty();
await PublicKeyDetailsScreen.checkPublicKeyDetailsScreen();
await PublicKeyDetailsScreen.checkPublicKeyNotEmpty();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
PublicKeyScreen,
ContactScreen,
ContactPublicKeyScreen,
SearchScreen
SearchScreen,
PublicKeyDetailsScreen
} from '../../../screenobjects/all-screens';
import {CommonData} from "../../../data";

Expand Down Expand Up @@ -62,7 +63,7 @@ describe('UPDATE: ', () => {
await ContactPublicKeyScreen.checkPgpUserId(firstContactEmail);
await ContactPublicKeyScreen.checkPublicKeyDetailsNotEmpty();
await ContactPublicKeyScreen.clickOnFingerPrint();
await ContactPublicKeyScreen.checkPublicKeyNotEmpty();
await OldVersionAppScreen.checkPublicKeyNotEmpty();

//close old app version
await driver.terminateApp(bundleId);
Expand All @@ -87,7 +88,7 @@ describe('UPDATE: ', () => {
await ContactPublicKeyScreen.checkPgpUserId(firstContactEmail);
await ContactPublicKeyScreen.checkPublicKeyDetailsNotEmpty();
await ContactPublicKeyScreen.clickOnFingerPrint();
await ContactPublicKeyScreen.checkPublicKeyNotEmpty();
await PublicKeyDetailsScreen.checkPublicKeyNotEmpty();

await ContactPublicKeyScreen.clickBackButton();
await ContactPublicKeyScreen.checkPgpUserId(firstContactEmail);
Expand Down
Loading