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

feat: multiple users per alias #88

Merged
merged 15 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ public class TestConfiguration

private const string GetUserException = "Unable to retrieve user configuration. Please ensure a user with the given alias exists in the config.";

private int aliasIndex;
ngwalker marked this conversation as resolved.
Show resolved Hide resolved
private UserConfiguration currentUser;
ngwalker marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Initializes a new instance of the <see cref="TestConfiguration"/> class.
/// </summary>
public TestConfiguration()
{
this.BrowserOptions = new BrowserOptions();
this.aliasIndex = 0;
ngwalker marked this conversation as resolved.
Show resolved Hide resolved
}

/// <summary>
Expand Down Expand Up @@ -69,7 +73,24 @@ public UserConfiguration GetUser(string userAlias)
{
try
{
return this.Users.First(u => u.Alias == userAlias);
if (this.Users.Count > 1)
{
if (this.Users.Count - 1 == this.aliasIndex)
{
this.aliasIndex = 0;
}
else
{
this.currentUser = this.Users[this.aliasIndex];
this.aliasIndex++;
}

return this.currentUser;
}
else
{
return this.Users.First(u => u.Alias == userAlias);
}
ngwalker marked this conversation as resolved.
Show resolved Hide resolved
}
catch (Exception ex)
{
Expand All @@ -78,3 +99,4 @@ public UserConfiguration GetUser(string userAlias)
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<PackageReference Include="Microsoft.CrmSdk.XrmTooling.CoreAssembly" Version="9.1.0.64" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="87.0.4280.8800" />
<PackageReference Include="SpecFlow" Version="3.5.14" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="91.0.4472.10100" />
ngwalker marked this conversation as resolved.
Show resolved Hide resolved
<PackageReference Include="SpecFlow" Version="3.5.14" />
<PackageReference Include="SpecFlow.MsTest" Version="3.5.14" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.5.14" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ users:
- username: POWERAPPS_SPECFLOW_BINDINGS_TEST_ADMIN_USERNAME
password: POWERAPPS_SPECFLOW_BINDINGS_TEST_ADMIN_PASSWORD
alias: an admin
- username: POWERAPPS_SPECFLOW_BINDINGS_TEST_ADMIN_USERNAME2
password: POWERAPPS_SPECFLOW_BINDINGS_TEST_ADMIN_PASSWORD2
alias: an admin
- username: POWERAPPS_SPECFLOW_BINDINGS_TEST_ADMIN_USERNAME3
bancey marked this conversation as resolved.
Show resolved Hide resolved
password: POWERAPPS_SPECFLOW_BINDINGS_TEST_ADMIN_PASSWORD3
alias: an admin
- username: POWERAPPS_SPECFLOW_BINDINGS_TEST_ADMIN_USERNAME
alias: an aliased user