client path small refactor for login helper
This commit is contained in:
parent
2721b87e57
commit
0876a38104
|
@ -8,12 +8,12 @@ function child(selector, childNumber) {
|
||||||
return selector.replace(aux[0], `${aux[0]}:nth-child(${childNumber})`);
|
return selector.replace(aux[0], `${aux[0]}:nth-child(${childNumber})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nightmare.action('login', function(name, password, done) {
|
Nightmare.action('login', function(done) {
|
||||||
try {
|
try {
|
||||||
this.goto(`${config.url}auth/?apiKey=salix`)
|
this.goto(`${config.url}auth/?apiKey=salix`)
|
||||||
.wait(`${components.textFieldInput}`)
|
.wait(`${components.textFieldInput}`)
|
||||||
.write(`${child(components.textFieldInput, 1)}`, name)
|
.write(`${child(components.textFieldInput, 1)}`, 'nightmare')
|
||||||
.write(`${child(components.textFieldInput, 2)}`, password)
|
.write(`${child(components.textFieldInput, 2)}`, 'nithmarePassword')
|
||||||
.click(components.submitButton)
|
.click(components.submitButton)
|
||||||
.then(done);
|
.then(done);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -8,8 +8,8 @@ const nightmare = createNightmare();
|
||||||
describe('Clients path', () => {
|
describe('Clients path', () => {
|
||||||
fit('should log in', done => {
|
fit('should log in', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.login('nightmare', 'NightmarePassword')
|
.login()
|
||||||
.wait(1000)
|
.wait(200)
|
||||||
.url()
|
.url()
|
||||||
.then(url => {
|
.then(url => {
|
||||||
expect(url).toBe(config.url + '#!/');
|
expect(url).toBe(config.url + '#!/');
|
||||||
|
|
Loading…
Reference in New Issue