Skip to content
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

ISSUE-405: init commit with simple code gen #584

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

AzamatCherchesov
Copy link
Collaborator

No description provided.

@CLAassistant
Copy link

CLAassistant commented Sep 28, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@Nikitae57 Nikitae57 left a comment

Choose a reason for hiding this comment

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

Please:

  1. Create a new module, move the code there
  2. Split this file into multiple classes
  3. Write a couple of unit tests
  4. Would be great to generate a jar so users wouldn't need to compile this class

page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved
page-object-code-gen/createPageObjectFromUiDump.kt Outdated Show resolved Hide resolved

@Test
fun checkCodeGen() {
val jarFile = File("src/main/java/com/kaspresso/components/pageobjectcodegen/createKtfromDump.jar")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it will be better to move .jar file in separate folder (as adbserver does)

@Nikitae57 Nikitae57 self-requested a review January 24, 2024 07:26

for (element in screenElements) {
when (element.viewType) {
"ImageView" -> importsList.add("import io.guthub.kakaocup.kakao.image.KImageView")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: would be better to move string literals into constants or even evaluate package dynamically KImageView::class.qualifiedName


object SupportedViews {
val collectableElements = listOf("android.widget.Button", "android.widget.TextView", "android.widget.ImageView")
val elementsWithChild = listOf("androidx.recyclerview.widget.RecyclerView")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why only recycler view? Are there any problems with the scroll view, pager, horizontal scroll view etc.?

* output:
* Kotlin file with screen code in the same directory as jar execute
*/
fun main(vararg args: String) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, write more documentation (comments, methods documentation or even wiki file like we have in the docs/ folder). Some areas of your code are hard to understand. It would be easier to maintain your code if you express the concept behind code generation

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.

4 participants