Skip to content

Instantly share code, notes, and snippets.

@AlexanderMoskovkin
Created March 28, 2018 08:29
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 AlexanderMoskovkin/f1e0e74540b3e1a59490e2cb9183673d to your computer and use it in GitHub Desktop.
Save AlexanderMoskovkin/f1e0e74540b3e1a59490e2cb9183673d to your computer and use it in GitHub Desktop.
[Stack Overflow Question] Define testcafe userrole in typescript
import { Role, t } from 'testcafe';
export const UserRole: Role = Role('https://github.com/login', async (t) => {
await t
.typeText('#login_field', '<my-login>')
.typeText('#password', '<my-password>')
.click('input[value="Sign in"]');
}, { preserveUrl: true });
import { Selector } from 'testcafe';
import { UserRole } from './role';
fixture('Check logged user')
.beforeEach(async t => {
await t.useRole(UserRole);
});
test('test', async t => {
await t.wait(1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment