-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathspec.ts
60 lines (49 loc) · 1.86 KB
/
spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { Browser, ensure } from '../lib';
import { specification, when, action, then } from '../lib/mocha-bdd';
import { AllPages } from '../pages';
specification('Users can submit ideas', () => {
let pages: AllPages;
action(async () => {
pages = new AllPages(new Browser('chrome'));
await pages.home.navigate();
});
when('user is logged out', async () => {
then('it should display sign in message', async () => {
await ensure(pages.home.UserMenu).textIs('Sign in');
});
when('title is typed', async () => {
action(async () => {
await pages.home.IdeaTitle.type('Add support to TypeScript');
});
then('it should not display submit button after typing idea', async () => {
await ensure(pages.home.IdeaDescription).isNotVisible();
});
});
});
when('user sign in', async () => {
action(async () => {
await pages.home.signInWithGoogle();
await pages.google.signInAsDarthVader();
});
then('it should display correct user name', async () => {
await ensure(pages.home.UserMenu).textIs('Darth Vader');
});
when('new idea is submitted', async () => {
action(async () => {
await pages.home.submitNewIdea('Host a TypeScript workshop!', 'Workshop would be useful to have hands-on practice with the language.');
});
then('it should have 1 supporter', async () => {
await ensure(pages.showIdea.SupportCounter).textIs('1');
});
then('it should show correct title', async () => {
await ensure(pages.showIdea.Title).textIs('Host a TypeScript workshop!');
});
then('it should show correct description', async () => {
await ensure(pages.showIdea.Description).textIs('Workshop would be useful to have hands-on practice with the language.');
});
});
});
after(async () => {
await pages.dispose();
});
});