Last active
November 13, 2019 14:11
-
-
Save MoLow/17ac9bc5ce6306974a7b87ba9726e4d8 to your computer and use it in GitHub Desktop.
exists never returns
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
mport { go, it, describe, beforeEach, text, type, click, exists, afterEach } from 'testim'; | |
import { expect } from 'chai'; | |
const login = async () => { | |
const a = await exists('.Header-link.name'); | |
console.log(a); | |
if(!(await exists('.Header-link.name'))) { | |
await go('https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Fdiscover'); | |
await type('input[name="login"]', 'tdkShit'); | |
await type('input[name="password"]', 'benjiLoacker!@#3'); | |
await click('[type=submit]'); | |
await go('https://gist.github.com/'); | |
} | |
}; | |
describe('Test suite', () => { | |
beforeEach(async () => { | |
await go('https://gist.github.com/'); | |
await login(); | |
}); | |
afterEach(async () => { | |
try { | |
await click('button[aria-label="Delete this Gist"]'); | |
} catch(e) {} | |
}); | |
it('creates a new gist', async () => { | |
await type('input[name="gist[description]"]', 'a new shiny gist'); | |
await type('input[name="gist[contents][][name]"]', 'benji.shit'); | |
await click('button[name="gist[public]"]'); | |
}); | |
}); |
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
import { go, it, describe, beforeEach, text, type, click, waitForElement, afterEach } from 'testim'; | |
import { expect } from 'chai'; | |
const login = async () => { | |
const a = await waitForElement('.Header-link.name'); | |
console.log(a); | |
if(!(await waitForElement('.Header-link.name'))) { | |
await go('https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Fdiscover'); | |
await type('input[name="login"]', 'tdkShit'); | |
await type('input[name="password"]', 'benjiLoacker!@#3'); | |
await click('[type=submit]'); | |
await go('https://gist.github.com/'); | |
} | |
}; | |
describe('Test suite', () => { | |
beforeEach(async () => { | |
await go('https://gist.github.com/'); | |
await login(); | |
}); | |
afterEach(async () => { | |
try { | |
await click('button[aria-label="Delete this Gist"]'); | |
} catch(e) {} | |
}); | |
it('creates a new gist', async () => { | |
await type('input[name="gist[description]"]', 'a new shiny gist'); | |
await type('input[name="gist[contents][][name]"]', 'benji.shit'); | |
await click('button[name="gist[public]"]'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment