-
Notifications
You must be signed in to change notification settings - Fork 11
appium test for keeping public keys updated #1321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
92fdf7e
added new spec for "app updates older public keys to newer but not vi…
acladima c660856
added fixes after testrun
acladima f20f238
added date for local/remote runs
acladima a1b55d7
added fixes for update spec
acladima 89b21c9
added fixes for old app version
acladima 162bc3d
added PubKeyHelper for checking publickey and fingerprints
acladima 687252a
update for checkSignatureAndFingerprint method
acladima dcdd8a9
added fixes after review
acladima File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
appium/tests/screenobjects/public-key-details.screen.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.