-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
close #114 - save pass entries in the local storage for guests
- Loading branch information
Showing
9 changed files
with
348 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,14 @@ describe('main', function() { | |
const PASS = 'mypassmypass'; | ||
const EMAIL = '[email protected]'; | ||
|
||
const uniqueUser = (function() { | ||
let counter = 1; | ||
|
||
return () => `${USER}${counter++}`; | ||
})(); | ||
|
||
const uniqueEmail = () => `${uniqueUser()}@myemail.ru`; | ||
|
||
describe('login', function() { | ||
const Page = require('./pageobjects/page.js'); | ||
const page = new Page(); | ||
|
@@ -74,104 +82,138 @@ describe('main', function() { | |
describe('home', function() { | ||
const page = require('./pageobjects/home.js'); | ||
|
||
beforeEach(function() { | ||
page.open(); | ||
page.login(USER, PASS); | ||
page.waitForSuccessLogin(); | ||
page.removeAllPasses(); | ||
page.waitForNoPasses(); | ||
}); | ||
|
||
afterEach(function() { | ||
page.waitForNoPasses(); | ||
page.logout(); | ||
page.waitForSuccessLogout(); | ||
}); | ||
|
||
it('can add and remove pass', function() { | ||
let pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
|
||
page.addPass(pass); | ||
page.waitForPass(pass); | ||
page.removeLastPass(); | ||
page.waitForPass(pass, undefined, true); | ||
}); | ||
it('can add and remove pass with refresh', function() { | ||
let pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
|
||
page.addPass(pass); | ||
page.waitForPass(pass); | ||
page.removeLastPass(); | ||
page.waitForPass(pass, undefined, true); | ||
|
||
page.refreshAllPasses(); | ||
page.waitForPass(pass, undefined, true); | ||
}); | ||
it('bug with delete', function() { | ||
let pass1 = { | ||
title: 'first title', | ||
user: 'first user', | ||
password: 'first password' | ||
}; | ||
let pass2 = { | ||
title: 'second title', | ||
user: 'second user', | ||
password: 'second password' | ||
}; | ||
|
||
page.addPass(pass1); | ||
page.addPass(pass2); | ||
page.waitForPass(pass1); | ||
page.removePass(pass1); | ||
page.refreshAllPasses(); | ||
page.waitForPass(pass1, undefined, true); | ||
page.waitForPass(pass2); | ||
page.removeLastPass(); | ||
}); | ||
it('can edit', function() { | ||
let pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
|
||
let updatedPass = { | ||
title: 'updated title', | ||
user: 'updated user', | ||
password: 'updated password' | ||
}; | ||
|
||
page.addPass(pass); | ||
page.editLastPass(updatedPass); | ||
page.waitForPass(updatedPass); | ||
page.waitForPass(pass, undefined, true); | ||
page.removeLastPass(); | ||
}); | ||
it('can search', function() { | ||
let pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
let passing_query = "tit"; | ||
let failing_query = "lalala"; | ||
|
||
page.addPass(pass); | ||
page.searchPass(passing_query); | ||
page.waitForPass(pass); | ||
page.searchPass(failing_query); | ||
page.waitForNoPasses(); | ||
page.searchPass(""); | ||
page.waitForPass(pass); | ||
page.removeLastPass(); | ||
describe('logged in user', function() { | ||
beforeEach(function() { | ||
page.open(); | ||
page.login(USER, PASS); | ||
page.waitForSuccessLogin(); | ||
page.removeAllPasses(); | ||
page.waitForNoPasses(); | ||
}); | ||
|
||
afterEach(function() { | ||
page.waitForNoPasses(); | ||
page.logout(); | ||
page.waitForSuccessLogout(); | ||
}); | ||
|
||
it('can add and remove pass', function() { | ||
let pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
|
||
page.addPass(pass); | ||
page.waitForPass(pass); | ||
page.removeLastPass(); | ||
page.waitForPass(pass, undefined, true); | ||
}); | ||
it('can add and remove pass with refresh', function() { | ||
let pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
|
||
page.addPass(pass); | ||
page.waitForPass(pass); | ||
page.removeLastPass(); | ||
page.waitForPass(pass, undefined, true); | ||
|
||
page.refreshAllPasses(); | ||
page.waitForPass(pass, undefined, true); | ||
}); | ||
it('bug with delete', function() { | ||
let pass1 = { | ||
title: 'first title', | ||
user: 'first user', | ||
password: 'first password' | ||
}; | ||
let pass2 = { | ||
title: 'second title', | ||
user: 'second user', | ||
password: 'second password' | ||
}; | ||
|
||
page.addPass(pass1); | ||
page.addPass(pass2); | ||
page.waitForPass(pass1); | ||
page.removePass(pass1); | ||
page.refreshAllPasses(); | ||
page.waitForPass(pass1, undefined, true); | ||
page.waitForPass(pass2); | ||
page.removeLastPass(); | ||
}); | ||
it('can edit', function() { | ||
let pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
|
||
let updatedPass = { | ||
title: 'updated title', | ||
user: 'updated user', | ||
password: 'updated password' | ||
}; | ||
|
||
page.addPass(pass); | ||
page.editLastPass(updatedPass); | ||
page.waitForPass(updatedPass); | ||
page.waitForPass(pass, undefined, true); | ||
page.removeLastPass(); | ||
}); | ||
it('can search', function() { | ||
let pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
let passing_query = "tit"; | ||
let failing_query = "lalala"; | ||
|
||
page.addPass(pass); | ||
page.searchPass(passing_query); | ||
page.waitForPass(pass); | ||
page.searchPass(failing_query); | ||
page.waitForNoPasses(); | ||
page.searchPass(""); | ||
page.waitForPass(pass); | ||
page.removeLastPass(); | ||
}); | ||
}); | ||
|
||
describe('guest user', function() { | ||
beforeEach(function() { | ||
page.open(); | ||
}); | ||
|
||
it('should keep passwords after signup', function() { | ||
const pass = { | ||
title: 'test title', | ||
user: 'test user', | ||
password: 'test password' | ||
}; | ||
|
||
page.addPass(pass); | ||
page.waitForPass(pass); | ||
|
||
page.signup(uniqueUser(), PASS, uniqueEmail()); | ||
page.waitForSuccessSignup(); | ||
page.waitForSuccessLogin(); | ||
|
||
page.waitForPass(pass); | ||
|
||
page.removeAllPasses(); | ||
page.waitForNoPasses(); | ||
|
||
page.logout(); | ||
page.waitForSuccessLogout(); | ||
|
||
page.removeAllPasses(); | ||
page.waitForNoPasses(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.