Skip to content

Commit

Permalink
Update homeworks
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolavn committed Jun 20, 2016
1 parent 6b2a82e commit c5b9ba6
Show file tree
Hide file tree
Showing 196 changed files with 891,212 additions and 1 deletion.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public void CreateProject()
{
Manager.LaunchNewApplication(new ProcessStartInfo(appPath));

Manager.ActiveApplication.MainWindow.Find.ByName("File").User.Click();
Manager.ActiveApplication.MainWindow.Find.ByTextContent("New Project...").User.Click();
Manager.ActiveApplication.WaitForWindow("New Project");
}
}
}
Binary file added Quality Assurance/AppiumDemo.zip
Binary file not shown.
22 changes: 22 additions & 0 deletions Quality Assurance/AppiumDemo/AppiumDemo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppiumDemo", "AppiumDemo\AppiumDemo.csproj", "{5E01211E-5354-4238-9EB9-D1497494C73B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5E01211E-5354-4238-9EB9-D1497494C73B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E01211E-5354-4238-9EB9-D1497494C73B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E01211E-5354-4238-9EB9-D1497494C73B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E01211E-5354-4238-9EB9-D1497494C73B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
112 changes: 112 additions & 0 deletions Quality Assurance/AppiumDemo/AppiumDemo/AppiumDemo.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5E01211E-5354-4238-9EB9-D1497494C73B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AppiumDemo</RootNamespace>
<AssemblyName>AppiumDemo</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="appium-dotnet-driver, Version=1.5.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\TestFolder\appium-dotnet-driver\appium-dotnet-driver\bin\Debug\appium-dotnet-driver.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="WebDriver, Version=2.48.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Selenium.WebDriver.2.48.2\lib\net40\WebDriver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="WebDriver.Support, Version=2.48.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Selenium.Support.2.48.2\lib\net40\WebDriver.Support.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
<Private>False</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NativeApp.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
160 changes: 160 additions & 0 deletions Quality Assurance/AppiumDemo/AppiumDemo/NativeApp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
namespace AppiumDemo
{
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium.Android;
using System.IO;
using System.Collections.ObjectModel;
using OpenQA.Selenium.Appium.Service;
using OpenQA.Selenium.Appium.Service.Options;
using OpenQA.Selenium;

[TestClass]
public class NativeApp
{
private const string TestHeight = "201";
private const string TestWeight = "153";
private const string TestName = "Bai Ivan";

private static AppiumLocalService service;
private static AppiumDriver<AndroidElement> driver;

//private TestContext testContextInstance;

//public TestContext TestContext
//{
// get
// {
// return testContextInstance;
// }
// set
// {
// testContextInstance = value;
// }
//}

[ClassInitialize]
public static void ClassInit(TestContext testContext)
{
//Start Appium Server
var avdOptions = new KeyValuePair<string, string>("--avd", "Api19");
//var avdParamsOptions = new KeyValuePair<string, string>("--avd-args", "\"-scale 0.50\"");
OptionCollector args = new OptionCollector();
args.AddArguments(avdOptions);
//args.AddArguments(avdParamsOptions);

var platform = Platform.CurrentPlatform;

service = new AppiumServiceBuilder()
.WithAppiumJS(new FileInfo(@"C:\Users\Asus\AppData\Roaming\npm\node_modules\appium\bin\appium.js"))
.UsingDriverExecutable(new FileInfo(@"C:\Program Files\nodejs\node.exe"))
.WithArguments(args)
.UsingPort(4723)
.Build();


service.Start();
Assert.IsTrue(service.IsRunning);

// Start Appium Client
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("deviceName", "Api19");
capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("app", @"D:\fitness.apk");
driver = new AndroidDriver<AndroidElement>(service.ServiceUrl, capabilities, TimeSpan.FromSeconds(60));
}

[ClassCleanup]
public static void ClassCleanup()
{
driver.Quit();
service.Dispose();
}

[TestInitialize]
public void TestInit()
{
driver.ResetApp();
}

[TestCleanup]
public void TestCleanup()
{
}

private static AndroidElement Slider => driver.FindElementByClassName("android.widget.SeekBar");

private static AndroidElement Name => driver.FindElementByClassName("android.widget.Button");

private static ReadOnlyCollection<AndroidElement> NotificationSwitches => driver.FindElementsByClassName("android.widget.Switch");

private static ReadOnlyCollection<AndroidElement> ProfileDetails => driver.FindElementsByClassName("android.widget.EditText");


enum Directions { Up, Down };

private static void Swipe(Directions direction)
{
var height = driver.Manage().Window.Size.Height;
var width = driver.Manage().Window.Size.Width;

int startX = width / 2;
int startY = height / 2;
int endX = width / 2;
int endY = height / 2;

if (direction == Directions.Down)
{
startY = Convert.ToInt32(height * 0.75);
endY = Convert.ToInt32(height * 0.25);
}
else if (direction == Directions.Up)
{
startY = Convert.ToInt32(height * 0.25);
endY = Convert.ToInt32(height * 0.75);
}

driver.Swipe(startX, startY, endX, endY, 1000);
}

[TestMethod]
public void TurnSwitchesToOff()
{
foreach (var sw in NotificationSwitches)
{
if (sw.Text == "ON")
{
sw.Click();
}
}

Assert.IsFalse(Slider.Enabled);
}

[TestMethod]
public void EditHeightAndWeight()
{
ProfileDetails[0].Click();
driver.Keyboard.SendKeys(TestHeight);
ProfileDetails[1].Click();
driver.Keyboard.SendKeys(TestWeight);
driver.BackgroundApp(10);

Assert.AreEqual(TestHeight, ProfileDetails[0].Text);
Assert.AreEqual(TestWeight, ProfileDetails[1].Text);
}

[TestMethod]
public void EditName()
{
Name.Click();
driver.Keyboard.SendKeys(TestName);
driver.BackgroundApp(10);

Assert.AreEqual(TestName, Name.Text);
}
}
}
36 changes: 36 additions & 0 deletions Quality Assurance/AppiumDemo/AppiumDemo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AppiumDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AppiumDemo")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5e01211e-5354-4238-9eb9-d1497494c73b")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
11 changes: 11 additions & 0 deletions Quality Assurance/AppiumDemo/AppiumDemo/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
8 changes: 8 additions & 0 deletions Quality Assurance/AppiumDemo/AppiumDemo/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Appium.WebDriver" version="1.5.0.1" targetFramework="net452" />
<package id="Castle.Core" version="3.3.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net452" />
<package id="Selenium.Support" version="2.48.2" targetFramework="net452" />
<package id="Selenium.WebDriver" version="2.48.2" targetFramework="net452" />
</packages>
Binary file added Quality Assurance/Homework.zip
Binary file not shown.
Binary file added Quality Assurance/QAMailbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions Quality Assurance/Security Issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
###1. XSS

- Password visible in browser address
- Creating user:
```javascript
/script><script>
```
breaks site

- Upload site with hidden Javascript

###2. SQL Injection

- Drop table
```sql
'OR''=';DROP TABLE USERS // 1;DROP TABLE users
```
- Delete content of users
```sql
1;(DELETE * FROM users)
```
- Update password
```sql
1;UPDATE TABLE users SET password = "123" WHERE name="jake"
```

Binary file added Quality Assurance/Sikuli Homework.zip
Binary file not shown.
1 change: 1 addition & 0 deletions Quality Assurance/Sikuli Homework/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c5b9ba6

Please sign in to comment.