client path small refactor for login helper

This commit is contained in:
Carlos 2017-09-15 15:36:03 +02:00
parent 2721b87e57
commit 0876a38104
2 changed files with 5 additions and 5 deletions

View File

@ -8,12 +8,12 @@ function child(selector, childNumber) {
return selector.replace(aux[0], `${aux[0]}:nth-child(${childNumber})`);
}
Nightmare.action('login', function(name, password, done) {
Nightmare.action('login', function(done) {
try {
this.goto(`${config.url}auth/?apiKey=salix`)
.wait(`${components.textFieldInput}`)
.write(`${child(components.textFieldInput, 1)}`, name)
.write(`${child(components.textFieldInput, 2)}`, password)
.write(`${child(components.textFieldInput, 1)}`, 'nightmare')
.write(`${child(components.textFieldInput, 2)}`, 'nithmarePassword')
.click(components.submitButton)
.then(done);
} catch (err) {

View File

@ -8,8 +8,8 @@ const nightmare = createNightmare();
describe('Clients path', () => {
fit('should log in', done => {
nightmare
.login('nightmare', 'NightmarePassword')
.wait(1000)
.login()
.wait(200)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/');