diff --git a/README.md b/README.md index 3f958a3..76d1a2a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# testcafe-browser-natives +# testcafe-browser-tools -[![Build Status](https://travis-ci.org/DevExpress/testcafe-browser-natives.svg)](https://travis-ci.org/DevExpress/testcafe-browser-natives) +[![Build Status](https://travis-ci.org/DevExpress/testcafe-browser-tools.svg)](https://travis-ci.org/DevExpress/testcafe-browser-tools) -TestСafe Browser Natives is a TestCafe library for performing platform-dependent actions on browser windows. -Working with browsers is specific for each operating system and requires native code to deal with. Since TestCafe supports painless and simple installation, this package encapsulates pre-built binaries for all supported platforms and JS-wrappers around them. This helps end-users avoid running *post-npm-install* build actions. +TestСafe Browser Tools is an utility library for performing platform-dependent actions on browser windows. +Working with browsers is specific for each operating system and requires native code to deal with. In order to provide painless and simple installation, this package encapsulates pre-built binaries for all supported platforms and JS-wrappers around them. This helps end-users avoid running *post-npm-install* build actions.   #Build Process To build native binaries from source files, execute the gulp task corresponding to your operating system: @@ -19,7 +19,7 @@ The *bin* directory contains pre-built native binaries. Consider using them if y #Install ``` -$ npm install testcafe-browser-natives +$ npm install testcafe-browser-tools ``` #API Reference diff --git a/bin/win/close.exe b/bin/win/close.exe index 19cd36c..0f4f88e 100644 Binary files a/bin/win/close.exe and b/bin/win/close.exe differ diff --git a/bin/win/find-window.exe b/bin/win/find-window.exe index 2f1c106..d3e2bfd 100644 Binary files a/bin/win/find-window.exe and b/bin/win/find-window.exe differ diff --git a/bin/win/generate-thumbnail.exe b/bin/win/generate-thumbnail.exe index 9a73008..e71bf66 100644 Binary files a/bin/win/generate-thumbnail.exe and b/bin/win/generate-thumbnail.exe differ diff --git a/bin/win/get-window-size.exe b/bin/win/get-window-size.exe index 83056c9..330bff9 100644 Binary files a/bin/win/get-window-size.exe and b/bin/win/get-window-size.exe differ diff --git a/bin/win/maximize.exe b/bin/win/maximize.exe index 6200133..d9b66d0 100644 Binary files a/bin/win/maximize.exe and b/bin/win/maximize.exe differ diff --git a/bin/win/resize.exe b/bin/win/resize.exe index 09471ff..3f6d61f 100644 Binary files a/bin/win/resize.exe and b/bin/win/resize.exe differ diff --git a/bin/win/screenshot.exe b/bin/win/screenshot.exe index 365cad7..a10479d 100644 Binary files a/bin/win/screenshot.exe and b/bin/win/screenshot.exe differ diff --git a/bin/win/utils.dll b/bin/win/utils.dll index da309f5..155eac9 100644 Binary files a/bin/win/utils.dll and b/bin/win/utils.dll differ diff --git a/package.json b/package.json index efc734f..57c25ef 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { - "name": "testcafe-browser-natives", - "version": "0.16.1", - "description": "A library used by TestCafe for performing platform-dependent actions on browsers.", - "homepage": "https://github.com/DevExpress/testcafe-browser-natives", - "bugs": "https://github.com/DevExpress/testcafe-browser-natives/issues", + "name": "testcafe-browser-tools", + "version": "1.0.0", + "description": "An utility library for performing platform-dependent actions on browsers.", + "homepage": "https://github.com/DevExpress/testcafe-browser-tools", + "bugs": "https://github.com/DevExpress/testcafe-browser-tools/issues", "license": "MIT", "author": "Developer Express Inc.", "repository": { "type": "git", - "url": "https://github.com/DevExpress/testcafe-browser-natives.git" + "url": "https://github.com/DevExpress/testcafe-browser-tools.git" }, "engines": { "node": ">= 0.10" diff --git a/src/natives/close/win/Close.cs b/src/natives/close/win/Close.cs index 3922c0f..a7298ab 100644 --- a/src/natives/close/win/Close.cs +++ b/src/natives/close/win/Close.cs @@ -3,7 +3,7 @@ using System.Text; using System.Runtime.InteropServices; -namespace BrowserNatives { +namespace BrowserTools { class Close { //Const const UInt32 WM_CLOSE = 0x10; @@ -25,7 +25,7 @@ static void Main (string[] args) { string hWndStr = args[0]; - CloseWindow((IntPtr)int.Parse(hWndStr)); + CloseWindow((IntPtr)int.Parse(hWndStr)); } } -} \ No newline at end of file +} diff --git a/src/natives/close/win/close.csproj b/src/natives/close/win/close.csproj index b389710..07d13f6 100644 --- a/src/natives/close/win/close.csproj +++ b/src/natives/close/win/close.csproj @@ -7,7 +7,7 @@ {04A6CB59-0DDB-4BE7-B7A2-DCD2B0023DC3} Exe Properties - BrowserNatives + BrowserTools close v4.0 512 @@ -32,7 +32,7 @@ 4 - BrowserNatives.Close + BrowserTools.Close @@ -51,4 +51,4 @@ --> - \ No newline at end of file + diff --git a/src/natives/find-window/win/FindWindow.cs b/src/natives/find-window/win/FindWindow.cs index 159a8b5..7155090 100644 --- a/src/natives/find-window/win/FindWindow.cs +++ b/src/natives/find-window/win/FindWindow.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.Threading; -namespace BrowserNatives { +namespace BrowserTools { class FindWindow { //Consts const string IE_MAIN_WINDOW_CLASS_NAME = "IEFrame"; @@ -28,7 +28,7 @@ private static bool IsIEMainWindow (IntPtr hWnd) { private static bool CheckWindowTitle (IntPtr hWnd, ref string windowMark) { string title = Utils.GetWindowTitle(hWnd).ToLower(); - if (!title.Contains(windowMark.ToLower())) + if (!title.Contains(windowMark.ToLower())) return true; uint processID = 0; diff --git a/src/natives/find-window/win/find-window.csproj b/src/natives/find-window/win/find-window.csproj index a954cd4..b85f8eb 100644 --- a/src/natives/find-window/win/find-window.csproj +++ b/src/natives/find-window/win/find-window.csproj @@ -7,7 +7,7 @@ {16615D42-2D28-4B3B-9278-8F02D8EB96B9} Exe Properties - BrowserNatives + BrowserTools find-window v4.0 512 @@ -33,7 +33,7 @@ 4 - BrowserNatives.FindWindow + BrowserTools.FindWindow @@ -69,4 +69,4 @@ --> - \ No newline at end of file + diff --git a/src/natives/generate-thumbnail/any/generate-thumbnail.vcxproj b/src/natives/generate-thumbnail/any/generate-thumbnail.vcxproj index 880bcba..37efbe7 100644 --- a/src/natives/generate-thumbnail/any/generate-thumbnail.vcxproj +++ b/src/natives/generate-thumbnail/any/generate-thumbnail.vcxproj @@ -12,7 +12,7 @@ {A438BDF5-3173-4045-B6D7-C14AA431BCF0} - BrowserNatives + BrowserTools @@ -75,4 +75,4 @@ - \ No newline at end of file + diff --git a/src/natives/get-window-size/win/GetWindowSize.cs b/src/natives/get-window-size/win/GetWindowSize.cs index bbdddcb..c45576b 100644 --- a/src/natives/get-window-size/win/GetWindowSize.cs +++ b/src/natives/get-window-size/win/GetWindowSize.cs @@ -8,7 +8,7 @@ using System.Windows.Forms; using System.Threading; -namespace BrowserNatives { +namespace BrowserTools { class GetWindowSize { static void Main (string[] args) { if (args.Length != 1) { diff --git a/src/natives/get-window-size/win/get-window-size.csproj b/src/natives/get-window-size/win/get-window-size.csproj index 533c7af..d771806 100644 --- a/src/natives/get-window-size/win/get-window-size.csproj +++ b/src/natives/get-window-size/win/get-window-size.csproj @@ -7,7 +7,7 @@ {7C5ABA0D-970C-4E8E-962C-A006AEE1E271} Exe Properties - BrowserNatives + BrowserTools get-window-size v4.0 512 @@ -32,7 +32,7 @@ 4 - BrowserNatives.GetWindowSize + BrowserTools.GetWindowSize diff --git a/src/natives/maximize/win/Maximize.cs b/src/natives/maximize/win/Maximize.cs index 5ce8727..0fa00d9 100644 --- a/src/natives/maximize/win/Maximize.cs +++ b/src/natives/maximize/win/Maximize.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Text; -namespace BrowserNatives { +namespace BrowserTools { class Maximize { //Consts const int SW_SHOWMAXIMIZED = 3; diff --git a/src/natives/maximize/win/maximize.csproj b/src/natives/maximize/win/maximize.csproj index b3b6383..442e3b4 100644 --- a/src/natives/maximize/win/maximize.csproj +++ b/src/natives/maximize/win/maximize.csproj @@ -7,7 +7,7 @@ {A88A5114-CBC7-4730-87FB-D1512043EF7C} Exe Properties - BrowserNatives + BrowserTools maximize v4.0 512 @@ -48,7 +48,7 @@ 4 - BrowserNatives.Maximize + BrowserTools.Maximize diff --git a/src/natives/resize/win/Resize.cs b/src/natives/resize/win/Resize.cs index 63972dd..691db97 100644 --- a/src/natives/resize/win/Resize.cs +++ b/src/natives/resize/win/Resize.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Text; -namespace BrowserNatives { +namespace BrowserTools { class Resize { //Consts const int SW_RESTORE = 9; @@ -38,7 +38,7 @@ static void ResizeWindow (IntPtr hWnd, int width, int height) { WindowInfo wi = Utils.GetWindowInfo(hWnd); SetWindowPos( - hWnd, + hWnd, IntPtr.Zero, wi.rcWindow.left, wi.rcWindow.top, diff --git a/src/natives/resize/win/resize.csproj b/src/natives/resize/win/resize.csproj index a97ccfd..4634b2f 100644 --- a/src/natives/resize/win/resize.csproj +++ b/src/natives/resize/win/resize.csproj @@ -7,7 +7,7 @@ {A88A5114-CBC7-4730-87FB-D1512043EF7C} Exe Properties - BrowserNatives + BrowserTools resize v4.0 512 @@ -48,7 +48,7 @@ 4 - BrowserNatives.Resize + BrowserTools.Resize diff --git a/src/natives/screenshot/win/Screenshot.cs b/src/natives/screenshot/win/Screenshot.cs index f005e64..77db6bd 100644 --- a/src/natives/screenshot/win/Screenshot.cs +++ b/src/natives/screenshot/win/Screenshot.cs @@ -9,7 +9,7 @@ using System.Threading; using System.Linq; -namespace BrowserNatives { +namespace BrowserTools { class Screenshot { //Consts const int GW_CHILD = 5; diff --git a/src/natives/screenshot/win/screenshot.csproj b/src/natives/screenshot/win/screenshot.csproj index 69e5ead..ce70549 100644 --- a/src/natives/screenshot/win/screenshot.csproj +++ b/src/natives/screenshot/win/screenshot.csproj @@ -7,7 +7,7 @@ {7C5ABA0D-970C-4E8E-962C-A006AEE1E271} Exe Properties - BrowserNatives + BrowserTools screenshot v4.0 512 @@ -32,7 +32,7 @@ 4 - BrowserNatives.Screenshot + BrowserTools.Screenshot diff --git a/src/natives/utils/win/Utils.cs b/src/natives/utils/win/Utils.cs index a4fb9f3..1c1792d 100644 --- a/src/natives/utils/win/Utils.cs +++ b/src/natives/utils/win/Utils.cs @@ -4,8 +4,7 @@ using System.Runtime.InteropServices; using System.Threading; -namespace BrowserNatives -{ +namespace BrowserTools { //Win32 Type Definitions [StructLayout(LayoutKind.Sequential)] public struct Rect { diff --git a/src/natives/utils/win/utils.csproj b/src/natives/utils/win/utils.csproj index 34b2aec..79af581 100644 --- a/src/natives/utils/win/utils.csproj +++ b/src/natives/utils/win/utils.csproj @@ -7,7 +7,7 @@ {E75454E4-2FCE-4032-8C26-AACE8E8048B0} Library Properties - BrowserNatives + BrowserTools utils v4.0 512 @@ -44,11 +44,11 @@ - - \ No newline at end of file + diff --git a/test/playground/routes.js b/test/playground/routes.js index 3484bc0..b8ff1d1 100644 --- a/test/playground/routes.js +++ b/test/playground/routes.js @@ -1,8 +1,8 @@ -var path = require('path'); -var viewports = require('viewportsizes'); -var Promise = require('pinkie'); -var browserNatives = require('../../lib/index'); -var toAbsPath = require('read-file-relative').toAbsPath; +var path = require('path'); +var viewports = require('viewportsizes'); +var Promise = require('pinkie'); +var browserTools = require('../../lib/index'); +var toAbsPath = require('read-file-relative').toAbsPath; const WINDOW_NORMALIZING_DELAY = 1000; @@ -62,7 +62,7 @@ function getRequestedSize (params) { if (params.paramsType === 'width-height') return { width: Number(params.width), height: Number(params.height) }; - var deviceSize = browserNatives.getViewportSize(params.deviceName); + var deviceSize = browserTools.getViewportSize(params.deviceName); return params.orientation === 'portrait' ? { width: deviceSize.portraitWidth, height: deviceSize.landscapeWidth } : @@ -80,7 +80,7 @@ exports.init = function (appPort) { port = appPort; deviceNames = getDeviceNames(); - return browserNatives + return browserTools .getInstallations() .then(function (res) { installations = res; @@ -113,7 +113,7 @@ exports.open = function (req, res) { // sometimes the browser sends client size information before the 'open' function resolves. browsers.push(browser); - return browserNatives + return browserTools .open(browser.browserInfo, browser.pageUrl) .then(function () { res.locals = { id: browser.id, name: browser.name, deviceNames: deviceNames }; @@ -127,7 +127,7 @@ exports.open = function (req, res) { exports.close = function (req, res) { function close (browser) { - return browserNatives + return browserTools .close(browser.pageUrl) .then(function () { browsers = browsers.filter(function (item) { @@ -146,7 +146,7 @@ exports.resize = function (req, res) { var requestedSize = getRequestedSize(req.body); function resizeWindow () { - return browserNatives.resize( + return browserTools.resize( browser.pageUrl, browser.clientAreaSize.width, browser.clientAreaSize.height, @@ -156,8 +156,8 @@ exports.resize = function (req, res) { } // NOTE: We must resize the window twice if it is maximized. - // https://github.com/DevExpress/testcafe-browser-natives/issues/71 - return browserNatives + // https://github.com/DevExpress/testcafe-browser-tools/issues/71 + return browserTools .isMaximized(browser.pageUrl) .then(function (maximized) { if (!maximized) @@ -187,7 +187,7 @@ exports.resize = function (req, res) { exports.maximize = function (req, res) { function maximize (browser) { - return browserNatives + return browserTools .maximize(browser.pageUrl) .then(function () { res.set('content-type', 'text/plain').end(); @@ -223,10 +223,10 @@ exports.takeScreenshot = function (req, res) { thumbnailPath = path.join(screenshotDirPath, 'thumbnails', screenshotFilename); } - return browserNatives + return browserTools .screenshot(browser.pageUrl, screenshotPath) .then(function () { - return browserNatives.generateThumbnail(screenshotPath, thumbnailPath); + return browserTools.generateThumbnail(screenshotPath, thumbnailPath); }) .then(function () { if (!cachedScreenshots.length) { diff --git a/test/tests/open-test.js b/test/tests/open-test.js index d8e5347..c9b11d0 100644 --- a/test/tests/open-test.js +++ b/test/tests/open-test.js @@ -1,5 +1,5 @@ -var expect = require('chai').expect; -var browserNatives = require('../../lib/index'); +var expect = require('chai').expect; +var browserTools = require('../../lib/index'); describe('open', function () { it('Should raise an error if browser path is not specified', function (done) { @@ -7,7 +7,7 @@ describe('open', function () { path: '' }; - var open = browserNatives + var open = browserTools .open(browserInfo) .then(function () { throw new Error('Promise rejection expected'); @@ -28,7 +28,7 @@ describe('open', function () { path: './non-existent-browser.exe' }; - var open = browserNatives + var open = browserTools .open(browserInfo) .then(function () { throw new Error('Promise rejection expected'); @@ -51,7 +51,7 @@ describe('open', function () { winOpenCmdTemplate: 'echo test' }; - var open = browserNatives + var open = browserTools .open(browserInfo) .catch(function () { throw new Error('Promise resolution expected');