Skip to content

Update aid in attachments tests#1228

Merged
sosnovsky merged 10 commits intomasterfrom
feature/issue-1218-aid
Dec 17, 2021
Merged

Update aid in attachments tests#1228
sosnovsky merged 10 commits intomasterfrom
feature/issue-1218-aid

Conversation

@Kharchevskyi
Copy link
Contributor

This PR updates aid to attachments tests

close #1218


Tests:

  • Tests updated

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • is documented clearly and usefully, or doesn't need documentation

@Kharchevskyi
Copy link
Contributor Author

@fcvakintos @sosnovsky @tomholub
Can you guys suggest me your setup for writing/executing Appium UI Tests?
What IDE are you using? Any tools except of appium-inspector?
Do I need to build app bundle exec fastlane build each time for verifing tests? or it is possible to execute test on builded app from Xcode (from DerivedData folder)?

@sosnovsky
Copy link
Collaborator

I write appium tests in VS Code, as it supports eslint and highlights code issues.
For testing I just copy FlowCrypt.app from /DerivedData/FlowCrypt-.../Build/Products/Debug-iphonesimulator to appium folder. No need to build app on each test run.

@Kharchevskyi
Copy link
Contributor Author

@sosnovsky great, thanks. Will try VS Code.

@tomholub
Copy link
Collaborator

@Kharchevskyi read steps at https://github.com/FlowCrypt/flowcrypt-ios/tree/master/appium first to get an overview. After that, if the information you needed to know was missing there, please add it (which IDE to use, etc).

In general, this kind of basic knowledge shouldn't be passed only person to person - it should be documented for the long term so that new team members, or our own non-ios developers can get involved easily when needed.

@Kharchevskyi
Copy link
Contributor Author

@sosnovsky @fcvakintos
Can you also suggest best practices to investigate issues?
Is it possible to enable logs or so?

Screenshot 2021-12-16 at 16 53 15

@tomholub will add this to Readme as well

@tomholub
Copy link
Collaborator

tomholub commented Dec 16, 2021

Your screenshot is missing reason why the test failed. It's supposed to have appium stack trace and show which test method was run and which selector was attempted etc.

With that information (missing above) it usually becomes clear. If still not clear, I watch the simulator go through the steps while looking at the source code of the tests. So that it becomes clear where it's getting stuck, and usually also why.

Try deleting contents of appium/tmp folder before the run, and then run it and see the files it produces there (else it's hard to find which file to look at). There should be some logs produced by the run, at least.

Looks like your test is failing for some fundamental reason, did it ever produce a simulator and run any steps?

@sosnovsky
Copy link
Collaborator

I was also able to get more appium logs by changing logLevel to debug here https://github.com/FlowCrypt/flowcrypt-ios/blob/master/appium/config/wdio.shared.conf.js#L19

@tomholub
Copy link
Collaborator

You guys should stop hoarding that kind of information 😆 if it's very useful, document it

@Kharchevskyi
Copy link
Contributor Author

@tomholub indeed appium stoped even launching a simulator and executing any tests.
Was trying to debug this. tmp folder is empty.

Only changes from yesterday successfull runs is only installed VS Code.

I have pushed latest commit to check whether this issue only locally on my machine, but maybe someone can suggest me where the issue could be?

@tomholub
Copy link
Collaborator

It doesn't even launch simulator? try the debug log suggested above

@Kharchevskyi
Copy link
Contributor Author

[0-9] 2021-12-16T15:59:24.223Z DEBUG @wdio/config:utils: Found 'ts-node' package, auto-compiling TypeScript files
[0-9] 2021-12-16T15:59:24.307Z DEBUG @wdio/local-runner:utils: init remote session
[0-9] 2021-12-16T15:59:24.310Z DEBUG @wdio/utils:initialiseServices: initialise service "appium" as NPM package
[0-9] RUNNING in /Users/antonkharchevskyi/git/flowcrypt-ios/appium/FlowCrypt.app - /tests/specs/live/inbox/ReadAttachmentEmail.spec.ts
[0-9] 2021-12-16T15:59:24.820Z DEBUG @wdio/local-runner:utils: init remote session
[0-9] 2021-12-16T15:59:24.821Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-9] 2021-12-16T15:59:24.904Z INFO webdriver: [POST] http://localhost:4723/session
[0-9] 2021-12-16T15:59:24.904Z INFO webdriver: DATA {
[0-9]   capabilities: {
[0-9]     alwaysMatch: {
[0-9]       platformName: 'iOS',
[0-9]       iosInstallPause: 5000,
[0-9]       deviceName: 'iPhone 13',
[0-9]       platformVersion: '15.0',
[0-9]       automationName: 'XCUITest',
[0-9]       app: '/Users/antonkharchevskyi/git/flowcrypt-ios/appium/FlowCrypt.app',
[0-9]       simpleIsVisibleCheck: true,
[0-9]       newCommandTimeout: 10000,
[0-9]       wdaLaunchTimeout: 300000,
[0-9]       wdaConnectionTimeout: 600000,
[0-9]       wdaStartupRetries: 4,
[0-9]       wdaStartupRetryInterval: 120000
[0-9]     },
[0-9]     firstMatch: [ {} ]
[0-9]   },
[0-9]   desiredCapabilities: {
[0-9]     platformName: 'iOS',
[0-9]     iosInstallPause: 5000,
[0-9]     deviceName: 'iPhone 13',
[0-9]     platformVersion: '15.0',
[0-9]     automationName: 'XCUITest',
[0-9]     app: '/Users/antonkharchevskyi/git/flowcrypt-ios/appium/FlowCrypt.app',
[0-9]     simpleIsVisibleCheck: true,
[0-9]     newCommandTimeout: 10000,
[0-9]     wdaLaunchTimeout: 300000,
[0-9]     wdaConnectionTimeout: 600000,
[0-9]     wdaStartupRetries: 4,
[0-9]     wdaStartupRetryInterval: 120000
[0-9]   }
[0-9] }
[0-9] 2021-12-16T16:00:54.881Z WARN webdriver: Request timed out! Consider increasing the "connectionRetryTimeout" option.

