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

Convention-based loading of pages to sites #77

Open
chaganiu opened this issue Oct 26, 2020 · 2 comments
Open

Convention-based loading of pages to sites #77

chaganiu opened this issue Oct 26, 2020 · 2 comments

Comments

@chaganiu
Copy link

I'd like to get an opinion on loading pages to sites based on convetion.

If we were to enforce a directory structure (and namespace) like this:

- PageObjects
  - SiteName
    - PageName

and a config structure like this:

{
  "sites": {
    "siteName": {
      "pageName": "https://url.of.page.com"
    }
  }
}

we could then rely on the fully qualified namespace PageObjects.SiteName.PageName to add pages to a site and also look up the URLs for the site.

@tnypxl
Copy link
Owner

tnypxl commented Oct 26, 2020

@chaganiu

I like it. When BasinEnv.SetConfig() is called, I could check the existence of page object class files and throw a useful error when they don't exist.

My only question is, should pageName only be a url or should it be an object allowing other page-level configuration in addition to the url?

So for example:

{
  "sites": {
    "siteName": {
      "pageName": {
        "url": "https://url.of.page.com"
        ...
        ...
      }
    }
  }
}

@chaganiu
Copy link
Author

should it be an object allowing other page-level configuration in addition to the url?

yea that works.

as far as SetConfig how do you feel about using the pattern that appsettings.json uses in dotnet core? so config file names would be required to be in this format:

appsettings.json <-- main file
appsettings.qa.json <-- overrides for the qa env.

this way merging of config files into one IConfiguration object would be pretty simple.

var config = new ConfigurationBuilder()
  .SetBasePath(Root.Path.Of.Application)
  .AddJsonFile("appsettings.json")
  .AddJsonFile($"appsettings.{env}.json")
  .AddEnvironmentVariables()
  .Build();

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

No branches or pull requests

2 participants