refactor app directory structure and add tests
This commit is contained in:
BIN
tests/firefox/Throbber-small.gif
Normal file
BIN
tests/firefox/Throbber-small.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 825 B |
23
tests/firefox/application.ini
Normal file
23
tests/firefox/application.ini
Normal file
@@ -0,0 +1,23 @@
|
||||
; This file is not used. If you modify it and want the application to use
|
||||
; your modifications, move it under the browser/ subdirectory and start with
|
||||
; the "-app /path/to/browser/application.ini" argument.
|
||||
[App]
|
||||
Vendor=Mozilla
|
||||
Name=Firefox
|
||||
RemotingName=firefox
|
||||
Version=45.4.0
|
||||
BuildID=20160905130425
|
||||
SourceRepository=https://hg.mozilla.org/releases/mozilla-esr45
|
||||
SourceStamp=1dc77ae31dc3ed2de5d156c2c1867098ccdebe9d
|
||||
ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
|
||||
[Gecko]
|
||||
MinVersion=45.4.0
|
||||
MaxVersion=45.4.0
|
||||
|
||||
[XRE]
|
||||
EnableProfileMigrator=1
|
||||
|
||||
[Crash Reporter]
|
||||
Enabled=1
|
||||
ServerURL=https://crash-reports.mozilla.com/submit?id={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&version=45.4.0&buildid=20160905130425
|
4167
tests/firefox/browser/blocklist.xml
Normal file
4167
tests/firefox/browser/blocklist.xml
Normal file
File diff suppressed because it is too large
Load Diff
1
tests/firefox/browser/chrome.manifest
Normal file
1
tests/firefox/browser/chrome.manifest
Normal file
@@ -0,0 +1 @@
|
||||
manifest components/components.manifest
|
BIN
tests/firefox/browser/chrome/icons/default/default16.png
Normal file
BIN
tests/firefox/browser/chrome/icons/default/default16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 829 B |
BIN
tests/firefox/browser/chrome/icons/default/default32.png
Normal file
BIN
tests/firefox/browser/chrome/icons/default/default32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
tests/firefox/browser/chrome/icons/default/default48.png
Normal file
BIN
tests/firefox/browser/chrome/icons/default/default48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
1
tests/firefox/browser/components/components.manifest
Normal file
1
tests/firefox/browser/components/components.manifest
Normal file
@@ -0,0 +1 @@
|
||||
binary-component libbrowsercomps.so
|
BIN
tests/firefox/browser/components/libbrowsercomps.so
Executable file
BIN
tests/firefox/browser/components/libbrowsercomps.so
Executable file
Binary file not shown.
8
tests/firefox/browser/crashreporter-override.ini
Normal file
8
tests/firefox/browser/crashreporter-override.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
; This file is in the UTF-8 encoding
|
||||
[Strings]
|
||||
; LOCALIZATION NOTE (CrashReporterProductErrorText2): The %s is replaced with a string containing detailed information.
|
||||
CrashReporterProductErrorText2=Firefox had a problem and crashed. We'll try to restore your tabs and windows when it restarts.\n\nUnfortunately the crash reporter is unable to submit a crash report.\n\nDetails: %s
|
||||
CrashReporterDescriptionText2=Firefox had a problem and crashed. We'll try to restore your tabs and windows when it restarts.\n\nTo help us diagnose and fix the problem, you can send us a crash report.
|
Binary file not shown.
BIN
tests/firefox/browser/features/loop@mozilla.org.xpi
Normal file
BIN
tests/firefox/browser/features/loop@mozilla.org.xpi
Normal file
Binary file not shown.
BIN
tests/firefox/browser/icons/mozicon128.png
Normal file
BIN
tests/firefox/browser/icons/mozicon128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
tests/firefox/browser/omni.ja
Normal file
BIN
tests/firefox/browser/omni.ja
Normal file
Binary file not shown.
BIN
tests/firefox/crashreporter
Executable file
BIN
tests/firefox/crashreporter
Executable file
Binary file not shown.
57
tests/firefox/crashreporter.ini
Normal file
57
tests/firefox/crashreporter.ini
Normal file
@@ -0,0 +1,57 @@
|
||||
; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
; This file is in the UTF-8 encoding
|
||||
[Strings]
|
||||
; LOCALIZATION NOTE (isRTL):
|
||||
; Leave this entry empty unless your language requires right-to-left layout,
|
||||
; for example like Arabic, Hebrew, Persian. If your language needs RTL, please
|
||||
; use the untranslated English word "yes" as value
|
||||
isRTL=
|
||||
CrashReporterTitle=Crash Reporter
|
||||
; LOCALIZATION NOTE (CrashReporterVendorTitle): %s is replaced with the vendor name. (i.e. "Mozilla")
|
||||
CrashReporterVendorTitle=%s Crash Reporter
|
||||
; LOCALIZATION NOTE (CrashReporterErrorText): %s is replaced with another string containing detailed information.
|
||||
CrashReporterErrorText=The application had a problem and crashed.\n\nUnfortunately, the crash reporter is unable to submit a report for this crash.\n\nDetails: %s
|
||||
; LOCALIZATION NOTE (CrashReporterProductErrorText2): The first %s is replaced with the product name (i.e. "Firefox"), the second is replaced with another string containing detailed information. These two substitutions can not be reordered!
|
||||
CrashReporterProductErrorText2=%s had a problem and crashed.\n\nUnfortunately, the crash reporter is unable to submit a crash report.\n\nDetails: %s
|
||||
CrashReporterSorry=We're Sorry
|
||||
; LOCALIZATION NOTE (CrashReporterDescriptionText2): The %s is replaced with the product name.
|
||||
CrashReporterDescriptionText2=%s had a problem and crashed.\n\nTo help us diagnose and fix the problem, you can send us a crash report.
|
||||
CrashReporterDefault=This application is run after a crash to report the problem to the application vendor. It should not be run directly.
|
||||
Details=Details…
|
||||
ViewReportTitle=Report Contents
|
||||
CommentGrayText=Add a comment (comments are publicly visible)
|
||||
ExtraReportInfo=This report also contains technical information about the state of the application when it crashed.
|
||||
; LOCALIZATION NOTE (CheckSendReport): The %s is replaced with the vendor name.
|
||||
CheckSendReport=Tell %s about this crash so they can fix it
|
||||
CheckIncludeURL=Include the address of the page I was on
|
||||
CheckAllowEmail=Allow %s to contact me about this report
|
||||
EmailGrayText=Enter your email address here
|
||||
ReportPreSubmit2=Your crash report will be submitted before you quit or restart.
|
||||
ReportDuringSubmit2=Submitting your report…
|
||||
ReportSubmitSuccess=Report submitted successfully!
|
||||
ReportSubmitFailed=There was a problem submitting your report.
|
||||
ReportResubmit=Resending reports that previously failed to send…
|
||||
; LOCALIZATION NOTE (Quit2): The %s is replaced with the product name.
|
||||
Quit2=Quit %s
|
||||
; LOCALIZATION NOTE (Restart): The %s is replaced with the product name.
|
||||
Restart=Restart %s
|
||||
Ok=OK
|
||||
Close=Close
|
||||
; LOCALIZATION NOTE (CrashID): The %s is replaced with the Crash ID from the server, which is a string like abc12345-6789-0abc-def1-23456abcdef1
|
||||
CrashID=Crash ID: %s
|
||||
; LOCALIZATION NOTE (CrashDetailsURL): The %s is replaced with a URL that the user can visit to view the crash details.
|
||||
CrashDetailsURL=You can view details of this crash at %s
|
||||
ErrorBadArguments=The application passed an invalid argument.
|
||||
ErrorExtraFileExists=The application didn't leave an application data file.
|
||||
ErrorExtraFileRead=Couldn't read the application data file.
|
||||
ErrorExtraFileMove=Couldn't move application data file.
|
||||
ErrorDumpFileExists=The application did not leave a crash dump file.
|
||||
ErrorDumpFileMove=Couldn't move crash dump.
|
||||
ErrorNoProductName=The application did not identify itself.
|
||||
ErrorNoServerURL=The application did not specify a crash reporting server.
|
||||
ErrorNoSettingsPath=Couldn't find the crash reporter's settings.
|
||||
ErrorCreateDumpDir=Couldn't create pending dump directory.
|
||||
; LOCALIZATION NOTE (ErrorEndOfLife): The %s is replaced with the product name.
|
||||
ErrorEndOfLife=The version of %s you are using is no longer supported. Crash reports are no longer being accepted for this version. Please consider upgrading to a supported version.
|
5
tests/firefox/defaults/pref/channel-prefs.js
Normal file
5
tests/firefox/defaults/pref/channel-prefs.js
Normal file
@@ -0,0 +1,5 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pref("app.update.channel", "esr");
|
10
tests/firefox/dependentlibs.list
Normal file
10
tests/firefox/dependentlibs.list
Normal file
@@ -0,0 +1,10 @@
|
||||
libnspr4.so
|
||||
libplc4.so
|
||||
libplds4.so
|
||||
libnssutil3.so
|
||||
libnss3.so
|
||||
libsmime3.so
|
||||
libssl3.so
|
||||
libmozsqlite3.so
|
||||
liblgpllibs.so
|
||||
libxul.so
|
BIN
tests/firefox/firefox
Executable file
BIN
tests/firefox/firefox
Executable file
Binary file not shown.
BIN
tests/firefox/firefox-bin
Executable file
BIN
tests/firefox/firefox-bin
Executable file
Binary file not shown.
5
tests/firefox/gmp-clearkey/0.1/clearkey.info
Normal file
5
tests/firefox/gmp-clearkey/0.1/clearkey.info
Normal file
@@ -0,0 +1,5 @@
|
||||
Name: clearkey
|
||||
Description: ClearKey Gecko Media Plugin
|
||||
Version: 1
|
||||
APIs: eme-decrypt-v8[org.w3.clearkey]
|
||||
Libraries:
|
BIN
tests/firefox/gmp-clearkey/0.1/libclearkey.so
Executable file
BIN
tests/firefox/gmp-clearkey/0.1/libclearkey.so
Executable file
Binary file not shown.
BIN
tests/firefox/icons/updater.png
Normal file
BIN
tests/firefox/icons/updater.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/firefox/libfreebl3.chk
Normal file
BIN
tests/firefox/libfreebl3.chk
Normal file
Binary file not shown.
BIN
tests/firefox/libfreebl3.so
Executable file
BIN
tests/firefox/libfreebl3.so
Executable file
Binary file not shown.
BIN
tests/firefox/liblgpllibs.so
Executable file
BIN
tests/firefox/liblgpllibs.so
Executable file
Binary file not shown.
BIN
tests/firefox/libmozsqlite3.so
Executable file
BIN
tests/firefox/libmozsqlite3.so
Executable file
Binary file not shown.
BIN
tests/firefox/libnspr4.so
Executable file
BIN
tests/firefox/libnspr4.so
Executable file
Binary file not shown.
BIN
tests/firefox/libnss3.so
Executable file
BIN
tests/firefox/libnss3.so
Executable file
Binary file not shown.
BIN
tests/firefox/libnssckbi.so
Executable file
BIN
tests/firefox/libnssckbi.so
Executable file
Binary file not shown.
BIN
tests/firefox/libnssdbm3.chk
Normal file
BIN
tests/firefox/libnssdbm3.chk
Normal file
Binary file not shown.
BIN
tests/firefox/libnssdbm3.so
Executable file
BIN
tests/firefox/libnssdbm3.so
Executable file
Binary file not shown.
BIN
tests/firefox/libnssutil3.so
Executable file
BIN
tests/firefox/libnssutil3.so
Executable file
Binary file not shown.
BIN
tests/firefox/libplc4.so
Executable file
BIN
tests/firefox/libplc4.so
Executable file
Binary file not shown.
BIN
tests/firefox/libplds4.so
Executable file
BIN
tests/firefox/libplds4.so
Executable file
Binary file not shown.
BIN
tests/firefox/libsmime3.so
Executable file
BIN
tests/firefox/libsmime3.so
Executable file
Binary file not shown.
BIN
tests/firefox/libsoftokn3.chk
Normal file
BIN
tests/firefox/libsoftokn3.chk
Normal file
Binary file not shown.
BIN
tests/firefox/libsoftokn3.so
Executable file
BIN
tests/firefox/libsoftokn3.so
Executable file
Binary file not shown.
BIN
tests/firefox/libssl3.so
Executable file
BIN
tests/firefox/libssl3.so
Executable file
Binary file not shown.
BIN
tests/firefox/libxul.so
Executable file
BIN
tests/firefox/libxul.so
Executable file
Binary file not shown.
BIN
tests/firefox/omni.ja
Normal file
BIN
tests/firefox/omni.ja
Normal file
Binary file not shown.
5
tests/firefox/platform.ini
Normal file
5
tests/firefox/platform.ini
Normal file
@@ -0,0 +1,5 @@
|
||||
[Build]
|
||||
BuildID=20160905130425
|
||||
Milestone=45.4.0
|
||||
SourceStamp=1dc77ae31dc3ed2de5d156c2c1867098ccdebe9d
|
||||
SourceRepository=https://hg.mozilla.org/releases/mozilla-esr45
|
BIN
tests/firefox/plugin-container
Executable file
BIN
tests/firefox/plugin-container
Executable file
Binary file not shown.
64
tests/firefox/precomplete
Normal file
64
tests/firefox/precomplete
Normal file
@@ -0,0 +1,64 @@
|
||||
remove "webapprt/webapprt.ini"
|
||||
remove "webapprt/omni.ja"
|
||||
remove "webapprt-stub"
|
||||
remove "updater.ini"
|
||||
remove "updater"
|
||||
remove "run-mozilla.sh"
|
||||
remove "removed-files"
|
||||
remove "precomplete"
|
||||
remove "plugin-container"
|
||||
remove "platform.ini"
|
||||
remove "omni.ja"
|
||||
remove "libxul.so"
|
||||
remove "libssl3.so"
|
||||
remove "libsoftokn3.so"
|
||||
remove "libsoftokn3.chk"
|
||||
remove "libsmime3.so"
|
||||
remove "libplds4.so"
|
||||
remove "libplc4.so"
|
||||
remove "libnssutil3.so"
|
||||
remove "libnssdbm3.so"
|
||||
remove "libnssdbm3.chk"
|
||||
remove "libnssckbi.so"
|
||||
remove "libnss3.so"
|
||||
remove "libnspr4.so"
|
||||
remove "libmozsqlite3.so"
|
||||
remove "liblgpllibs.so"
|
||||
remove "libfreebl3.so"
|
||||
remove "libfreebl3.chk"
|
||||
remove "icons/updater.png"
|
||||
remove "gmp-clearkey/0.1/libclearkey.so"
|
||||
remove "gmp-clearkey/0.1/clearkey.info"
|
||||
remove "firefox-bin"
|
||||
remove "firefox"
|
||||
remove "dependentlibs.list"
|
||||
remove "crashreporter.ini"
|
||||
remove "crashreporter"
|
||||
remove "browser/omni.ja"
|
||||
remove "browser/icons/mozicon128.png"
|
||||
remove "browser/features/loop@mozilla.org.xpi"
|
||||
remove "browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi"
|
||||
remove "browser/crashreporter-override.ini"
|
||||
remove "browser/components/libbrowsercomps.so"
|
||||
remove "browser/components/components.manifest"
|
||||
remove "browser/chrome/icons/default/default48.png"
|
||||
remove "browser/chrome/icons/default/default32.png"
|
||||
remove "browser/chrome/icons/default/default16.png"
|
||||
remove "browser/chrome.manifest"
|
||||
remove "browser/blocklist.xml"
|
||||
remove "application.ini"
|
||||
remove "Throbber-small.gif"
|
||||
rmdir "webapprt/"
|
||||
rmdir "icons/"
|
||||
rmdir "gmp-clearkey/0.1/"
|
||||
rmdir "gmp-clearkey/"
|
||||
rmdir "defaults/pref/"
|
||||
rmdir "defaults/"
|
||||
rmdir "browser/icons/"
|
||||
rmdir "browser/features/"
|
||||
rmdir "browser/extensions/"
|
||||
rmdir "browser/components/"
|
||||
rmdir "browser/chrome/icons/default/"
|
||||
rmdir "browser/chrome/icons/"
|
||||
rmdir "browser/chrome/"
|
||||
rmdir "browser/"
|
28
tests/firefox/removed-files
Normal file
28
tests/firefox/removed-files
Normal file
@@ -0,0 +1,28 @@
|
||||
distribution/extensions/testpilot@labs.mozilla.com.xpi
|
||||
chrome/
|
||||
#ifndef XP_MACOSX
|
||||
chrome/icons/
|
||||
chrome/icons/default/
|
||||
#endif
|
||||
chrome/overlayinfo/
|
||||
components/
|
||||
defaults/autoconfig/
|
||||
defaults/profile/
|
||||
defaults/profile/chrome/
|
||||
defaults/profile/US/*
|
||||
defaults/profile/extensions/
|
||||
defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
|
||||
distribution/
|
||||
distribution/extensions/
|
||||
extensions/
|
||||
extensions/inspector@mozilla.org/*
|
||||
extensions/reporter@mozilla.org/*
|
||||
extensions/talkback@mozilla.org/*
|
||||
extensions/testpilot@labs.mozilla.com/*
|
||||
extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/*
|
||||
extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
|
||||
greprefs/
|
||||
jssubloader/
|
||||
modules/
|
||||
searchplugins/*
|
||||
webapprt/components/
|
362
tests/firefox/run-mozilla.sh
Executable file
362
tests/firefox/run-mozilla.sh
Executable file
@@ -0,0 +1,362 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
cmdname=`basename "$0"`
|
||||
MOZ_DIST_BIN=`dirname "$0"`
|
||||
MOZ_DEFAULT_NAME="./${cmdname}-bin"
|
||||
MOZ_APPRUNNER_NAME="./mozilla-bin"
|
||||
MOZ_PROGRAM=""
|
||||
|
||||
exitcode=1
|
||||
#
|
||||
##
|
||||
## Functions
|
||||
##
|
||||
##########################################################################
|
||||
moz_usage()
|
||||
{
|
||||
echo "Usage: ${cmdname} [options] [program]"
|
||||
echo ""
|
||||
echo " options:"
|
||||
echo ""
|
||||
echo " -g Run in debugger."
|
||||
echo " --debug"
|
||||
echo ""
|
||||
echo " -d debugger Debugger to use."
|
||||
echo " --debugger debugger"
|
||||
echo ""
|
||||
echo " -a debugger_args Arguments passed to [debugger]."
|
||||
echo " --debugger-args debugger_args"
|
||||
echo ""
|
||||
echo " Examples:"
|
||||
echo ""
|
||||
echo " Run the mozilla-bin binary"
|
||||
echo ""
|
||||
echo " ${cmdname} mozilla-bin"
|
||||
echo ""
|
||||
echo " Debug the mozilla-bin binary in gdb"
|
||||
echo ""
|
||||
echo " ${cmdname} -g mozilla-bin -d gdb"
|
||||
echo ""
|
||||
echo " Run mozilla-bin under valgrind with arguments"
|
||||
echo ""
|
||||
echo " ${cmdname} -g -d valgrind -a '--tool=memcheck --leak-check=full' mozilla-bin"
|
||||
echo ""
|
||||
return 0
|
||||
}
|
||||
##########################################################################
|
||||
moz_bail()
|
||||
{
|
||||
message=$1
|
||||
echo
|
||||
echo "$cmdname: $message"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
##########################################################################
|
||||
moz_test_binary()
|
||||
{
|
||||
binary=$1
|
||||
if [ -f "$binary" ]
|
||||
then
|
||||
if [ -x "$binary" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
##########################################################################
|
||||
moz_get_debugger()
|
||||
{
|
||||
debuggers="ddd gdb dbx bdb native-gdb"
|
||||
debugger="notfound"
|
||||
done="no"
|
||||
for d in $debuggers
|
||||
do
|
||||
moz_test_binary /bin/which
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
dpath=`which ${d}`
|
||||
else
|
||||
dpath=`LC_MESSAGES=C type ${d} | awk '{print $3;}' | sed -e 's/\.$//'`
|
||||
fi
|
||||
if [ -x "$dpath" ]
|
||||
then
|
||||
debugger=$dpath
|
||||
break
|
||||
fi
|
||||
done
|
||||
echo $debugger
|
||||
return 0
|
||||
}
|
||||
##########################################################################
|
||||
moz_run_program()
|
||||
{
|
||||
prog=$MOZ_PROGRAM
|
||||
##
|
||||
## Make sure the program is executable
|
||||
##
|
||||
if [ ! -x "$prog" ]
|
||||
then
|
||||
moz_bail "Cannot execute $prog."
|
||||
fi
|
||||
##
|
||||
## Run the program
|
||||
##
|
||||
exec "$prog" ${1+"$@"}
|
||||
exitcode=$?
|
||||
}
|
||||
##########################################################################
|
||||
moz_debug_program()
|
||||
{
|
||||
prog=$MOZ_PROGRAM
|
||||
##
|
||||
## Make sure the program is executable
|
||||
##
|
||||
if [ ! -x "$prog" ]
|
||||
then
|
||||
moz_bail "Cannot execute $prog."
|
||||
fi
|
||||
if [ -n "$moz_debugger" ]
|
||||
then
|
||||
moz_test_binary /bin/which
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
debugger=`which $moz_debugger`
|
||||
else
|
||||
debugger=`LC_MESSAGES=C type $moz_debugger | awk '{print $3;}' | sed -e 's/\.$//'`
|
||||
fi
|
||||
else
|
||||
debugger=`moz_get_debugger`
|
||||
fi
|
||||
if [ -x "$debugger" ]
|
||||
then
|
||||
# If you are not using ddd, gdb and know of a way to convey the arguments
|
||||
# over to the prog then add that here- Gagan Saksena 03/15/00
|
||||
case `basename $debugger` in
|
||||
native-gdb) echo "$debugger $moz_debugger_args --args $prog" ${1+"$@"}
|
||||
exec "$debugger" $moz_debugger_args --args "$prog" ${1+"$@"}
|
||||
exitcode=$?
|
||||
;;
|
||||
gdb) echo "$debugger $moz_debugger_args --args $prog" ${1+"$@"}
|
||||
exec "$debugger" $moz_debugger_args --args "$prog" ${1+"$@"}
|
||||
exitcode=$?
|
||||
;;
|
||||
ddd) echo "$debugger $moz_debugger_args --gdb -- --args $prog" ${1+"$@"}
|
||||
exec "$debugger" $moz_debugger_args --gdb -- --args "$prog" ${1+"$@"}
|
||||
exitcode=$?
|
||||
;;
|
||||
*) echo "$debugger $moz_debugger_args $prog ${1+"$@"}"
|
||||
exec $debugger $moz_debugger_args "$prog" ${1+"$@"}
|
||||
exitcode=$?
|
||||
;;
|
||||
esac
|
||||
else
|
||||
moz_bail "Could not find a debugger on your system."
|
||||
fi
|
||||
}
|
||||
##########################################################################
|
||||
##
|
||||
## Command line arg defaults
|
||||
##
|
||||
moz_debug=0
|
||||
moz_debugger=""
|
||||
moz_debugger_args=""
|
||||
#
|
||||
##
|
||||
## Parse the command line
|
||||
##
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case $1 in
|
||||
-g | --debug)
|
||||
moz_debug=1
|
||||
shift
|
||||
;;
|
||||
-d | --debugger)
|
||||
moz_debugger=$2;
|
||||
if [ "${moz_debugger}" != "" ]; then
|
||||
shift 2
|
||||
else
|
||||
echo "-d requires an argument"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-a | --debugger-args)
|
||||
moz_debugger_args=$2;
|
||||
if [ "${moz_debugger_args}" != "" ]; then
|
||||
shift 2
|
||||
else
|
||||
echo "-a requires an argument"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
done
|
||||
#
|
||||
##
|
||||
## Program name given in $1
|
||||
##
|
||||
if [ $# -gt 0 ]
|
||||
then
|
||||
MOZ_PROGRAM=$1
|
||||
shift
|
||||
fi
|
||||
##
|
||||
## Program not given, try to guess a default
|
||||
##
|
||||
if [ -z "$MOZ_PROGRAM" ]
|
||||
then
|
||||
##
|
||||
## Try this script's name with '-bin' appended
|
||||
##
|
||||
if [ -x "$MOZ_DEFAULT_NAME" ]
|
||||
then
|
||||
MOZ_PROGRAM=$MOZ_DEFAULT_NAME
|
||||
##
|
||||
## Try mozilla-bin
|
||||
##
|
||||
elif [ -x "$MOZ_APPRUNNER_NAME" ]
|
||||
then
|
||||
MOZ_PROGRAM=$MOZ_APPRUNNER_NAME
|
||||
fi
|
||||
fi
|
||||
#
|
||||
#
|
||||
##
|
||||
## Make sure the program is executable
|
||||
##
|
||||
if [ ! -x "$MOZ_PROGRAM" ]
|
||||
then
|
||||
moz_bail "Cannot execute $MOZ_PROGRAM."
|
||||
fi
|
||||
#
|
||||
##
|
||||
## Set MOZILLA_FIVE_HOME
|
||||
##
|
||||
MOZILLA_FIVE_HOME=$MOZ_DIST_BIN
|
||||
|
||||
if [ -z "$MRE_HOME" ]; then
|
||||
MRE_HOME=$MOZILLA_FIVE_HOME
|
||||
fi
|
||||
##
|
||||
## Set LD_LIBRARY_PATH
|
||||
##
|
||||
## On Solaris we use $ORIGIN (set in RUNPATH) instead of LD_LIBRARY_PATH
|
||||
## to locate shared libraries.
|
||||
##
|
||||
## When a shared library is a symbolic link, $ORIGIN will be replaced with
|
||||
## the real path (i.e., what the symbolic link points to) by the runtime
|
||||
## linker. For example, if dist/bin/libxul.so is a symbolic link to
|
||||
## toolkit/library/libxul.so, $ORIGIN will be "toolkit/library" instead of "dist/bin".
|
||||
## So the runtime linker will use "toolkit/library" NOT "dist/bin" to locate the
|
||||
## other shared libraries that libxul.so depends on. This only happens
|
||||
## when a user (developer) tries to start firefox, thunderbird, or seamonkey
|
||||
## under dist/bin. To solve the problem, we should rely on LD_LIBRARY_PATH
|
||||
## to locate shared libraries.
|
||||
##
|
||||
## Note:
|
||||
## We test $MOZ_DIST_BIN/*.so. If any of them is a symbolic link,
|
||||
## we need to set LD_LIBRARY_PATH.
|
||||
##########################################################################
|
||||
moz_should_set_ld_library_path()
|
||||
{
|
||||
[ `uname -s` != "SunOS" ] && return 0
|
||||
for sharedlib in $MOZ_DIST_BIN/*.so
|
||||
do
|
||||
[ -h $sharedlib ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
if moz_should_set_ld_library_path
|
||||
then
|
||||
LD_LIBRARY_PATH=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}
|
||||
fi
|
||||
|
||||
if [ -n "$LD_LIBRARYN32_PATH" ]
|
||||
then
|
||||
LD_LIBRARYN32_PATH=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARYN32_PATH:+":$LD_LIBRARYN32_PATH"}
|
||||
fi
|
||||
if [ -n "$LD_LIBRARYN64_PATH" ]
|
||||
then
|
||||
LD_LIBRARYN64_PATH=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARYN64_PATH:+":$LD_LIBRARYN64_PATH"}
|
||||
fi
|
||||
if [ -n "$LD_LIBRARY_PATH_64" ]; then
|
||||
LD_LIBRARY_PATH_64=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARY_PATH_64:+":$LD_LIBRARY_PATH_64"}
|
||||
fi
|
||||
#
|
||||
#
|
||||
## Set SHLIB_PATH for HPUX
|
||||
SHLIB_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${SHLIB_PATH:+":$SHLIB_PATH"}
|
||||
#
|
||||
## Set LIBPATH for AIX
|
||||
LIBPATH=${MOZ_DIST_BIN}:${MRE_HOME}${LIBPATH:+":$LIBPATH"}
|
||||
#
|
||||
## Set DYLD_LIBRARY_PATH for Mac OS X (Darwin)
|
||||
DYLD_LIBRARY_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${DYLD_LIBRARY_PATH:+":$DYLD_LIBRARY_PATH"}
|
||||
#
|
||||
## Solaris Xserver(Xsun) tuning - use shared memory transport if available
|
||||
if [ "$XSUNTRANSPORT" = "" ]
|
||||
then
|
||||
XSUNTRANSPORT="shmem"
|
||||
XSUNSMESIZE="512"
|
||||
export XSUNTRANSPORT XSUNSMESIZE
|
||||
fi
|
||||
|
||||
# Disable Gnome crash dialog
|
||||
GNOME_DISABLE_CRASH_DIALOG=1
|
||||
export GNOME_DISABLE_CRASH_DIALOG
|
||||
|
||||
if [ "$moz_debug" -eq 1 ]
|
||||
then
|
||||
echo "MOZILLA_FIVE_HOME=$MOZILLA_FIVE_HOME"
|
||||
echo " LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
|
||||
if [ -n "$LD_LIBRARYN32_PATH" ]
|
||||
then
|
||||
echo "LD_LIBRARYN32_PATH=$LD_LIBRARYN32_PATH"
|
||||
fi
|
||||
if [ -n "$LD_LIBRARYN64_PATH" ]
|
||||
then
|
||||
echo "LD_LIBRARYN64_PATH=$LD_LIBRARYN64_PATH"
|
||||
fi
|
||||
if [ -n "$LD_LIBRARY_PATH_64" ]; then
|
||||
echo "LD_LIBRARY_PATH_64=$LD_LIBRARY_PATH_64"
|
||||
fi
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
echo "DISPLAY=$DISPLAY"
|
||||
fi
|
||||
if [ -n "$FONTCONFIG_PATH" ]; then
|
||||
echo "FONTCONFIG_PATH=$FONTCONFIG_PATH"
|
||||
fi
|
||||
if [ -n "$MOZILLA_POSTSCRIPT_PRINTER_LIST" ]; then
|
||||
echo "MOZILLA_POSTSCRIPT_PRINTER_LIST=$MOZILLA_POSTSCRIPT_PRINTER_LIST"
|
||||
fi
|
||||
echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH"
|
||||
echo " LIBRARY_PATH=$LIBRARY_PATH"
|
||||
echo " SHLIB_PATH=$SHLIB_PATH"
|
||||
echo " LIBPATH=$LIBPATH"
|
||||
echo " ADDON_PATH=$ADDON_PATH"
|
||||
echo " MOZ_PROGRAM=$MOZ_PROGRAM"
|
||||
echo " MOZ_TOOLKIT=$MOZ_TOOLKIT"
|
||||
echo " moz_debug=$moz_debug"
|
||||
echo " moz_debugger=$moz_debugger"
|
||||
echo "moz_debugger_args=$moz_debugger_args"
|
||||
fi
|
||||
#
|
||||
export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
|
||||
export SHLIB_PATH LIBPATH LIBRARY_PATH ADDON_PATH DYLD_LIBRARY_PATH
|
||||
|
||||
if [ $moz_debug -eq 1 ]
|
||||
then
|
||||
moz_debug_program ${1+"$@"}
|
||||
else
|
||||
moz_run_program ${1+"$@"}
|
||||
fi
|
||||
|
||||
exit $exitcode
|
5
tests/firefox/update-settings.ini
Normal file
5
tests/firefox/update-settings.ini
Normal file
@@ -0,0 +1,5 @@
|
||||
; If you modify this file updates may fail.
|
||||
; Do not modify this file.
|
||||
|
||||
[Settings]
|
||||
ACCEPTED_MAR_CHANNEL_IDS=firefox-mozilla-esr
|
BIN
tests/firefox/updater
Executable file
BIN
tests/firefox/updater
Executable file
Binary file not shown.
9
tests/firefox/updater.ini
Normal file
9
tests/firefox/updater.ini
Normal file
@@ -0,0 +1,9 @@
|
||||
; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
; This file is in the UTF-8 encoding
|
||||
; All strings must be less than 600 chars.
|
||||
[Strings]
|
||||
Title=Firefox Update
|
||||
Info=Firefox is installing your updates and will start in a few moments…
|
||||
MozillaMaintenanceDescription=The Mozilla Maintenance Service ensures that you have the latest and most secure version of Mozilla Firefox on your computer. Keeping Firefox up to date is very important for your online security, and Mozilla strongly recommends that you keep this service enabled.
|
BIN
tests/firefox/webapprt-stub
Executable file
BIN
tests/firefox/webapprt-stub
Executable file
Binary file not shown.
BIN
tests/firefox/webapprt/omni.ja
Normal file
BIN
tests/firefox/webapprt/omni.ja
Normal file
Binary file not shown.
20
tests/firefox/webapprt/webapprt.ini
Normal file
20
tests/firefox/webapprt/webapprt.ini
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
[App]
|
||||
ID=webapprt@mozilla.org
|
||||
Vendor=Mozilla
|
||||
; Note: the Windows stub executable sets nsXREAppData::name to the webapp
|
||||
; origin, overriding the value below, to make the app runner treat webapps
|
||||
; as distinct products, per bug 747409.
|
||||
Name=Webapp Runtime
|
||||
Version=45.4.0
|
||||
BuildID=20160905130425
|
||||
UAName=Firefox
|
||||
|
||||
[Gecko]
|
||||
MinVersion=45.4.0
|
||||
MaxVersion=45.4.0
|
||||
|
||||
[Crash Reporter]
|
||||
Enabled=1
|
||||
ServerURL=https://crash-reports.mozilla.com/submit?id=webapprt@mozilla.org&version=45.4.0&buildid=20160905130425
|
4
tests/index.js
Normal file
4
tests/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = (function(settings) {
|
||||
settings.test_workers = false;
|
||||
return settings;
|
||||
})(require('./nightwatch.json'));
|
1
tests/nightwatch.js
Normal file
1
tests/nightwatch.js
Normal file
@@ -0,0 +1 @@
|
||||
require('nightwatch/bin/runner.js');
|
38
tests/nightwatch.json
Normal file
38
tests/nightwatch.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"src_folders" : ["tests"],
|
||||
"output_folder" : "reports",
|
||||
"custom_commands_path" : "",
|
||||
"custom_assertions_path" : "",
|
||||
"page_objects_path" : "",
|
||||
"globals_path" : "",
|
||||
|
||||
"selenium" : {
|
||||
"start_process" : true,
|
||||
"server_path" : "selenium/selenium-server-standalone-2.53.1.jar",
|
||||
"log_path" : "",
|
||||
"host" : "127.0.0.1",
|
||||
"port" : 4987,
|
||||
"cli_args" : {
|
||||
"webdriver.chrome.driver" : "",
|
||||
"webdriver.ie.driver" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"test_settings" : {
|
||||
"default" : {
|
||||
"launch_url" : "file:///home/s2/Documents/Code/eclipse%20workspace/tasks/app/index.html",
|
||||
"selenium_port" : 4987,
|
||||
"selenium_host" : "localhost",
|
||||
"silent": true,
|
||||
"screenshots" : {
|
||||
"enabled" : true,
|
||||
"path" : "screenshots"
|
||||
},
|
||||
"desiredCapabilities": {
|
||||
"browserName": "firefox",
|
||||
"javascriptEnabled": true,
|
||||
"acceptSslCerts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
tests/node_modules/.bin/nightwatch
generated
vendored
Symbolic link
1
tests/node_modules/.bin/nightwatch
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../nightwatch/bin/nightwatch
|
21
tests/node_modules/nightwatch/LICENSE.md
generated
vendored
Normal file
21
tests/node_modules/nightwatch/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Andrei Rusu <andrei.rusu@beatfactor.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
51
tests/node_modules/nightwatch/README.md
generated
vendored
Normal file
51
tests/node_modules/nightwatch/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# Nightwatch
|
||||
|
||||
UI automated testing framework powered by [Node.js](http://nodejs.org/). It uses the [Selenium WebDriver API](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol).
|
||||
|
||||
[](https://travis-ci.org/nightwatchjs/nightwatch) [](http://badge.fury.io/js/nightwatch) [](https://coveralls.io/github/nightwatchjs/nightwatch?branch=master)
|
||||
|
||||
***
|
||||
|
||||
#### [Homepage](http://nightwatchjs.org) | [Developer Guide](http://nightwatchjs.org/guide) | [API Reference](http://nightwatchjs.org/api) | [Changelog](https://github.com/nightwatchjs/nightwatch/releases)
|
||||
|
||||
### Selenium WebDriver standalone server
|
||||
Nightwatch works with the Selenium standalone server so the first thing you need to do is download the selenium server jar file `selenium-server-standalone-2.x.x.jar` from the Selenium releases page:
|
||||
**https://selenium-release.storage.googleapis.com/index.html**
|
||||
|
||||
### Install Nightwatch
|
||||
|
||||
Install Node.js and then:
|
||||
```sh
|
||||
$ git clone https://github.com/nightwatchjs/nightwatch.git
|
||||
$ cd nightwatch
|
||||
$ npm install
|
||||
```
|
||||
|
||||
### Run tests
|
||||
The tests for Nightwatch are written using [Mocha](http://mochajs.org/) exports interface so they can also be run with Nightwatch itself.
|
||||
|
||||
To run the unit tests using mocha, do:
|
||||
|
||||
```sh
|
||||
$ npm test
|
||||
```
|
||||
|
||||
To run the unit tests using Nightwatch, do:
|
||||
|
||||
```sh
|
||||
$ npm run unit-tests
|
||||
```
|
||||
|
||||
To check test coverage, run the command:
|
||||
|
||||
```sh
|
||||
$ npm run mocha-coverage
|
||||
```
|
||||
and then open the generate file _coverage.html_ in your browser.
|
||||
|
||||
### Discuss
|
||||
The [Mailing List/Google Group](https://groups.google.com/forum/#!forum/nightwatchjs) is the most appropriate tool for Nightwatch related discussions. In addition, there is a [StackOverflow Nightwatch.js tag](http://stackoverflow.com/questions/tagged/nightwatch.js) at your disposal and [Twitter](https://twitter.com/nightwatchjs).
|
||||
|
||||
### Setup Guides
|
||||
Browser specific setup and usage guides along with debugging instructions can be found on the [**Wiki**](https://github.com/nightwatchjs/nightwatch/wiki).
|
||||
|
5
tests/node_modules/nightwatch/bin/.npmignore
generated
vendored
Normal file
5
tests/node_modules/nightwatch/bin/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
selenium-server-standalone-*
|
||||
chromedriver
|
||||
chromedriver-*
|
||||
phantomjs
|
||||
IEDriverServer_*
|
3
tests/node_modules/nightwatch/bin/nightwatch
generated
vendored
Executable file
3
tests/node_modules/nightwatch/bin/nightwatch
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
require('./runner.js');
|
||||
|
116
tests/node_modules/nightwatch/bin/nightwatch.json
generated
vendored
Normal file
116
tests/node_modules/nightwatch/bin/nightwatch.json
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"src_folders" : ["./examples/tests"],
|
||||
"output_folder" : "./examples/reports",
|
||||
"custom_commands_path" : "./examples/custom-commands",
|
||||
"page_objects_path" : "./examples/pages",
|
||||
"custom_assertions_path" : "",
|
||||
"globals_path" : "",
|
||||
"live_output" : false,
|
||||
"parallel_process_delay" : 10,
|
||||
"disable_colors": false,
|
||||
"test_workers" : false,
|
||||
|
||||
"selenium" : {
|
||||
"start_process" : false,
|
||||
"server_path" : "",
|
||||
"log_path" : "",
|
||||
"host" : "127.0.0.1",
|
||||
"port" : 4444,
|
||||
"cli_args" : {
|
||||
"webdriver.chrome.driver" : "",
|
||||
"webdriver.ie.driver" : "",
|
||||
"webdriver.firefox.profile" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"test_settings" : {
|
||||
"default" : {
|
||||
"launch_url" : "http://localhost",
|
||||
"selenium_host" : "127.0.0.1",
|
||||
"selenium_port" : 4444,
|
||||
"silent" : true,
|
||||
"disable_colors": false,
|
||||
"screenshots" : {
|
||||
"enabled" : false,
|
||||
"path" : ""
|
||||
},
|
||||
"desiredCapabilities" : {
|
||||
"browserName" : "firefox",
|
||||
"javascriptEnabled" : true,
|
||||
"acceptSslCerts" : true
|
||||
}
|
||||
},
|
||||
|
||||
"saucelabs" : {
|
||||
"selenium_host" : "ondemand.saucelabs.com",
|
||||
"selenium_port" : 80,
|
||||
"username" : "${SAUCE_USERNAME}",
|
||||
"access_key" : "${SAUCE_ACCESS_KEY}",
|
||||
"use_ssl" : false,
|
||||
"silent" : true,
|
||||
"output" : true,
|
||||
"screenshots" : {
|
||||
"enabled" : false,
|
||||
"on_failure" : true,
|
||||
"path" : ""
|
||||
},
|
||||
"desiredCapabilities": {
|
||||
"name" : "test-example",
|
||||
"browserName": "firefox"
|
||||
},
|
||||
"globals" : {
|
||||
"myGlobal" : "some_sauce_global"
|
||||
},
|
||||
"selenium" : {
|
||||
"start_process" : false
|
||||
}
|
||||
},
|
||||
|
||||
"phantomjs" : {
|
||||
"desiredCapabilities" : {
|
||||
"browserName" : "phantomjs",
|
||||
"javascriptEnabled" : true,
|
||||
"acceptSslCerts" : true,
|
||||
"phantomjs.binary.path" : "/path/to/phantomjs"
|
||||
}
|
||||
},
|
||||
|
||||
"browserstack" : {
|
||||
"selenium" : {
|
||||
"start_process" : false
|
||||
},
|
||||
"selenium_host" : "hub.browserstack.com",
|
||||
"selenium_port" : 80,
|
||||
"silent" : true,
|
||||
"desiredCapabilities": {
|
||||
"name" : "test-example",
|
||||
"browserName": "firefox",
|
||||
"browserstack.user" : "...",
|
||||
"browserstack.key" : "..."
|
||||
}
|
||||
},
|
||||
|
||||
"testingbot" : {
|
||||
"selenium_host" : "hub.testingbot.com",
|
||||
"selenium_port" : 80,
|
||||
"apiKey" : "${TB_KEY}",
|
||||
"apiSecret" : "${TB_SECRET}",
|
||||
"silent" : true,
|
||||
"output" : true,
|
||||
"screenshots" : {
|
||||
"enabled" : false,
|
||||
"on_failure" : true,
|
||||
"path" : ""
|
||||
},
|
||||
"desiredCapabilities": {
|
||||
"name" : "test-example",
|
||||
"browserName": "firefox"
|
||||
},
|
||||
"selenium" : {
|
||||
"start_process" : false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
16
tests/node_modules/nightwatch/bin/runner.js
generated
vendored
Normal file
16
tests/node_modules/nightwatch/bin/runner.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
var Logger = require('../lib/util/logger.js');
|
||||
var Nightwatch = require('../lib/index.js');
|
||||
var Utils = require('../lib/util/utils.js');
|
||||
|
||||
try {
|
||||
Nightwatch.cli(function(argv) {
|
||||
argv._source = argv['_'].slice(0);
|
||||
Nightwatch.runner(argv);
|
||||
});
|
||||
} catch (ex) {
|
||||
Utils.showStackTraceWithHeadline('There was an error while starting the test runner:\n', ex.stack + '\n', true);
|
||||
process.exit(2);
|
||||
}
|
2
tests/node_modules/nightwatch/examples/.npmignore
generated
vendored
Normal file
2
tests/node_modules/nightwatch/examples/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
reports
|
||||
screens
|
18
tests/node_modules/nightwatch/examples/custom-commands/hasOnBeforeUnload.js
generated
vendored
Normal file
18
tests/node_modules/nightwatch/examples/custom-commands/hasOnBeforeUnload.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Simple example of custom command. This command will
|
||||
* check if there's a onbeforeunload handler in the target web page
|
||||
* and return the result
|
||||
*/
|
||||
/* global window */
|
||||
|
||||
module.exports.command = function(callback) {
|
||||
var self = this;
|
||||
|
||||
this.execute(function() {
|
||||
return window && typeof window.onbeforeunload === 'function';
|
||||
}, [], function(result) {
|
||||
callback.call(self, result.value);
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
8
tests/node_modules/nightwatch/examples/globals.json
generated
vendored
Normal file
8
tests/node_modules/nightwatch/examples/globals.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"default" : {
|
||||
"myGlobal" : 1
|
||||
},
|
||||
"test_env" : {
|
||||
"myGlobal" : 2
|
||||
}
|
||||
}
|
55
tests/node_modules/nightwatch/examples/globalsModule.js
generated
vendored
Normal file
55
tests/node_modules/nightwatch/examples/globalsModule.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
module.exports = {
|
||||
// this controls whether to abort the test execution when an assertion failed and skip the rest
|
||||
// it's being used in waitFor commands and expect assertions
|
||||
abortOnAssertionFailure : true,
|
||||
|
||||
// this will overwrite the default polling interval (currently 500ms) for waitFor commands
|
||||
// and expect assertions that use retry
|
||||
waitForConditionPollInterval : 300,
|
||||
|
||||
// default timeout value in milliseconds for waitFor commands and implicit waitFor value for
|
||||
// expect assertions
|
||||
waitForConditionTimeout : 5000,
|
||||
|
||||
// this will cause waitFor commands on elements to throw an error if multiple
|
||||
// elements are found using the given locate strategy and selector
|
||||
throwOnMultipleElementsReturned : true,
|
||||
|
||||
// controls the timeout time for async hooks. Expects the done() callback to be invoked within this time
|
||||
// or an error is thrown
|
||||
asyncHookTimeout : 10000,
|
||||
|
||||
'default' : {
|
||||
myGlobal : function() {
|
||||
return 'I\'m a method';
|
||||
}
|
||||
},
|
||||
|
||||
'test_env' : {
|
||||
myGlobal: 'test_global',
|
||||
beforeEach : function() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
before : function(cb) {
|
||||
cb();
|
||||
},
|
||||
|
||||
beforeEach : function(browser, cb) {
|
||||
cb();
|
||||
},
|
||||
|
||||
after : function(cb) {
|
||||
cb();
|
||||
},
|
||||
|
||||
afterEach : function(browser, cb) {
|
||||
cb();
|
||||
},
|
||||
|
||||
reporter : function(results, cb) {
|
||||
//console.log(results);
|
||||
cb();
|
||||
}
|
||||
};
|
24
tests/node_modules/nightwatch/examples/mocha/github.js
generated
vendored
Normal file
24
tests/node_modules/nightwatch/examples/mocha/github.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
describe('Github', function() {
|
||||
|
||||
it('Demo test GitHub', function (client) {
|
||||
client
|
||||
.url('https://github.com/nightwatchjs/nightwatch')
|
||||
.waitForElementVisible('body', 1000)
|
||||
.assert.title('nightwatchjs/nightwatch · GitHub')
|
||||
.assert.visible('.container h1 strong a')
|
||||
.assert.containsText('.container h1 strong a', 'nightwatch', 'Checking project title is set to nightwatch');
|
||||
});
|
||||
|
||||
after(function(client, done) {
|
||||
if (client.sessionId) {
|
||||
client.end(function() {
|
||||
done();
|
||||
});
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
38
tests/node_modules/nightwatch/examples/mocha/googleDemoTest.js
generated
vendored
Normal file
38
tests/node_modules/nightwatch/examples/mocha/googleDemoTest.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
describe('Google demo test for Mocha', function() {
|
||||
|
||||
describe('for demo purposes', function() {
|
||||
|
||||
before(function(client, done) {
|
||||
done();
|
||||
});
|
||||
|
||||
after(function(client, done) {
|
||||
if (client.sessionId) {
|
||||
client.end(function() {
|
||||
done();
|
||||
});
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(function(client, done) {
|
||||
done();
|
||||
});
|
||||
|
||||
beforeEach(function(client, done) {
|
||||
done();
|
||||
});
|
||||
|
||||
it('uses BDD to run the Google simple test', function(client) {
|
||||
client
|
||||
.url('http://google.com')
|
||||
.expect.element('body').to.be.present.before(1000);
|
||||
|
||||
client.setValue('input[type=text]', ['nightwatch', client.Keys.ENTER])
|
||||
.pause(1000)
|
||||
.assert.containsText('#main', 'Night Watch');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
17
tests/node_modules/nightwatch/examples/pages/home.js
generated
vendored
Normal file
17
tests/node_modules/nightwatch/examples/pages/home.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var searchCommands = {
|
||||
submit: function() {
|
||||
this.waitForElementVisible('@submitButton', 3000)
|
||||
.click('@submitButton')
|
||||
.api.pause(1000);
|
||||
return this; // Return page object for chaining
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
url: 'http://google.com',
|
||||
commands: [searchCommands],
|
||||
elements: {
|
||||
searchBar: { selector: 'input[name=q]' },
|
||||
submitButton: { selector: '[type=submit]' }
|
||||
}
|
||||
};
|
31
tests/node_modules/nightwatch/examples/pages/searchResults.js
generated
vendored
Normal file
31
tests/node_modules/nightwatch/examples/pages/searchResults.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
var util = require('util');
|
||||
|
||||
var menuXpath = '//div[contains(@class, "hdtb-mitem")][contains(., %s)]';
|
||||
|
||||
var menuCommands = {
|
||||
productIsSelected: function(product, callback) {
|
||||
var self = this;
|
||||
return this.getAttribute(product, 'class', function(result) {
|
||||
var isSelected = result.value.indexOf('hdtb-msel') > -1;
|
||||
callback.call(self, isSelected);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
elements: {
|
||||
results: { selector: '#ires' }
|
||||
},
|
||||
sections: {
|
||||
menu: {
|
||||
selector: '#hdtb-msb',
|
||||
commands: [menuCommands],
|
||||
elements: {
|
||||
web: { selector: util.format(menuXpath, 'Web'), locateStrategy: 'xpath' },
|
||||
video: { selector: util.format(menuXpath, 'Video'), locateStrategy: 'xpath' },
|
||||
images: { selector: util.format(menuXpath, 'Images'), locateStrategy: 'xpath' },
|
||||
shopping: { selector: util.format(menuXpath, 'Shopping'), locateStrategy: 'xpath' }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
1
tests/node_modules/nightwatch/examples/tests/.npmignore
generated
vendored
Normal file
1
tests/node_modules/nightwatch/examples/tests/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
fbcredentials.json
|
53
tests/node_modules/nightwatch/examples/tests/digg.js
generated
vendored
Normal file
53
tests/node_modules/nightwatch/examples/tests/digg.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* =============================================================================
|
||||
* Demo of Facebook Connect automated login with Nightwatch.js.
|
||||
* The test navigates to digg.com and tries to perform a Facebook connect login.
|
||||
*
|
||||
* This test requires a fbcredentials.json file to be placed in the same
|
||||
* folder, containing the facebook username and password in the form below:
|
||||
* -----
|
||||
* {
|
||||
* "username" : "",
|
||||
* "password" : ""
|
||||
* }
|
||||
* -----
|
||||
* The test only works if you have the permissions ALREADY enabled for digg.com
|
||||
* in your facebook account.
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
disabled : true,
|
||||
|
||||
'digg facebook login' : function (client) {
|
||||
var fbcredentials;
|
||||
try {
|
||||
fbcredentials = require('./fbcredentials.json');
|
||||
} catch (err) {
|
||||
console.error('Couldn\'t load the facebook credentials file. Please ensure that ' +
|
||||
'you have the fbcredentials.json in the same folder as the test.');
|
||||
process.exit();
|
||||
}
|
||||
|
||||
client
|
||||
.url('http://digg.com')
|
||||
.waitForElementVisible('body', 1000)
|
||||
.click('#nav-signin')
|
||||
.click('#btn-facebook-auth-topnav')
|
||||
.windowHandles(function(result) {
|
||||
client.assert.equal(result.value.length, 2, 'There should be two windows open.');
|
||||
var fbWindowHandle = result.value[1];
|
||||
client.switchWindow(fbWindowHandle);
|
||||
})
|
||||
.waitForElementVisible('#facebook body', 1000)
|
||||
.setValue('input#email', fbcredentials.username)
|
||||
.setValue('input#pass', fbcredentials.password)
|
||||
.click('#loginbutton input')
|
||||
.windowHandles(function(result) {
|
||||
client.assert.equal(result.value.length, 1, 'There should be only one window open.');
|
||||
client.switchWindow(result.value[0]);
|
||||
})
|
||||
.waitForElementVisible('#digg-header.authenticated', 3000)
|
||||
.end();
|
||||
}
|
||||
};
|
14
tests/node_modules/nightwatch/examples/tests/github/github.js
generated
vendored
Normal file
14
tests/node_modules/nightwatch/examples/tests/github/github.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
tags: ['git'],
|
||||
'Demo test GitHub' : function (client) {
|
||||
client
|
||||
.url('https://github.com/nightwatchjs/nightwatch')
|
||||
.waitForElementVisible('body', 1000)
|
||||
.assert.visible('.container h1 strong a')
|
||||
.assert.containsText('.container h1 strong a', 'nightwatch', 'Checking project title is set to nightwatch');
|
||||
},
|
||||
|
||||
after : function(client) {
|
||||
client.end();
|
||||
}
|
||||
};
|
29
tests/node_modules/nightwatch/examples/tests/google.js
generated
vendored
Normal file
29
tests/node_modules/nightwatch/examples/tests/google.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/* jshint expr: true */
|
||||
module.exports = {
|
||||
tags: ['google'],
|
||||
'Demo test Google' : function (client) {
|
||||
client
|
||||
.url('http://google.no')
|
||||
.pause(1000);
|
||||
|
||||
client.expect.element('body').to.be.present;
|
||||
|
||||
client.expect.element('#lst-ib').to.have.css('display');
|
||||
|
||||
client.expect.element('body').to.have.attribute('class').which.contains('vasq');
|
||||
client.expect.element('body').to.have.attribute('class').which.matches(/vasq$/);
|
||||
client.expect.element('body').to.have.attribute('class').before(1000);
|
||||
|
||||
client.expect.element('#lst-ib').to.be.enabled;
|
||||
|
||||
client.expect.element('#hplogo').text.to.match(/Norge/).before(1000);
|
||||
|
||||
client.setValue('#lst-ib', 'Norway').pause(500);
|
||||
client.expect.element('#lst-ib').to.have.value.equal('Norway');
|
||||
client.expect.element('#lst-ib').to.be.an('input');
|
||||
client.expect.element('#lst-ib').to.be.not.selected;
|
||||
client.expect.element('#lst-ib').to.be.visible;
|
||||
|
||||
client.end();
|
||||
}
|
||||
};
|
22
tests/node_modules/nightwatch/examples/tests/google/googleDemoTest.js
generated
vendored
Normal file
22
tests/node_modules/nightwatch/examples/tests/google/googleDemoTest.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Sample automated test scenario for Nightwatch.js
|
||||
*
|
||||
* > it navigates to google.com and searches for nightwatch,
|
||||
* verifying if the term 'The Night Watch' exists in the search results
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
'demo test google' : function (client) {
|
||||
client
|
||||
.url('http://google.com')
|
||||
.waitForElementPresent('body', 1000);
|
||||
},
|
||||
|
||||
'part two' : function(client) {
|
||||
client
|
||||
.setValue('input[type=text]', ['nightwatch', client.Keys.ENTER])
|
||||
.pause(1000)
|
||||
.assert.containsText('#main', 'Night Watch')
|
||||
.end();
|
||||
}
|
||||
};
|
29
tests/node_modules/nightwatch/examples/tests/googlePageObject.js
generated
vendored
Normal file
29
tests/node_modules/nightwatch/examples/tests/googlePageObject.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/* jshint expr: true */
|
||||
module.exports = {
|
||||
'Demo Google search test using page objects' : function (client) {
|
||||
var homePage = client.page.home();
|
||||
homePage.navigate();
|
||||
homePage.expect.element('@searchBar').to.be.enabled;
|
||||
|
||||
homePage
|
||||
.setValue('@searchBar', 'Nightwatch.js')
|
||||
.submit();
|
||||
|
||||
var resultsPage = client.page.searchResults();
|
||||
resultsPage.expect.element('@results').to.be.present.after(2000);
|
||||
resultsPage.expect.element('@results').to.contain.text('Nightwatch.js');
|
||||
resultsPage.expect.section('@menu').to.be.visible;
|
||||
|
||||
var menuSection = resultsPage.section.menu;
|
||||
menuSection.expect.element('@web').to.be.visible;
|
||||
menuSection.expect.element('@video').to.be.visible;
|
||||
menuSection.expect.element('@images').to.be.visible;
|
||||
menuSection.expect.element('@shopping').to.be.visible;
|
||||
|
||||
menuSection.productIsSelected('@web', function(result) {
|
||||
this.assert.ok(result, 'Web results are shown by default on search results page');
|
||||
});
|
||||
|
||||
client.end();
|
||||
}
|
||||
};
|
18
tests/node_modules/nightwatch/examples/tests/nightwatch.js
generated
vendored
Normal file
18
tests/node_modules/nightwatch/examples/tests/nightwatch.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
disabled : true,
|
||||
'Demo test NightwatchJS.org' : function (client) {
|
||||
client
|
||||
.url('http://nightwatchjs.org')
|
||||
.waitForElementVisible('body', 1000)
|
||||
.elements('css selector', '#index-container ul.features li', function (result) {
|
||||
|
||||
for (var i = 0; i < result.value.length; i++) {
|
||||
var element = result.value[i];
|
||||
|
||||
var selector = '#index-container ul.features li:nth-child(' + (element.ELEMENT ) +') em';
|
||||
client.verify.cssClassPresent(selector, 'glyphicon');
|
||||
}
|
||||
})
|
||||
.end();
|
||||
}
|
||||
};
|
39
tests/node_modules/nightwatch/examples/tests/onbeforeunload.js
generated
vendored
Normal file
39
tests/node_modules/nightwatch/examples/tests/onbeforeunload.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Sample automated test scenario for Nightwatch.js
|
||||
*
|
||||
* > it navigates to page that has onbeforeunload handler
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
'go to page with unload handler': function(client) {
|
||||
client
|
||||
.url('http://www.4guysfromrolla.com/demos/OnBeforeUnloadDemo1.htm')
|
||||
.waitForElementVisible('body', 1000);
|
||||
},
|
||||
|
||||
'navigate away from page WITH unload handler': function(client) {
|
||||
var hasDialog = false;
|
||||
|
||||
client
|
||||
.hasOnBeforeUnload(function(result) {
|
||||
this.verify.equal(result, true, 'The page should have an onbeforeunload handler');
|
||||
hasDialog = result;
|
||||
})
|
||||
.url('http://google.com', function() {
|
||||
if (hasDialog) {
|
||||
this.acceptAlert();
|
||||
}
|
||||
})
|
||||
.waitForElementVisible('body', 1000);
|
||||
|
||||
},
|
||||
|
||||
'go to nightwatch' : function(c) {
|
||||
c.url('http://nightwatchjs.org')
|
||||
.waitForElementVisible('body', 1000);
|
||||
},
|
||||
|
||||
after : function(c) {
|
||||
c.end();
|
||||
}
|
||||
};
|
14
tests/node_modules/nightwatch/examples/tests2/github/github2.js
generated
vendored
Normal file
14
tests/node_modules/nightwatch/examples/tests2/github/github2.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
tags: ['git'],
|
||||
'Demo test GitHub' : function (client) {
|
||||
client
|
||||
.url('https://github.com/nightwatchjs/nightwatch')
|
||||
.waitForElementVisible('body', 1000)
|
||||
.assert.visible('.container h1 strong a')
|
||||
.assert.containsText('.container h1 strong a', 'nightwatch', 'Checking project title is set to nightwatch');
|
||||
},
|
||||
|
||||
after : function(client) {
|
||||
client.end();
|
||||
}
|
||||
};
|
9
tests/node_modules/nightwatch/examples/unittests/demoTestAsync.js
generated
vendored
Normal file
9
tests/node_modules/nightwatch/examples/unittests/demoTestAsync.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
module.exports = {
|
||||
'demo UnitTest' : function (client, done) {
|
||||
client.assert.ok('TEST');
|
||||
setTimeout(function() {
|
||||
done();
|
||||
}, 500);
|
||||
|
||||
}
|
||||
};
|
41
tests/node_modules/nightwatch/examples/unittests/testUtils.js
generated
vendored
Normal file
41
tests/node_modules/nightwatch/examples/unittests/testUtils.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
var Utils = require('../../lib/util/utils.js');
|
||||
|
||||
module.exports = {
|
||||
testFormatElapsedTime : function(client) {
|
||||
var test = client.assert;
|
||||
|
||||
var resultMs = Utils.formatElapsedTime(999);
|
||||
test.equal(resultMs, '999ms');
|
||||
|
||||
var resultSec = Utils.formatElapsedTime(1999);
|
||||
test.equal(resultSec, '1.999s');
|
||||
|
||||
var resultMin = Utils.formatElapsedTime(122299, true);
|
||||
test.equal(resultMin, '2m 2s / 122299ms');
|
||||
},
|
||||
|
||||
testMakeFnAsync : function(client) {
|
||||
function asynFn(done) {
|
||||
done();
|
||||
}
|
||||
|
||||
function syncFn() {}
|
||||
|
||||
var test = client.assert;
|
||||
|
||||
test.equal(Utils.makeFnAsync(1, asynFn), asynFn);
|
||||
|
||||
var convertedFn = Utils.makeFnAsync(1, syncFn);
|
||||
convertedFn(function() {
|
||||
test.ok('converted fn called');
|
||||
});
|
||||
},
|
||||
|
||||
testGetTestSuiteName : function(client) {
|
||||
var test = client.assert;
|
||||
test.equal(Utils.getTestSuiteName('test-case-one'), 'Test Case One');
|
||||
test.equal(Utils.getTestSuiteName('test_case_two'), 'Test Case Two');
|
||||
test.equal(Utils.getTestSuiteName('test.case.one'), 'Test Case One');
|
||||
test.equal(Utils.getTestSuiteName('testCaseOne'), 'Test Case One');
|
||||
}
|
||||
};
|
29
tests/node_modules/nightwatch/examples/unittests/testUtilsWithChai.js
generated
vendored
Normal file
29
tests/node_modules/nightwatch/examples/unittests/testUtilsWithChai.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var Utils = require('../../lib/util/utils.js');
|
||||
var expect = require('chai').expect;
|
||||
|
||||
module.exports = {
|
||||
testFormatElapsedTime : function(client) {
|
||||
var resultMs = Utils.formatElapsedTime(999);
|
||||
var resultSec = Utils.formatElapsedTime(1999);
|
||||
var resultMin = Utils.formatElapsedTime(122299, true);
|
||||
|
||||
expect(resultMs).to.equal('999ms');
|
||||
expect(resultSec).to.equal('1.999s');
|
||||
expect(resultMin).to.equal('2m 2s / 122299ms');
|
||||
},
|
||||
|
||||
testFormatElapsedTimeMore : function(client) {
|
||||
var resultMs = Utils.formatElapsedTime(999);
|
||||
expect(resultMs).to.equal('999ms');
|
||||
},
|
||||
|
||||
testMakeFnAsync : function(client) {
|
||||
function asynFn(done) {
|
||||
done();
|
||||
}
|
||||
|
||||
function syncFn() {}
|
||||
|
||||
expect(Utils.makeFnAsync(1, asynFn)).to.equal(asynFn);
|
||||
}
|
||||
};
|
3
tests/node_modules/nightwatch/index.js
generated
vendored
Normal file
3
tests/node_modules/nightwatch/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = process.env.NIGHTWATCH_COV ?
|
||||
require('./lib-cov/index') :
|
||||
require('./lib/index');
|
57
tests/node_modules/nightwatch/lib/api/assertions/attributeContains.js
generated
vendored
Normal file
57
tests/node_modules/nightwatch/lib/api/assertions/attributeContains.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Checks if the given attribute of an element contains the expected value.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.attributeContains('#someElement', 'href', 'google.com');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method attributeContains
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} attribute The attribute name
|
||||
* @param {string} expected The expected contained value of the attribute to check.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, attribute, expected, msg) {
|
||||
var DEFAULT_MSG = 'Testing if attribute %s of <%s> contains "%s".';
|
||||
var MSG_ELEMENT_NOT_FOUND = DEFAULT_MSG + ' ' + 'Element could not be located.';
|
||||
var MSG_ATTR_NOT_FOUND = DEFAULT_MSG + ' ' + 'Element does not have a ' + attribute + ' attribute.';
|
||||
|
||||
this.message = msg || util.format(DEFAULT_MSG, attribute, selector, expected);
|
||||
|
||||
this.expected = function() {
|
||||
return expected;
|
||||
};
|
||||
|
||||
this.pass = function(value) {
|
||||
return value.indexOf(expected) > -1;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = (result === false) ||
|
||||
// no such element
|
||||
result && (result.status === -1 || result.value === null);
|
||||
|
||||
if (failed) {
|
||||
var defaultMsg = MSG_ELEMENT_NOT_FOUND;
|
||||
if (result && result.value === null) {
|
||||
defaultMsg = MSG_ATTR_NOT_FOUND;
|
||||
}
|
||||
this.message = msg || util.format(defaultMsg, attribute, selector, expected);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.getAttribute(selector, attribute, callback);
|
||||
};
|
||||
|
||||
};
|
57
tests/node_modules/nightwatch/lib/api/assertions/attributeEquals.js
generated
vendored
Normal file
57
tests/node_modules/nightwatch/lib/api/assertions/attributeEquals.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Checks if the given attribute of an element has the expected value.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.attributeEquals('body', 'data-attr', 'some value');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method attributeEquals
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} attribute The attribute name
|
||||
* @param {string} expected The expected value of the attribute to check.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, attribute, expected, msg) {
|
||||
var DEFAULT_MSG = 'Testing if attribute %s of <%s> equals "%s".';
|
||||
var MSG_ELEMENT_NOT_FOUND = DEFAULT_MSG + ' ' + 'Element could not be located.';
|
||||
var MSG_ATTR_NOT_FOUND = DEFAULT_MSG + ' ' + 'Element does not have a ' + attribute + ' attribute.';
|
||||
|
||||
this.message = msg || util.format(DEFAULT_MSG, attribute, selector, expected);
|
||||
|
||||
this.expected = function() {
|
||||
return expected;
|
||||
};
|
||||
|
||||
this.pass = function(value) {
|
||||
return value === expected;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = (result === false) ||
|
||||
// no such element
|
||||
result && (result.status === -1 || result.value === null);
|
||||
|
||||
if (failed) {
|
||||
var defaultMsg = MSG_ELEMENT_NOT_FOUND;
|
||||
if (result && result.value === null) {
|
||||
defaultMsg = MSG_ATTR_NOT_FOUND;
|
||||
}
|
||||
this.message = msg || util.format(defaultMsg, attribute, selector, expected);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.getAttribute(selector, attribute, callback);
|
||||
};
|
||||
|
||||
};
|
49
tests/node_modules/nightwatch/lib/api/assertions/containsText.js
generated
vendored
Normal file
49
tests/node_modules/nightwatch/lib/api/assertions/containsText.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Checks if the given element contains the specified text.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.containsText('#main', 'The Night Watch');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method containsText
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} expectedText The text to look for.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, expectedText, msg) {
|
||||
|
||||
var MSG_ELEMENT_NOT_FOUND = 'Testing if element <%s> contains text: "%s". ' +
|
||||
'Element could not be located.';
|
||||
|
||||
this.message = msg || util.format('Testing if element <%s> contains text: "%s".', selector, expectedText);
|
||||
|
||||
this.expected = function() {
|
||||
return expectedText;
|
||||
};
|
||||
|
||||
this.pass = function(value) {
|
||||
return value.indexOf(expectedText) > -1;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = result === false || result && result.status === -1;
|
||||
if (failed) {
|
||||
this.message = msg || util.format(MSG_ELEMENT_NOT_FOUND, selector, expectedText);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.getText(selector, callback);
|
||||
};
|
||||
|
||||
};
|
50
tests/node_modules/nightwatch/lib/api/assertions/cssClassNotPresent.js
generated
vendored
Normal file
50
tests/node_modules/nightwatch/lib/api/assertions/cssClassNotPresent.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Checks if the given element does not have the specified CSS class.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.cssClassNotPresent('#main', 'container');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method cssClassNotPresent
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} className The CSS class to look for.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, className, msg) {
|
||||
|
||||
var MSG_ELEMENT_NOT_FOUND = 'Testing if element <%s> does not have css class: "%s". ' +
|
||||
'Element could not be located.';
|
||||
|
||||
this.message = msg || util.format('Testing if element <%s> does not have css class: "%s".', selector, className);
|
||||
|
||||
this.expected = function() {
|
||||
return 'without ' + className;
|
||||
};
|
||||
|
||||
this.pass = function(value) {
|
||||
var classes = value.split(' ');
|
||||
return classes.indexOf(className) === -1;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = result === false || result && result.status === -1;
|
||||
if (failed) {
|
||||
this.message = msg || util.format(MSG_ELEMENT_NOT_FOUND, selector, className);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.getAttribute(selector, 'class', callback);
|
||||
};
|
||||
|
||||
};
|
50
tests/node_modules/nightwatch/lib/api/assertions/cssClassPresent.js
generated
vendored
Normal file
50
tests/node_modules/nightwatch/lib/api/assertions/cssClassPresent.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Checks if the given element has the specified CSS class.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.cssClassPresent('#main', 'container');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method cssClassPresent
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} className The CSS class to look for.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, className, msg) {
|
||||
|
||||
var MSG_ELEMENT_NOT_FOUND = 'Testing if element <%s> has css class: "%s". ' +
|
||||
'Element could not be located.';
|
||||
|
||||
this.message = msg || util.format('Testing if element <%s> has css class: "%s".', selector, className);
|
||||
|
||||
this.expected = function() {
|
||||
return 'has ' + className;
|
||||
};
|
||||
|
||||
this.pass = function(value) {
|
||||
var classes = value.split(' ');
|
||||
return classes.indexOf(className) > -1;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = result === false || result && result.status === -1;
|
||||
if (failed) {
|
||||
this.message = msg || util.format(MSG_ELEMENT_NOT_FOUND, selector, className);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.getAttribute(selector, 'class', callback);
|
||||
};
|
||||
|
||||
};
|
47
tests/node_modules/nightwatch/lib/api/assertions/cssProperty.js
generated
vendored
Normal file
47
tests/node_modules/nightwatch/lib/api/assertions/cssProperty.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Checks if the specified css property of a given element has the expected value.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.cssProperty('#main', 'display', 'block');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method cssProperty
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} cssProperty The CSS property.
|
||||
* @param {string} expected The expected value of the css property to check.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, cssProperty, expected, msg) {
|
||||
|
||||
var MSG_ELEMENT_NOT_FOUND = 'Testing if element <%s> has css property %s. ' +
|
||||
'Element or attribute could not be located.';
|
||||
|
||||
this.message = msg || util.format('Testing if element <%s> has css property "%s: %s".', selector, cssProperty, expected);
|
||||
this.expected = expected;
|
||||
|
||||
this.pass = function(value) {
|
||||
return value === expected;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = result === false || result && result.status === -1;
|
||||
if (failed) {
|
||||
this.message = msg || util.format(MSG_ELEMENT_NOT_FOUND, selector, cssProperty);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.getCssProperty(selector, cssProperty, callback);
|
||||
};
|
||||
|
||||
};
|
34
tests/node_modules/nightwatch/lib/api/assertions/elementNotPresent.js
generated
vendored
Normal file
34
tests/node_modules/nightwatch/lib/api/assertions/elementNotPresent.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Checks if the given element exists in the DOM.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.elementNotPresent(".should_not_exist");
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method elementNotPresent
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, msg) {
|
||||
|
||||
this.message = msg || util.format('Testing if element <%s> is not present.', selector);
|
||||
this.expected = 'not present';
|
||||
|
||||
this.pass = function(value) {
|
||||
return value === 'not present';
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return (result.status !== 0 || result.value.length === 0) ? 'not present' : 'present';
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.elements(this.client.locateStrategy, selector, callback);
|
||||
};
|
||||
|
||||
};
|
34
tests/node_modules/nightwatch/lib/api/assertions/elementPresent.js
generated
vendored
Normal file
34
tests/node_modules/nightwatch/lib/api/assertions/elementPresent.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Checks if the given element exists in the DOM.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.elementPresent("#main");
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method elementPresent
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, msg) {
|
||||
|
||||
this.message = msg || util.format('Testing if element <%s> is present.', selector);
|
||||
this.expected = 'present';
|
||||
|
||||
this.pass = function(value) {
|
||||
return value == 'present';
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return (result.status !== 0 || result.value.length === 0) ? 'not present' : 'present';
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.elements(this.client.locateStrategy, selector, callback);
|
||||
};
|
||||
|
||||
};
|
45
tests/node_modules/nightwatch/lib/api/assertions/hidden.js
generated
vendored
Normal file
45
tests/node_modules/nightwatch/lib/api/assertions/hidden.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Checks if the given element is not visible on the page.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.hidden(".should_not_be_visible");
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method hidden
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, msg) {
|
||||
|
||||
var MSG_ELEMENT_NOT_FOUND = 'Testing if element <%s> is hidden. ' +
|
||||
'Element could not be located.';
|
||||
|
||||
this.message = msg || util.format('Testing if element <%s> is hidden.', selector);
|
||||
this.expected = true;
|
||||
|
||||
this.pass = function(value) {
|
||||
return value === this.expected;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = result === false || result && result.status === -1;
|
||||
if (failed) {
|
||||
this.message = msg || util.format(MSG_ELEMENT_NOT_FOUND, selector);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return !result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.isVisible(selector, callback);
|
||||
};
|
||||
|
||||
};
|
35
tests/node_modules/nightwatch/lib/api/assertions/title.js
generated
vendored
Normal file
35
tests/node_modules/nightwatch/lib/api/assertions/title.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Checks if the page title equals the given value.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.title("Nightwatch.js");
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method title
|
||||
* @param {string} expected The expected page title.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(expected, msg) {
|
||||
|
||||
this.message = msg || util.format('Testing if the page title equals "%s".', expected);
|
||||
this.expected = expected;
|
||||
|
||||
this.pass = function(value) {
|
||||
return value === this.expected;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
this.api.title(callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
};
|
35
tests/node_modules/nightwatch/lib/api/assertions/urlContains.js
generated
vendored
Normal file
35
tests/node_modules/nightwatch/lib/api/assertions/urlContains.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Checks if the current URL contains the given value.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.urlContains('google');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method urlContains
|
||||
* @param {string} expected The value expected to exist within the current URL.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(expected, msg) {
|
||||
|
||||
this.message = msg || util.format('Testing if the URL contains "%s".', expected);
|
||||
this.expected = expected;
|
||||
|
||||
this.pass = function(value) {
|
||||
return value.indexOf(this.expected) > -1;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
this.api.url(callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
};
|
35
tests/node_modules/nightwatch/lib/api/assertions/urlEquals.js
generated
vendored
Normal file
35
tests/node_modules/nightwatch/lib/api/assertions/urlEquals.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Checks if the current url equals the given value.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.urlEquals('http://www.google.com');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method urlEquals
|
||||
* @param {string} expected The expected url.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(expected, msg) {
|
||||
|
||||
this.message = msg || util.format('Testing if the URL equals "%s".', expected);
|
||||
this.expected = expected;
|
||||
|
||||
this.pass = function(value) {
|
||||
return value === this.expected;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
this.api.url(callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
};
|
50
tests/node_modules/nightwatch/lib/api/assertions/value.js
generated
vendored
Normal file
50
tests/node_modules/nightwatch/lib/api/assertions/value.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Checks if the given form element's value equals the expected value.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.value("form.login input[type=text]", "username");
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method value
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} expectedText The expected text.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, expected, msg) {
|
||||
|
||||
var MSG_ELEMENT_NOT_FOUND = 'Testing if value of <%s> equals: "%s". ' +
|
||||
'Element or attribute could not be located.';
|
||||
|
||||
this.message = msg || util.format('Testing if value of <%s> equals: "%s".', selector, expected);
|
||||
this.expected = expected;
|
||||
|
||||
this.pass = function(value) {
|
||||
return value === this.expected;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = (result === false) ||
|
||||
// no such element
|
||||
result && result.status === -1 ||
|
||||
// element doesn't have a value attribute
|
||||
result && result.value === null;
|
||||
if (failed) {
|
||||
this.message = msg || util.format(MSG_ELEMENT_NOT_FOUND, selector, expected);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.getValue(selector, callback);
|
||||
};
|
||||
|
||||
};
|
53
tests/node_modules/nightwatch/lib/api/assertions/valueContains.js
generated
vendored
Normal file
53
tests/node_modules/nightwatch/lib/api/assertions/valueContains.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Checks if the given form element's value contains the expected value.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.valueContains("form.login input[type=text]", "username");
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method valueContains
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} expectedText The expected text.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, expected, msg) {
|
||||
var DEFAULT_MSG = 'Testing if value of <%s> contains: "%s".';
|
||||
var MSG_ELEMENT_NOT_FOUND = DEFAULT_MSG + ' ' + 'Element could not be located.';
|
||||
var VALUE_ATTR_NOT_FOUND = DEFAULT_MSG + ' ' + 'Element does not have a value attribute.';
|
||||
|
||||
this.message = msg || util.format(DEFAULT_MSG, selector, expected);
|
||||
this.expected = true;
|
||||
|
||||
this.pass = function(value) {
|
||||
return value.indexOf(expected) > -1;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = (result === false) ||
|
||||
// no such element
|
||||
result && (result.status === -1 || result.value === null);
|
||||
|
||||
if (failed) {
|
||||
var defaultMsg = MSG_ELEMENT_NOT_FOUND;
|
||||
if (result && result.value === null) {
|
||||
defaultMsg = VALUE_ATTR_NOT_FOUND;
|
||||
}
|
||||
this.message = msg || util.format(defaultMsg, selector, expected);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.getValue(selector, callback);
|
||||
};
|
||||
|
||||
};
|
45
tests/node_modules/nightwatch/lib/api/assertions/visible.js
generated
vendored
Normal file
45
tests/node_modules/nightwatch/lib/api/assertions/visible.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Checks if the given element is visible on the page.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* browser.assert.visible(".should_be_visible");
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method visible
|
||||
* @param {string} selector The selector (CSS / Xpath) used to locate the element.
|
||||
* @param {string} [message] Optional log message to display in the output. If missing, one is displayed by default.
|
||||
* @api assertions
|
||||
*/
|
||||
|
||||
var util = require('util');
|
||||
exports.assertion = function(selector, msg) {
|
||||
|
||||
var MSG_ELEMENT_NOT_FOUND = 'Testing if element <%s> is visible. ' +
|
||||
'Element could not be located.';
|
||||
|
||||
this.message = msg || util.format('Testing if element <%s> is visible.', selector);
|
||||
this.expected = true;
|
||||
|
||||
this.pass = function(value) {
|
||||
return value === this.expected;
|
||||
};
|
||||
|
||||
this.failure = function(result) {
|
||||
var failed = result === false || result && result.status === -1;
|
||||
if (failed) {
|
||||
this.message = msg || util.format(MSG_ELEMENT_NOT_FOUND, selector);
|
||||
}
|
||||
return failed;
|
||||
};
|
||||
|
||||
this.value = function(result) {
|
||||
return result.value;
|
||||
};
|
||||
|
||||
this.command = function(callback) {
|
||||
return this.api.isVisible(selector, callback);
|
||||
};
|
||||
|
||||
};
|
509
tests/node_modules/nightwatch/lib/api/client-commands.js
generated
vendored
Normal file
509
tests/node_modules/nightwatch/lib/api/client-commands.js
generated
vendored
Normal file
@@ -0,0 +1,509 @@
|
||||
var events = require('events');
|
||||
|
||||
module.exports = function(client) {
|
||||
return {
|
||||
/**
|
||||
* Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its name attribute.
|
||||
*
|
||||
* To find out the window handle use `window_handles` protocol action
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (browser) {
|
||||
* browser.window_handles(function(result) {
|
||||
* var handle = result.value[0];
|
||||
* browser.switchWindow(handle);
|
||||
* });
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method switchWindow
|
||||
* @param {string} handleOrName The server assigned window handle or the name attribute.
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @see window
|
||||
* @since v0.3.0
|
||||
* @api commands
|
||||
*/
|
||||
switchWindow : function(handleOrName, callback) {
|
||||
var self = this;
|
||||
this.window('POST', handleOrName, function(result) {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call(self, result);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Resizes the current window.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (browser) {
|
||||
* browser.resizeWindow(1000, 800);
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method resizeWindow
|
||||
* @param {number} width The new window width.
|
||||
* @param {number} height The new window height.
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @see windowSize
|
||||
* @since v0.3.0
|
||||
* @api commands
|
||||
*/
|
||||
resizeWindow : function(width, height, callback) {
|
||||
var self = this;
|
||||
return this.windowSize('current', width, height, function(result) {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call(self, result);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the current window position.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (browser) {
|
||||
* browser.setWindowPosition(0, 0);
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method setWindowPosition
|
||||
* @param {number} offsetX The new window offset x-position.
|
||||
* @param {number} offsetY The new window offset y-position.
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @see windowPosition
|
||||
* @since v0.8.18
|
||||
* @api commands
|
||||
*/
|
||||
setWindowPosition : function(offsetX, offsetY, callback) {
|
||||
var self = this;
|
||||
return this.windowPosition('current', offsetX, offsetY, function(result) {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call(self, result);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Maximizes the current window.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (browser) {
|
||||
* browser.maximizeWindow();
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method maximizeWindow
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @see windowMaximize
|
||||
* @since v0.5.13
|
||||
* @api commands
|
||||
*/
|
||||
maximizeWindow: function(callback) {
|
||||
var self = this;
|
||||
return this.windowMaximize('current', function(result) {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call(self, result);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Take a screenshot of the current page and saves it as the given filename.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (browser) {
|
||||
* browser.saveScreenshot('/path/to/fileName.png');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method saveScreenshot
|
||||
* @param {string} fileName The complete path to the file name where the screenshot should be saved.
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @see screenshot
|
||||
* @api commands
|
||||
*/
|
||||
saveScreenshot : function(fileName, callback) {
|
||||
var self = this;
|
||||
return this.screenshot(client.api.options.log_screenshot_data, function(result) {
|
||||
client.saveScreenshotToFile(fileName, result.value, function(err) {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call(self, result, err);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the title of the current page. Uses title protocol command.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (browser) {
|
||||
* browser.getTitle(function(title) {
|
||||
* this.assert.equal(typeof title, 'string');
|
||||
* this.assert.equal(title, 'Nightwatch.js');
|
||||
* });
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method getTitle
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @see title
|
||||
* @returns {string} The page title.
|
||||
* @api commands
|
||||
*/
|
||||
getTitle : function(callback) {
|
||||
var self = this;
|
||||
return this.title(function(result) {
|
||||
callback.call(self, result.value);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Close the current window. This can be useful when you're working with multiple windows open (e.g. an OAuth login).
|
||||
* Uses `window` protocol command.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* client.closeWindow();
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method closeWindow
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @see window
|
||||
* @since v0.3.0
|
||||
* @api commands
|
||||
*/
|
||||
closeWindow : function(callback) {
|
||||
var self = this;
|
||||
return this.window('DELETE', function(result) {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call(self, result);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* This command is an alias to url and also a convenience method when called without any arguments in the sense that it performs a call to .url() with passing the value of `launch_url` field from the settings file.
|
||||
* Uses `url` protocol command.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* client.init();
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method init
|
||||
* @param {string} [url] Url to navigate to.
|
||||
* @see url
|
||||
* @since v0.4.0
|
||||
* @api commands
|
||||
*/
|
||||
init : function(url) {
|
||||
if (url) {
|
||||
return this.url(url);
|
||||
}
|
||||
|
||||
if (!this.launchUrl) {
|
||||
return this;
|
||||
}
|
||||
return this.url(this.launchUrl);
|
||||
},
|
||||
|
||||
/**
|
||||
* Convenience method that adds the specified hash (i.e. url fragment) to the current value of the `launch_url` as set in `nightwatch.json`.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function (client) {
|
||||
* client.urlHash('#hashvalue');
|
||||
* // or
|
||||
* client.urlHash('hashvalue');
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method urlHash
|
||||
* @param {string} hash The hash to add/replace to the current url (i.e. the value set in the launch_url property in nightwatch.json).
|
||||
* @see url
|
||||
* @since v0.4.0
|
||||
* @api commands
|
||||
*/
|
||||
urlHash : function(hash) {
|
||||
if (hash.charAt(0) === '#') {
|
||||
hash = hash.substring(1);
|
||||
}
|
||||
return this.url(this.launchUrl + '#' + hash);
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve all cookies visible to the current page. The cookies are returned as an array of cookie JSON object, as defined [here](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
|
||||
*
|
||||
* Uses `cookie` protocol command.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(browser) {
|
||||
* browser.getCookies(function callback(result) {
|
||||
* this.assert.equal(result.value.length, 1);
|
||||
* this.assert.equals(result.value[0].name, 'test_cookie');
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @method getCookies
|
||||
* @param {function} callback The callback function which will receive the response as an argument.
|
||||
* @api commands
|
||||
* @since v0.4.0
|
||||
* @see cookie
|
||||
* @returns {Array.<object>} A list of cookies.
|
||||
*/
|
||||
getCookies : function(callback) {
|
||||
return this.cookie('GET', callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined [here](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
|
||||
*
|
||||
* Uses `cookie` protocol command.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(browser) {
|
||||
* browser.getCookie(name, function callback(result) {
|
||||
* this.assert.equal(result.value, '123456');
|
||||
* this.assert.equals(result.name, 'test_cookie');
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @method getCookie
|
||||
* @param {string} name The cookie name.
|
||||
* @param {function} callback The callback function which will receive the response as an argument.
|
||||
* @api commands
|
||||
* @since v0.4.0
|
||||
* @see cookie
|
||||
* @returns {object|null} The cookie object as a selenium cookie JSON object or null if the cookie wasn't found.
|
||||
*/
|
||||
getCookie : function(name, callback) {
|
||||
var self = this;
|
||||
return this.cookie('GET', function(result) {
|
||||
if (!result.value || result.value.length === 0) {
|
||||
callback.call(self, null);
|
||||
return;
|
||||
}
|
||||
|
||||
var cookie = null;
|
||||
for (var i = 0; i < result.value.length; i++) {
|
||||
if (result.value[i].name === name) {
|
||||
cookie = result.value[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
callback.call(self, cookie);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Set a cookie, specified as a cookie JSON object, as defined [here](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
|
||||
*
|
||||
* Uses `cookie` protocol command.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(browser) {
|
||||
* browser.setCookie({
|
||||
* name : "test_cookie",
|
||||
* value : "test_value",
|
||||
* path : "/", (Optional)
|
||||
* domain : "example.org", (Optional)
|
||||
* secure : false, (Optional)
|
||||
* httpOnly : false, // (Optional)
|
||||
* expiry : 1395002765 // (Optional) time in seconds since midnight, January 1, 1970 UTC
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @method setCookie
|
||||
* @param {object} cookie The cookie object.
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @api commands
|
||||
* @since v0.4.0
|
||||
* @see cookie
|
||||
*/
|
||||
setCookie : function(cookie, callback) {
|
||||
return this.cookie('POST', cookie, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete the cookie with the given name. This command is a no-op if there is no such cookie visible to the current page.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(browser) {
|
||||
* browser.deleteCookie("test_cookie", function() {
|
||||
* // do something more in here
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @method deleteCookie
|
||||
* @param cookieName The name of the cookie to delete.
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @api commands
|
||||
* @since v0.4.0
|
||||
* @see cookie
|
||||
*/
|
||||
deleteCookie : function(cookieName, callback) {
|
||||
return this.cookie('DELETE', cookieName, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete all cookies visible to the current page.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(browser) {
|
||||
* browser.deleteCookies(function() {
|
||||
* // do something more in here
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @method deleteCookies
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @api commands
|
||||
* @since v0.4.0
|
||||
* @see cookie
|
||||
*/
|
||||
deleteCookies : function(callback) {
|
||||
return this.cookie('DELETE', callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Utility command to load an external script into the page specified by url.
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(client) {
|
||||
* this.injectScript('http://example.org/js/utility.js', function() {
|
||||
* // we're all done here.
|
||||
* });
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method injectScript
|
||||
* @param {string} scriptUrl The script file url
|
||||
* @param {string} [id] Dom element id to be set on the script tag.
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @api commands
|
||||
* @since v0.4.0
|
||||
* @returns {HTMLScriptElement} The newly created script tag.
|
||||
*/
|
||||
injectScript : function(scriptUrl, id, callback) {
|
||||
var args = [scriptUrl];
|
||||
if (arguments.length == 2 && typeof arguments[1] == 'function') {
|
||||
callback = arguments[1];
|
||||
} else if (typeof id == 'string') {
|
||||
args.push(id);
|
||||
}
|
||||
|
||||
return this.execute(function(u,i) {/* jshint browser:true */return (function(d){var e=d.createElement('script');var m=d.getElementsByTagName('head')[0];e.src=u;if(i){e.id=i;}m.appendChild(e);return e;})(document);}, args, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the available log types
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(client) {
|
||||
* this.getLogTypes(function(typesArray) {
|
||||
*
|
||||
* });
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method getLogTypes
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @api commands
|
||||
* @see logTypes
|
||||
*/
|
||||
getLogTypes: function(callback) {
|
||||
var self = this;
|
||||
return this.sessionLogTypes(function(response) {
|
||||
if (callback) {
|
||||
callback.call(self, response.value);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a log from selenium
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(client) {
|
||||
* this.getLog('browser', function(logEntriesArray) {
|
||||
* console.log('Log length: ' + logEntriesArray.length);
|
||||
* logEntriesArray.forEach(function(log) {
|
||||
* console.log('[' + log.level + '] ' + log.timestamp + ' : ' + log.message);
|
||||
* });
|
||||
* });
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @method getLog
|
||||
* @param {string|function} typeString Log type to request
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @api commands
|
||||
* @see log
|
||||
*/
|
||||
getLog: function(typeString, callback) {
|
||||
var self = this;
|
||||
if (typeof typeString !== 'string') {
|
||||
if (typeof typeString === 'function') {
|
||||
callback = typeString;
|
||||
}
|
||||
typeString = 'browser';
|
||||
}
|
||||
return this.sessionLog(typeString, function (response) {
|
||||
if (callback) {
|
||||
callback.call(self, response.value);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Utility command to test if the log type is available
|
||||
*
|
||||
* ```
|
||||
* this.demoTest = function(browser) {
|
||||
* browser.isLogAvailable('browser', function(isAvailable) {
|
||||
* // do something more in here
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @method isLogAvailable
|
||||
* @param {string|function} typeString Type of log to test
|
||||
* @param {function} [callback] Optional callback function to be called when the command finishes.
|
||||
* @api commands
|
||||
* @see getLogTypes
|
||||
*/
|
||||
isLogAvailable: function(typeString, callback) {
|
||||
var self = this;
|
||||
if (typeof typeString !== 'string') {
|
||||
if (typeof typeString === 'function') {
|
||||
callback = typeString;
|
||||
}
|
||||
typeString = 'browser';
|
||||
}
|
||||
return this.getLogTypes(function (types) {
|
||||
var isAvailable;
|
||||
try {
|
||||
isAvailable = Array.isArray(types) && types.indexOf(typeString) >= 0;
|
||||
} catch (err) {
|
||||
isAvailable = false;
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback.call(self, isAvailable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
};
|
24
tests/node_modules/nightwatch/lib/api/client-commands/_locateStrategy.js
generated
vendored
Normal file
24
tests/node_modules/nightwatch/lib/api/client-commands/_locateStrategy.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var util = require('util');
|
||||
var events = require('events');
|
||||
|
||||
function Command() {
|
||||
events.EventEmitter.call(this);
|
||||
}
|
||||
|
||||
util.inherits(Command, events.EventEmitter);
|
||||
|
||||
Command.prototype.command = function(callback) {
|
||||
var self = this;
|
||||
|
||||
this.client.locateStrategy = this.strategy;
|
||||
process.nextTick(function() {
|
||||
if (typeof callback == 'function') {
|
||||
callback.call(self.client.api);
|
||||
}
|
||||
self.emit('complete');
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = Command;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user