mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 01:25:42 -05:00
Add initial nightwatch smoke test, package commands
This commit is contained in:
parent
951db5a721
commit
1ac40a94e7
4 changed files with 150 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -105,3 +105,6 @@ Dockerfile
|
|||
# coffeelint for editors (might be standardized eventually)
|
||||
coffeelint.json
|
||||
gitSpy/*
|
||||
|
||||
# nightwatch reports
|
||||
spec/smoke/reports/
|
||||
|
|
38
nightwatch.json
Normal file
38
nightwatch.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"src_folders": ["spec/smoke"],
|
||||
"output_folder": "spec/smoke/reports",
|
||||
"custom_commands_path": "",
|
||||
"custom_assertions_path": "",
|
||||
"page_objects_path": "",
|
||||
"globals_path": "",
|
||||
|
||||
"selenium": {
|
||||
"start_process": true,
|
||||
"start_session": true,
|
||||
"server_path": "node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.53.1.jar",
|
||||
"log_path": "",
|
||||
"host": "127.0.0.1",
|
||||
"port": 4444,
|
||||
"cli_args": {
|
||||
"webdriver.chrome.driver": "node_modules/chromedriver/lib/chromedriver/chromedriver"
|
||||
}
|
||||
},
|
||||
|
||||
"test_settings": {
|
||||
"default": {
|
||||
"launch_url": "http://localhost",
|
||||
"selenium_port": 4444,
|
||||
"selenium_host": "localhost",
|
||||
"silent": true,
|
||||
"screenshots": {
|
||||
"enabled": false,
|
||||
"path": ""
|
||||
},
|
||||
"desiredCapabilities": {
|
||||
"browserName": "chrome",
|
||||
"javascriptEnabled": true,
|
||||
"acceptSslCerts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,7 +41,11 @@
|
|||
"jasmine-node": "jasmine-node",
|
||||
"multicore": "coffee multicore.coffee",
|
||||
"jasmine": "jasmine",
|
||||
"proxy": "COCO_PROXY='true' nodemon"
|
||||
"proxy": "COCO_PROXY='true' nodemon",
|
||||
"smoke-local": "COCO_SMOKE_DOMAIN='local' nightwatch",
|
||||
"smoke-next": "COCO_SMOKE_DOMAIN='next' nightwatch",
|
||||
"smoke-prod": "COCO_SMOKE_DOMAIN='prod' nightwatch",
|
||||
"smoke-staging": "COCO_SMOKE_DOMAIN='staging' nightwatch"
|
||||
},
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
|
@ -98,6 +102,7 @@
|
|||
"auto-reload-brunch": "^1.8.1",
|
||||
"bower": "~1.6.4",
|
||||
"brunch": "^1.8.5",
|
||||
"chromedriver": "^2.24.1",
|
||||
"coffee-script-brunch": "^1.8.3",
|
||||
"coffeelint-brunch": "^1.7.1",
|
||||
"commonjs-require-definition": "0.2.0",
|
||||
|
@ -120,11 +125,13 @@
|
|||
"karma-requirejs": "~0.2.1",
|
||||
"karma-script-launcher": "~0.1.0",
|
||||
"marked": "0.2.x",
|
||||
"nightwatch": "^0.9.8",
|
||||
"nock": "^2.17.0",
|
||||
"nodemon": "1.6.1",
|
||||
"parse-domain": "^0.2.1",
|
||||
"requirejs": "~2.1.10",
|
||||
"sass-brunch": "https://github.com/basicer/sass-brunch-bleeding/archive/1.9.1-bleeding.tar.gz",
|
||||
"selenium-server-standalone-jar": "^2.53.1",
|
||||
"telepath-brunch": "https://github.com/nwinter/telepath-brunch/tarball/master",
|
||||
"uglify-js": "^2.5.0"
|
||||
},
|
||||
|
|
101
spec/smoke/individual-account-lifecycle.js
Normal file
101
spec/smoke/individual-account-lifecycle.js
Normal file
|
@ -0,0 +1,101 @@
|
|||
WAIT_TIMEOUT = 8000;
|
||||
|
||||
// TODO: Refactor into shared file
|
||||
switch (process.env.COCO_SMOKE_DOMAIN) {
|
||||
case "local":
|
||||
DOMAIN = 'http://localhost:3000';
|
||||
break;
|
||||
case "next":
|
||||
DOMAIN = 'http://next.codecombat.com';
|
||||
break;
|
||||
case "staging":
|
||||
DOMAIN = 'http://staging.codecombat.com';
|
||||
break;
|
||||
case "prod":
|
||||
DOMAIN = 'https://codecombat.com';
|
||||
break;
|
||||
default:
|
||||
DOMAIN = 'http://localhost:3000';
|
||||
}
|
||||
|
||||
var timestamp = new Date().getTime(),
|
||||
email = `email${timestamp}@${timestamp}.com`,
|
||||
name = timestamp.toString(),
|
||||
password = timestamp.toString();
|
||||
|
||||
module.exports = {
|
||||
'Sign up': function (browser) {
|
||||
|
||||
browser
|
||||
// Go to home page
|
||||
.url(DOMAIN)
|
||||
.resizeWindow(1250, 900)
|
||||
|
||||
// Open login modal
|
||||
.executeAsync(function(done) { window.currentView.supermodel.finishLoading.then(done); })
|
||||
.click('#create-account-link')
|
||||
|
||||
// Sign up
|
||||
.waitForElementVisible('.individual-path-button', WAIT_TIMEOUT)
|
||||
.click('.individual-path-button')
|
||||
.waitForElementVisible('#birthday-month-input', WAIT_TIMEOUT)
|
||||
.setValue('#birthday-month-input', 'January')
|
||||
.setValue('#birthday-day-input', '1')
|
||||
.setValue('#birthday-year-input', '1999')
|
||||
.click('.next-button')
|
||||
.waitForElementVisible('input[name="email"]', WAIT_TIMEOUT)
|
||||
.setValue('input[name="email"]', email)
|
||||
.setValue('input[name="name"]', name)
|
||||
.setValue('input[name="password"]', password)
|
||||
.click('#subscribe-input')
|
||||
.pause(100) // Sometimes create account button does not get clicked
|
||||
.click('#create-account-btn')
|
||||
.waitForElementVisible('#start-btn', WAIT_TIMEOUT)
|
||||
.click('#start-btn')
|
||||
|
||||
// Confirm we went to campaign view, navigate back to home
|
||||
.waitForElementVisible('#logout-button', WAIT_TIMEOUT * 3) // takes particularly long
|
||||
.assert.urlContains('/play')
|
||||
},
|
||||
|
||||
'Logout': function (browser) {
|
||||
browser
|
||||
.url(DOMAIN)
|
||||
.executeAsync(function (done) {
|
||||
window.currentView.supermodel.finishLoading.then(done);
|
||||
})
|
||||
.click('.dropdown-toggle')
|
||||
.waitForElementVisible('.dropdown #logout-button', WAIT_TIMEOUT)
|
||||
.click('.dropdown #logout-button')
|
||||
},
|
||||
|
||||
'Log back in': function (browser) {
|
||||
browser
|
||||
// Log back in
|
||||
.waitForElementVisible('#login-link', WAIT_TIMEOUT)
|
||||
.click('#login-link')
|
||||
.waitForElementVisible('#login-btn', WAIT_TIMEOUT)
|
||||
.setValue('input#username-or-email-input', email)
|
||||
.setValue('input#password-input', password)
|
||||
.click('#login-btn')
|
||||
.pause(100)
|
||||
.waitForElementVisible('#main-nav', WAIT_TIMEOUT)
|
||||
},
|
||||
|
||||
'Delete account': function (browser) {
|
||||
browser
|
||||
// Delete account
|
||||
.url(`${DOMAIN}/account/settings`)
|
||||
.pause(100)
|
||||
.executeAsync(function(done) { window.currentView.supermodel.finishLoading.then(done); })
|
||||
.waitForElementVisible('#delete-account-email-or-username', WAIT_TIMEOUT)
|
||||
.setValue('#delete-account-email-or-username', email)
|
||||
.setValue('#delete-account-password', password)
|
||||
.click('#delete-account-btn')
|
||||
.waitForElementVisible('#confirm-button', WAIT_TIMEOUT)
|
||||
.click('#confirm-button')
|
||||
.end();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in a new issue