Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
zunkas committed Dec 2, 2020
2 parents 22a6793 + c69b801 commit dc2393a
Show file tree
Hide file tree
Showing 13 changed files with 154 additions and 30 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/build_test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,46 +33,41 @@ jobs:
AZURE_WEBAPP_NAME: ${{ steps.setoutputvariables.outputs.AZURE_WEBAPP_NAME }}
PUBLISH_PROFILE: ${{ steps.setoutputvariables.outputs.PUBLISH_PROFILE }}
NUGETVERSIONV2: ${{ steps.setoutputvariables.outputs.NUGETVERSIONV2 }}


steps:
- uses: actions/checkout@v2

- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.3
uses: gittools/actions/gitversion/setup@v0.9.6
with:
versionSpec: '5.3.x'
versionSpec: '5.x.x'

- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow

- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/execute@v0.9.3
uses: gittools/actions/gitversion/execute@v0.9.6

- name: Set dev environment variables
uses: allenevans/set-env@v1.1.0
if: ${{ startsWith(github.ref, 'refs/heads/develop') }}
uses: allenevans/set-env@v2.0.0
if: ${{ startsWith(github.ref, 'refs/heads/develop') }} || ${{ github.event_name == 'pull_request' }}
with:
ENVIRONMENT: dev
AZURE_WEBAPP_NAME: svea-webpay-sdk-001-dev
NUGETVERSIONV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}

- name: Set uat environment variables
uses: allenevans/set-env@v1.1.0
uses: allenevans/set-env@v2.0.0
if: ${{ startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/') || contains(github.ref, '-beta')}}
with:
ENVIRONMENT: uat
AZURE_WEBAPP_NAME: svea-webpay-sdk-001-uat
NUGETVERSIONV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}

- name: Set pro environment variables
uses: allenevans/set-env@v1.1.0
uses: allenevans/set-env@v2.0.0
if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'refs/tags/*-*') }}
with:
ENVIRONMENT: pro
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Atata" Version="1.5.0" />
<PackageReference Include="Atata" Version="1.8.0" />
<PackageReference Include="Atata.WebDriverExtras" Version="1.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="83.0.4103.3900" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="86.0.4240.2200" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
<PackageReference Include="System.IO" Version="4.3.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
using NUnit.Framework.Internal.Commands;
using System;

