Skip to content

Instantly share code, notes, and snippets.

@MoLow
Last active November 13, 2019 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MoLow/17ac9bc5ce6306974a7b87ba9726e4d8 to your computer and use it in GitHub Desktop.
Save MoLow/17ac9bc5ce6306974a7b87ba9726e4d8 to your computer and use it in GitHub Desktop.
exists never returns
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]"]');
});
});
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