UPD: Removing node_modules and npm install helped once again)
Thanks!

},
sync: true,
logLevel: 'silent',
logLevel: 'debug',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tomholub are you ok with this log level? it is pretty verbose but easier to debug issues

Copy link
Collaborator

Choose a reason for hiding this comment

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

Surely there could be some options in between silent and debug. Do they have some sort of "normal" verbosity level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

debug, info, warn, error

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's try info, see if that gives enough clues without being too verbose

appium/README.md Outdated
Comment on lines +28 to +30
## Building app for testing
For debugging purposes instead of running `bundle exec fastlane build` you can copy `FlowCrypt.app` from `/DerivedData/FlowCrypt-.../Build/Products/Debug-iphonesimulator` (In Xcode open `Products` folder -> `FlowCrypt` -> `Show in Finder`) to appium folder.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please pay attention to the whole document holistically.. documentation must be as clean and orderly as code, if not more so.

@Kharchevskyi Kharchevskyi marked this pull request as ready for review December 17, 2021 10:24
@Kharchevskyi
Copy link
Contributor Author

@tomholub are you ok with changing accessibility ids gradually? or do I need to update all of existed?

sosnovsky
sosnovsky previously approved these changes Dec 17, 2021
Copy link
Collaborator

@sosnovsky sosnovsky left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@sosnovsky sosnovsky self-requested a review December 17, 2021 12:02
@sosnovsky sosnovsky enabled auto-merge (squash) December 17, 2021 12:59
Comment on lines 14 to +19
## Building app for testing

Run this in `flowcrypt-ios` folder: `bundle exec fastlane build`. This will produce folder `appium/FlowCrypt.app` that contains the built app.
1. Manually compile build from the current code:
- run `bundle exec fastlane build` in `flowcrypt-ios` folder
- it will produce `appium/FlowCrypt.app` for testing
2. Use the latest simulator build:
- copy `FlowCrypt.app` from `/DerivedData/FlowCrypt-.../Build/Products/Debug-iphonesimulator` (In Xcode open Products folder -> FlowCrypt -> Show in Finder).
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like you need to take both step 1 and then step 2 in sequence. Which is not true. These two are two alternative approaches, and should be documented as such.

Copy link
Collaborator

@tomholub tomholub left a comment

Choose a reason for hiding this comment

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

filed a separate issue for the comment above

@sosnovsky sosnovsky merged commit 8fd6083 into master Dec 17, 2021
@sosnovsky sosnovsky deleted the feature/issue-1218-aid branch December 17, 2021 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update accessibility ids per PR review comments

3 participants