selenium: page spec, make it easier to see where strings come from
authoraddshore <addshorewiki@gmail.com>
Fri, 8 Jun 2018 12:08:49 +0000 (13:08 +0100)
committerWMDE-Fisch <christoph.jauera@wikimedia.de>
Wed, 13 Jun 2018 11:56:23 +0000 (11:56 +0000)
Having randomly generated strings is great, but sometimes
it can help to allow a human to easily see where the string
is actually being generated in code, so add an optional suffix
to the string being generated.

Change-Id: Ibfe45f74b4880a70a76c01223a787dabcd43607e

tests/selenium/specs/page.js

index dfc6fa1..bc5f100 100644 (file)
@@ -10,8 +10,8 @@ describe( 'Page', function () {
        var content,
                name;
 
-       function getTestString() {
-               return Math.random().toString() + '-öäü-♠♣♥♦';
+       function getTestString( suffix = 'defaultsuffix' ) {
+               return Math.random().toString() + '-öäü-♠♣♥♦-' + suffix;
        }
 
        before( function () {
@@ -22,8 +22,8 @@ describe( 'Page', function () {
 
        beforeEach( function () {
                browser.deleteCookie();
-               content = getTestString();
-               name = getTestString();
+               content = getTestString( 'beforeEach-content' );
+               name = getTestString( 'beforeEach-name' );
        } );
 
        it( 'should be creatable', function () {
@@ -36,7 +36,7 @@ describe( 'Page', function () {
        } );
 
        it( 'should be re-creatable', function () {
-               let initialContent = getTestString();
+               let initialContent = getTestString( 'initialContent' );
 
                // create
                browser.call( function () {