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

[FR] Add possibility to work with different pages for different resolution/devices/platforms #747

Open
goblinmaks opened this issue Jun 1, 2023 · 1 comment

Comments

@goblinmaks
Copy link
Contributor

goblinmaks commented Jun 1, 2023

It would be good if can add possibility to work with different pages for different page layout like resolution/device/platform without changing code of test or implementing additional logic related to page layout type.
Or provide example if this possibility already exist.

image

Thanks,

@YevgeniyShunevych
Copy link
Member

YevgeniyShunevych commented Jun 1, 2023

The main problem I see here is that Atata's generic page objects model cannot support that. You should pass explicit type of page object to Go.To<TPageObject>(...) method. If a test uses one of the page object types, the type cannot be replaced with another one on a fly. And the base type also would not work here, as base page object type should be generic.

For cases when you need to test multiple resolutions/devices/platforms I would try to configure single page object using multiple JSON config files that contain AtataContext attributes separate for each platform. Kind of you can have single AccountDetailsPage with control properties marked with common attributes (that suit all resolutions), Atata.json (default one with main settings), Atata.Tablet.json, Atata.Mobile.json, etc. The additional configs can add attributes for page object and its controls specific for the resolution. For example you can define different FindAttributes for different resolutions.

{
  "attributes": {
    "component": [
      {
        "type": "AccountDetailsPage",
        "attributes": [
          {
            "type": "attribute type",
            "{{attributeValueName}}": "value" // Any property or constructor parameter of attribute.
          }
        ],
        "properties": [
          {
            "name": "property name",
            "attributes": [
              {
                "type": "attribute type",
                "{{attributeValueName}}": "value" // Any property or constructor parameter of attribute.
              }
            ]
          },
          {
              //...
          }
        ]
      }
    ]
  }
}

I believe that it will not cover all scenarios, but most. For cases when application with different resolutions have completely different UI and behavior, configuring with attributes may not be enough. For such cases, separate resolution tests (with separate page objects as well) can be implemented, for desktop, mobile, tablet. And such tests can be enabled/disabled depending on target platform testing.

If you can, please provide a couple of issues that you have with different resolutions and I can try to help resolve that using the approach described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants