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

[Feature]: Storage State Authentication Provider #389

Open
Grant-Archibald-MS opened this issue Nov 8, 2024 · 2 comments
Open

[Feature]: Storage State Authentication Provider #389

Grant-Archibald-MS opened this issue Nov 8, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Grant-Archibald-MS
Copy link
Contributor

Is your feature request related to a problem? Please describe.

There is a need to provide headless authentication to execute tests in environments where one or more factors of authentication are required. The key problem is how to preserve the session state so that interactive or headless tests can be run on interactive desktop environments or headless CI/CD tests.

Describe the solution you'd like

The provider should have the ability to save and load the storage state for web based tests using the underlying Playwright browser subsystem of Test Engine.

It should provide a method to default the username from the userProfile name environment variable defined in the test settings.

The provider should observe the login process and detect a successful login by observing the network request/response for known patterns when integrating with Microsoft Entra for authentication. The detection should allow for cases like expiry of tokens and fail the test with descriptive error messages

It should also handle common error cases such as the user not being authenticated for the environment or not being licensed.

If scenarios like not authenticated for the environment or not licensed for the desired URL are found, it should update the ITestState so that the provider (e.g., Canvas App or Model Driven App) can be aware of valid login but invalid security setup.

The results of detected patterns should be made available to the Power Fx engine know of that state so that a test case can be created that validates that the user cannot access the desired location because of license or environment permissions.

The saved storage stage should be encrypted using the current users security context or reversable encryption key. If an invalid or encryption key is applied it should apply a backoff scheme for retry

The state file should be able to support login for multiple storage state files for different user profile values.

Describe alternatives you've considered

Samples to save the storage state

var context = await browser.NewContextAsync();
var page = await context.NewPageAsync();
await page.GotoAsync("https://example.com");
// Perform login actions
await context.StorageStateAsync(new BrowserContextStorageStateOptions { Path = "state.json" });

Sample to load state

var context = await browser.NewContextAsync(new BrowserNewContextOptions { StorageStatePath = "state.json" });
var page = await context.NewPageAsync();
await page.GotoAsync("https://example.com");

Additional context?

No response

@Grant-Archibald-MS Grant-Archibald-MS added the enhancement New feature or request label Nov 8, 2024
Grant-Archibald-MS added a commit that referenced this issue Nov 22, 2024
… Fx extensions (#380)

* Adding namespace checks and support for Power FX #330

* Adding TestEngine.PlaywrightScript() #335

* Adding TestEngine.PlaywrightAction() #337

* Adding TestEngine.PlaywrightAction docs

* Adding TestEngine.PlaywrightScript docs

* Update TestEngine.PlaywrightScript.md

* Initial portal provider

* Partial PowerApps Portal provider implementation

* WIP Power Apps Portal provider implementation

* Adding TestEngine.GetConnections()

* Test update

* Adding CreateConnection

* Adding TestEngine.CheckConnectionExists

* TestEngine.CreateConnection update

* Review edits

* Add TestEngine.UpdateConnectionReferences()

* Solution update

* Connection list

* Connection and format

* Export connections

* Package update

* NuGet version update

* NuGet Updates

* Playright updates

* Provider update

* Review edits.

* Update TestEngine namespace

* Power Apps Portal update

* Format updates

* Add default certificate provider

* Adding Variables ans Collection support

* Remoding date tets

* Adding TestEngine.SelectSection()

* Adding tests

* Format update

* Adding MDA module and CoE custom page Sample

* Review edit

* Adding browser locale change

* Adding Experimental.SelectControl() for MDA custom pages

* Adding WIP Experimental.SimulateDataverse()

* WIP SimuateDataverse GET list

* Update for $batch and Query

* Basic query use cases

* Update .Net 8.0

* Update to .Net 8

* Additional Context error handling

* Remove legacy player

* Adding SimulateConnector Power Fx function

* Updates for Debug/Trace logging

* Networking monitoring update

* Minior edits

* Simulate update

* WIP record implementation for SimulateDataverse and SimulateConnector

* Sign only Release build record SimulateDataverse and SimulateConnector

* Adding Mouse recording

* Recorder update and Experimental functions

* Review edits

* Reviw edits for .Net 8

* Review edits

* Adding parameter for custom page

* Adding audio recording

* Add audio event tracking

* Asing storage auth provider

* Suppotr for negative test case

* Adding error checks for storage state

* Adding NotificationTitle error detection

* Storage state and permissions example

* Update variable state

* Refactor to common PowerPlatformLogin

* Adding missing common files

* Review changes

* Adding storage state for #389

* Update samples to storagestate

* Adding changes

* Log updates and Test Cases

* Format update and .Net 8.0 build

* Build update

* Pull request review edits

* Review edit

* Review changes

* Update dotnet-format.yml

* Adding docs
@Grant-Archibald-MS
Copy link
Contributor Author

Grant-Archibald-MS commented Nov 22, 2024

@Grant-Archibald-MS
Copy link
Contributor Author

Keeping feature request open as the user authentication provider still was items to complete before can close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant