Browse Source

Added nightwatch with a sample test

wip-firestore
Atridad Lahiji 1 year ago
parent
commit
4d901c3345
  1. 21
      nightwatch.conf.js
  2. 1282
      package-lock.json
  3. 11
      package.json
  4. 18
      test/e2e/homepage.js
  5. 28
      tests_output/CHROME_80.0.3987.122_Windows_homepage.xml

21
nightwatch.conf.js

@ -0,0 +1,21 @@
const chrome = require('chromedriver')
module.exports = {
'src_folders': ['test/e2e'],
'webdriver': {
'start_process': true,
'server_path': chrome.path,
'cli_args': [
'--verbose'
],
'port': 9515
},
'test_settings': {
'default': {
'desiredCapabilities': {
'browserName': 'chrome'
}
}
}
}

1282
package-lock.json
File diff suppressed because it is too large
View File

11
package.json

@ -10,7 +10,8 @@
"start": "nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"test": "jest"
"test-unit": "jest",
"test-e2e": "nightwatch"
},
"dependencies": {
"@nuxtjs/axios": "^5.3.6",
@ -24,15 +25,17 @@
"vuex-persistedstate": "^2.7.0"
},
"devDependencies": {
"@nuxtjs/vuetify": "^1.0.0",
"@nuxtjs/eslint-config": "^1.0.1",
"@nuxtjs/eslint-module": "^1.0.0",
"@nuxtjs/vuetify": "^1.0.0",
"@vue/test-utils": "^1.0.0-beta.27",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.1.0",
"chromedriver": "^80.0.1",
"eslint": "^6.1.0",
"eslint-plugin-nuxt": ">=0.4.2",
"@vue/test-utils": "^1.0.0-beta.27",
"babel-jest": "^24.1.0",
"jest": "^24.1.0",
"nightwatch": "^1.3.4",
"vue-jest": "^4.0.0-0"
}
}

18
test/e2e/homepage.js

@ -0,0 +1,18 @@
module.exports = {
/* eslint-disable */
'Load Homepage' : function (client) {
client
.url('http://www.google.com')
.waitForElementVisible('body', 1000)
.assert.title('Google')
.assert.visible('input[type=text]')
.setValue('input[type=text]', 'rembrandt van rijn')
.waitForElementVisible('button[name=btnG]', 1000)
.click('button[name=btnG]')
.pause(1000)
.assert.containsText('ol#rso li:first-child',
'Rembrandt - Wikipedia')
.end()
}
/* eslint-enable */
}

28
tests_output/CHROME_80.0.3987.122_Windows_homepage.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites errors="0"
failures="1"
tests="1">
<testsuite name="homepage"
errors="0" failures="1" hostname="" id="" package="homepage" skipped="0"
tests="1" time="2.147" timestamp="">
<testcase name="Demo test Google" classname="homepage" time="2.147" assertions="4">
<failure message="Timed out while waiting for element &lt;button[name=btnG]&gt; to be present for 1000 milliseconds. - expected [0;32m&#34;visible&#34;[0m but got: [0;31m&#34;not found&#34;[0m [0;90m(1039ms)[0m"> at Object.Demo test Google (C:\Users\Atridad Lahiji\Documents\Pollo\test\e2e\homepage.js:9:8)
at process._tickCallback (internal/process/next_tick.js:68:7)</failure>
<failure message=" at Object.Demo test Google (C:\Users\Atridad Lahiji\Documents\Pollo\test\e2e\homepage.js:9:8)"> at process._tickCallback (internal/process/next_tick.js:68:7)</failure>
</testcase>
</testsuite>
</testsuites>