namespace Sample.AspNetCore.SystemTests.Test.Base
{
/// <summary>
/// Specifies that a test method should be rerun on failure up to the specified
/// maximum number of times.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class RetryWithExceptionAttribute : NUnitAttribute, IRepeatTest
{
private readonly int _tryCount;

/// <summary>
/// Construct a <see cref="RetryAttribute" />
/// </summary>
/// <param name="tryCount">The maximum number of times the test should be run if it fails</param>
public RetryWithExceptionAttribute(int tryCount)
{
_tryCount = tryCount;
}

#region IRepeatTest Members

/// <summary>
/// Wrap a command and return the result.
/// </summary>
/// <param name="command">The command to be wrapped</param>
/// <returns>The wrapped command</returns>
public TestCommand Wrap(TestCommand command)
{
return new RetryCommand(command, _tryCount);
}

#endregion

#region Nested RetryCommand Class

/// <summary>
/// The test command for the <see cref="RetryAttribute"/>
/// </summary>
public class RetryCommand : DelegatingTestCommand
{
private readonly int _tryCount;

/// <summary>
/// Initializes a new instance of the <see cref="RetryCommand"/> class.
/// </summary>
/// <param name="innerCommand">The inner command.</param>
/// <param name="tryCount">The maximum number of repetitions</param>
public RetryCommand(TestCommand innerCommand, int tryCount)
: base(innerCommand)
{
_tryCount = tryCount;
}

/// <summary>
/// Runs the test, saving a TestResult in the supplied TestExecutionContext.
/// </summary>
/// <param name="context">The context in which the test should run.</param>
/// <returns>A TestResult</returns>
public override TestResult Execute(TestExecutionContext context)
{
int count = _tryCount;

while (count-- > 0)
{
try
{
context.CurrentResult = innerCommand.Execute(context);
}
// Commands are supposed to catch exceptions, but some don't
// and we want to look at restructuring the API in the future.
catch (Exception ex)
{
if (context.CurrentResult == null) context.CurrentResult = context.CurrentTest.MakeTestResult();
context.CurrentResult.RecordException(ex);
}

if (context.CurrentResult.ResultState != ResultState.Failure && context.CurrentResult.ResultState != ResultState.Error)
break;

// Clear result for retry
if (count > 0)
{
context.CurrentResult = context.CurrentTest.MakeTestResult();
context.CurrentRepeatCount++; // increment Retry count for next iteration. will only happen if we are guaranteed another iteration
}
}

return context.CurrentResult;
}
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected ThankYouPage GoToThankYouPage(Product[] products, Checkout.Option chec
try
{
return page
.PageUrl.WaitTo.Within(TimeSpan.FromSeconds(60)).Contain("thankyou")
.PageUrl.Should.Within(TimeSpan.FromSeconds(60)).Contain("thankyou")
.SwitchToRoot<ThankYouPage>()
.ThankYou.IsVisible.WaitTo.BeTrue();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Atata;
using NUnit.Framework;
using Sample.AspNetCore.SystemTests.Services;
using Sample.AspNetCore.SystemTests.Test.Base;
using Sample.AspNetCore.SystemTests.Test.Helpers;
using Svea.WebPay.SDK.PaymentAdminApi;
using System.Linq;
Expand All @@ -14,6 +15,7 @@ public AccountCreditOrderTests(string driverAlias)
{
}

[RetryWithException(3)]
[Test(Description = "4473: Köp som privatperson(kontokredit)-> makulera delbetalning, 4474: Köp som privatperson(kontokredit) -> leverera delbetalning -> kreditera delbetalning")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreateOrderWithAccountCreditAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -54,6 +56,7 @@ public async System.Threading.Tasks.Task CreateOrderWithAccountCreditAsPrivateAs
Assert.That(response.Deliveries.Count, Is.EqualTo(0));
}

[RetryWithException(3)]
[Test(Description = "4474: Köp som privatperson(kontokredit) -> leverera delbetalning -> kreditera delbetalning")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task DeliverWithAccountCreditAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -99,6 +102,7 @@ public async System.Threading.Tasks.Task DeliverWithAccountCreditAsPrivateAsync(
);
}

[RetryWithException(3)]
[Test(Description = "4474: Köp som privatperson(kontokredit) -> leverera delbetalning -> kreditera delbetalning")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreditWithAccountCreditAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -145,6 +149,7 @@ public async System.Threading.Tasks.Task CreditWithAccountCreditAsPrivateAsync(P
Assert.That(response.Deliveries.First().AvailableActions, Is.Empty);
}

[RetryWithException(3)]
[Test(Description = "4473: Köp som privatperson(kontokredit)-> makulera delbetalning")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CancelWithAccountCreditAsPrivateAsync(Product[] products)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Atata;
using NUnit.Framework;
using Sample.AspNetCore.SystemTests.Services;
using Sample.AspNetCore.SystemTests.Test.Base;
using Sample.AspNetCore.SystemTests.Test.Helpers;
using Svea.WebPay.SDK.PaymentAdminApi;
using System.Linq;
Expand All @@ -14,6 +15,7 @@ public CardOrderTests(string driverAlias)
{
}

[RetryWithException(3)]
[Test(Description = "4782: Köp som företag(kort)-> leverera korttransaktion -> makulera korttransaktion")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreateOrderWithCardAsCompanyAsync(Product[] products)
Expand Down Expand Up @@ -51,6 +53,7 @@ public async System.Threading.Tasks.Task CreateOrderWithCardAsCompanyAsync(Produ
Assert.That(response.Deliveries, Is.Null);
}

[RetryWithException(3)]
[Test(Description = "4782: Köp som företag(kort)-> leverera korttransaktion -> makulera korttransaktion")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task DeliverWithCardAsCompanyAsync(Product[] products)
Expand Down Expand Up @@ -95,6 +98,7 @@ public async System.Threading.Tasks.Task DeliverWithCardAsCompanyAsync(Product[]
Assert.That(response.Deliveries.First().AvailableActions, Is.Empty);
}

[RetryWithException(3)]
[Test(Description = "4772: Köp som privatperson i anonyma flödet(kort) -> makulera transaktion")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreditWithCardAsPrivateAnonymousAsync(Product[] products)
Expand Down Expand Up @@ -135,6 +139,7 @@ public async System.Threading.Tasks.Task CreditWithCardAsPrivateAnonymousAsync(P
Assert.That(response.Deliveries, Is.Null);
}

[RetryWithException(3)]
[Test(Description = "4771: Köp som företag i anonyma flödet(kort) -> makulera transaktion")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreditWithCardAsCompanyAnonymousAsync(Product[] products)
Expand Down Expand Up @@ -175,6 +180,7 @@ public async System.Threading.Tasks.Task CreditWithCardAsCompanyAnonymousAsync(P
Assert.That(response.Deliveries, Is.Null);
}

[RetryWithException(3)]
[Test(Description = "4782: Köp som företag(kort)-> leverera korttransaktion -> makulera korttransaktion")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CancelWithCardAsCompanyAsync(Product[] products)
Expand Down Expand Up @@ -215,6 +221,7 @@ public async System.Threading.Tasks.Task CancelWithCardAsCompanyAsync(Product[]
Assert.That(response.Deliveries, Is.Null);
}

[RetryWithException(3)]
[Test(Description = "4777: Köp som privatperson(kort)-> leverera korttransaktion -> makulera korttransaktion")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CancelWithCardAsPrivateAsync(Product[] products)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Atata;
using NUnit.Framework;
using Sample.AspNetCore.SystemTests.Services;
using Sample.AspNetCore.SystemTests.Test.Base;
using Sample.AspNetCore.SystemTests.Test.Helpers;
using Svea.WebPay.SDK.PaymentAdminApi;
using System.Linq;
Expand All @@ -14,6 +15,7 @@ public InvoiceOrderTests(string driverAlias)
{
}

[RetryWithException(3)]
[Test(Description = "4784: Köp som privatperson(faktura) -> leverera faktura -> kreditera faktura, 4783: Köp som privatperson(faktura) -> makulera faktura")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreateOrderWithInvoiceAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -57,6 +59,7 @@ public async System.Threading.Tasks.Task CreateOrderWithInvoiceAsPrivateAsync(Pr
Assert.That(response.Deliveries.Count, Is.EqualTo(0));
}

[RetryWithException(3)]
[Test(Description = "4784: Köp som privatperson(faktura) -> leverera faktura -> kreditera faktura")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task DeliverWithInvoiceAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -102,6 +105,7 @@ public async System.Threading.Tasks.Task DeliverWithInvoiceAsPrivateAsync(Produc
);
}

[RetryWithException(3)]
[Test(Description = "4784: Köp som privatperson(faktura) -> leverera faktura -> kreditera faktura")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreditWithInvoiceAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -148,6 +152,7 @@ public async System.Threading.Tasks.Task CreditWithInvoiceAsPrivateAsync(Product
Assert.That(response.Deliveries.First().AvailableActions, Is.Empty);
}

[RetryWithException(3)]
[Test(Description = "4776: Köp som företag(faktura) -> leverera faktura -> kreditera faktura")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreditWithInvoiceAsCompanyAsync(Product[] products)
Expand Down Expand Up @@ -194,6 +199,7 @@ public async System.Threading.Tasks.Task CreditWithInvoiceAsCompanyAsync(Product
Assert.That(response.Deliveries.First().AvailableActions, Is.Empty);
}

[RetryWithException(3)]
[Test(Description = "4783: Köp som privatperson(faktura) -> makulera faktura")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CancelWithInvoiceAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -234,6 +240,7 @@ public async System.Threading.Tasks.Task CancelWithInvoiceAsPrivateAsync(Product
Assert.That(response.Deliveries.Count, Is.EqualTo(0));
}

[RetryWithException(3)]
[Test(Description = "4775: Köp som företag(faktura) -> makulera faktura")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CancelWithInvoiceAsCompanyAsync(Product[] products)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Atata;
using NUnit.Framework;
using Sample.AspNetCore.SystemTests.Services;
using Sample.AspNetCore.SystemTests.Test.Base;
using Sample.AspNetCore.SystemTests.Test.Helpers;
using Svea.WebPay.SDK.PaymentAdminApi;
using System.Linq;
Expand All @@ -14,6 +15,7 @@ public PaymentPlanOrderTests(string driverAlias)
{
}

[RetryWithException(3)]
[Test(Description = "4779: Köp som privatperson(delbetala) -> leverera delbetalning -> kreditera delbetalning")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreateOrderWithPaymentPlanAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -56,6 +58,7 @@ public async System.Threading.Tasks.Task CreateOrderWithPaymentPlanAsPrivateAsyn
Assert.That(response.Deliveries, Is.Null);
}

[RetryWithException(3)]
[Test(Description = "4779: Köp som privatperson(delbetala) -> leverera delbetalning -> kreditera delbetalning")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task DeliverWithPaymentPlanAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -101,6 +104,7 @@ public async System.Threading.Tasks.Task DeliverWithPaymentPlanAsPrivateAsync(Pr
);
}

[RetryWithException(3)]
[Test(Description = "4779: Köp som privatperson(delbetala) -> leverera delbetalning -> kreditera delbetalning")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CreditWithPaymentPlanAsPrivateAsync(Product[] products)
Expand Down Expand Up @@ -147,6 +151,7 @@ public async System.Threading.Tasks.Task CreditWithPaymentPlanAsPrivateAsync(Pro
Assert.That(response.Deliveries.First().AvailableActions, Is.Empty);
}

[RetryWithException(3)]
[Test(Description = "4778: Köp som privatperson(delbetala) -> makulera delbetalning")]
[TestCaseSource(nameof(TestData), new object[] { true })]
public async System.Threading.Tasks.Task CancelWithPaymentPlanAsPrivateAsync(Product[] products)
Expand Down
Loading

0 comments on commit dc2393a

Please sign in to comment.