"use strict"

/**
 * @type {Chai.Assert}
 */
var assert = require('chai').assert
var xdTesting = require('../../lib/index')
var templates = require('../../lib/templates')
var Flow = require('../../lib/flow/flow')

describe('xdTesting @large', function() {

    let baseUrl = 'http://localhost:8090/'

    describe('command arguments', function() {
        it('are part of a step\'s command name', function() {
            let scenario = {A: templates.devices.chrome()}
            return xdTesting.multiremote(scenario).init()
                .url(baseUrl)
                .click('#button')
                .checkpoint('check')
                .getFlow().then(flow => {
                    let steps = flow.steps()
                    let stepCommandNames = steps.map(step => step.commands)
                        .filter(commands => commands.length > 0)
                    assert.lengthOf(stepCommandNames, 3)
                })
                .end()
        })
    })

    describe('#getFlow', function() {
        it('returns the flow object', function() {
            let scenario = {A: templates.devices.chrome()}
            return xdTesting.multiremote(scenario).init()
                .url(baseUrl)
                .click('#button')
                .checkpoint('end')
                .getFlow().then(flow => {
                    assert.instanceOf(flow, Flow)
                    assert.property(flow, 'devices')
                    assert.deepPropertyVal(flow, 'devices.A.deviceId', 'A')
                })
                .end()

        })
    })
})

@@ -328,32 +328,33 @@
 ments', function
+ 
 () %7B%0A        it(
@@ -391,32 +391,33 @@
  name', function
+ 
 () %7B%0A           
@@ -994,32 +994,33 @@
 tFlow', function
+ 
 () %7B%0A        it(
@@ -1050,24 +1050,25 @@
 t', function
+ 
 () %7B%0A       
@@ -1540,16 +1540,16 @@
 .end()%0A%0A
-
         
@@ -1558,11 +1558,1456 @@
 %0A    %7D)%0A
+%0A%0A    describe('app framework integration', () =%3E %7B%0A%0A        describe('for XD-MVC', () =%3E %7B%0A            //// Set base url%0A            xdTesting.baseUrl = 'http://localhost/'%0A%0A            // Define a custom adapter%0A            xdTesting.app = xdTesting.adapter.xdmvc%0A%0A            it('should load xdTesting.baseUrl after init', () =%3E %7B%0A                let options = %7B%0A                    A: templates.devices.chrome()%0A                %7D%0A%0A                // Enable app specific commands%0A                xdTesting.app = xdTesting.adapter.xdmvc()%0A%0A                return xdTesting.multiremote(options).init()%0A                    .getUrl().then(url =%3E assert.equal(url, xdTesting.baseUrl))%0A%0A                    /**%0A                     * App property?%0A                     */%0A%0A                    //// Pair devices via url%0A                    //.app.pairDevicesViaUrl()%0A                    // Get event counter%0A                    //.app.getEventCounter().then(counter =%3E assert.equal(counter.XDconnection == 1))%0A                // Wait for the next event of a type%0A                //.app.waitForEvent('XDconnection')%0A                //// Wait until the event type counter equals a value%0A                //.app.waitForEventCount('XDconnection', 2)%0A                //// Custom command%0A                //.app.addCommand('pairDevicesViaGUI', function() %7B%0A                //    return this.click(...)%0A                //%7D)%0A            %7D)%0A        %7D)%0A%0A    %7D)%0A
 %7D)%0A

Test that xdTesting.baseUrl is loaded after init