// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage

module.exports = {
  'Login': browser => {
    browser
      .url(process.env.VUE_DEV_SERVER_URL)
      .waitForElementVisible('#app', 5000)
      .assert.elementPresent('form')
      .setValue('input[type=text]', 'admin@example.com')
      .setValue('input[type=password]', 'admin')
      .click('button')
      .pause(5000)
      .assert.elementPresent('.dashboard')
  },
  'Customers': browser => {
    browser
      .useXpath()
      .click("//a[normalize-space()='Clientes']")
      .useCss()
      .pause(5000)
      .assert.elementPresent('.crud')
      .assert.containsText('.heading h2', 'Clientes:')
  },
  'PurchaseOrders': browser => {
		browser

			 .useXpath()

			 .click("//a[normalize-space()='Ordenes de Compra']")

			 .useCss()

			 .pause(5000)

			 .assert.elementPresent('.crud')
			.assert.containsText('.heading h2', 'Ordenes de Compra:')
	},
  'Users': browser => {
    browser
			.useXpath()
			.click("//a[normalize-space()='Usuarios']")
			.useCss()
			.pause(5000)
			.assert.elementPresent('.crud')
      .assert.containsText('.heading h2', 'Usuarios:')
    },
  // New Test
  'End': browser => {
    browser
      .end()
  }
}
