diff --git a/tasks/gulp-eslint.js b/tasks/gulp-eslint.js index 13fe2281e1..9a885a91fa 100644 --- a/tasks/gulp-eslint.js +++ b/tasks/gulp-eslint.js @@ -21,7 +21,6 @@ const TEST_FILES = [ '!./test/api-legacy/**/*', '!./test/common/simulations/**/*', '!./test/content/**/*', - '!./test/e2e/**/*', '!./test/server_side/**/*', '!./test/spec/**/*', ]; diff --git a/test/e2e/.eslintrc b/test/e2e/.eslintrc new file mode 100644 index 0000000000..ecf3d02e9f --- /dev/null +++ b/test/e2e/.eslintrc @@ -0,0 +1,13 @@ +{ + "rules": { + "func-names": 0, + "no-var": 0, + "prefer-template": 0 + }, + "globals": { + "browser": true, + "by": true, + "element": true, + "jasmine": true + } +} diff --git a/test/e2e/e2e.js b/test/e2e/e2e.js index 5733543656..90a3a742f3 100644 --- a/test/e2e/e2e.js +++ b/test/e2e/e2e.js @@ -1,20 +1,21 @@ 'use strict'; -describe('front page', function() { - beforeEach(function(){ +var fs = require('fs'); + +describe('front page', function () { + beforeEach(function () { browser.ignoreSynchronization = true; browser.get('/'); browser.sleep(1000); }); // based on https://github.com/angular/protractor/issues/114#issuecomment-29046939 - afterEach(function(){ + afterEach(function () { var currentSpec = jasmine.getEnv().currentSpec; var passed = currentSpec.results().passed(); - if(!passed){ + if (!passed) { var filename = 'exception_' + currentSpec.description + '.png'; - browser.takeScreenshot().then(function(png){ - var fs = require('fs'); + browser.takeScreenshot().then(function (png) { var buffer = new Buffer(png, 'base64'); var stream = fs.createWriteStream(filename); stream.write(buffer); @@ -23,25 +24,25 @@ describe('front page', function() { } }); - it('shows the front page', function(){ + it('shows the front page', function () { var button = element(by.id('play-btn')); expect(button.getText()).toEqual('Join for free'); }); - it("doesn't login when using wrong credentials", function(){ + it('does not login when using wrong credentials', function () { var button = element(by.id('play-btn')); button.click(); browser.sleep(1000); element(by.model('loginUsername')).sendKeys('username'); element(by.model('loginPassword')).sendKeys('pass'); - var login = element(by.css("#loginForm input[value='Login']")); + var login = element(by.css('#loginForm input[value="Login"]')); login.click(); var alertDialog = browser.switchTo().alert(); - expect(alertDialog.getText()).toMatch("Uh-oh - your username or password is incorrect.\n- Make sure your username or email is typed correctly.\n- You may have signed up with Facebook, not email. Double-check by trying Facebook login.\n- If you forgot your password, click \"Forgot Password\" on the habitica.com website's login form."); + expect(alertDialog.getText()).toMatch('Uh-oh - your username or password is incorrect.\n- Make sure your username or email is typed correctly.\n- You may have signed up with Facebook, not email. Double-check by trying Facebook login.\n- If you forgot your password, click "Forgot Password" on the habitica.com website\'s login form.'); alertDialog.accept(); }); - xit('registers a new user', function(){ + xit('registers a new user', function () { var button = element(by.id('play-btn')); button.click(); browser.sleep(1000); @@ -51,10 +52,10 @@ describe('front page', function() { element(by.model('registerVals.email')).sendKeys('user@example.com'); element(by.model('registerVals.password')).sendKeys('pass'); element(by.model('registerVals.confirmPassword')).sendKeys('pass'); - var register = element(by.css("#registrationForm input[value='Register']")); + var register = element(by.css('#registrationForm input[value="Register"]')); register.click(); browser.sleep(1000); - browser.getCurrentUrl().then(function(url){ + browser.getCurrentUrl().then(function (url) { expect(url).not.toMatch(/static\/front/); }); });