/
ExtensionMethods.cs
49 lines (44 loc) · 1.61 KB
/
ExtensionMethods.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using NuGetGallery.FunctionTests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FluentAutomation;
using FluentAutomation.Interfaces;
namespace NuGetGallery.FunctionalTests.Fluent
{
public static class ExtensionMethods
{
public static void LogOn(this INativeActionSyntaxProvider I, string userName, string password)
{
I.Open(UrlHelper.BaseUrl + "users/account/LogOn");
I.Expect.Url(x => x.LocalPath.Contains("LogOn"));
I.Enter(EnvironmentSettings.TestAccountName).In("#SignIn_UserNameOrEmail");
I.Enter(EnvironmentSettings.TestAccountPassword).In("#SignIn_Password");
I.Click("#signin-link");
}
public static void UploadPackageUsingUI(this INativeActionSyntaxProvider I, string fullPackagePath)
{
// Navigate to the Upload Package page. This will fail if the user never uploaded the previous package, hence the error handling.
I.Open(String.Format(UrlHelper.UploadPageUrl));
try
{
I.Expect.Url(x => x.AbsoluteUri.Contains("/packages/Upload"));
}
catch
{
I.Click("a[class='cancel']");
}
// Upload the package.
I.Click("input[name='UploadFile']");
I.Wait(5);
I.Type(fullPackagePath);
I.Press("{ENTER}");
I.Wait(5);
I.Click("input[value='Upload']");
}
}
}