-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathtest.ts
48 lines (39 loc) · 1.49 KB
/
test.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
import { Browser, ensure } from '../lib';
import { Builder, ThenableWebDriver, WebElement, By, WebElementPromise, until } from 'selenium-webdriver';
import { AllPages } from '../pages';
describe('Submit ideas', () => {
let pages: AllPages;
before(async () => {
pages = new AllPages(new Browser('chrome'));
});
it('Test Case #1: Unauthenticated cannot submit ideas', async () => {
// Action
await pages.home.navigate();
await pages.home.IdeaTitle.type('Add support to TypeScript');
// Assert
await Promise.all([
ensure(pages.home.UserMenu).textIs('Sign in'),
ensure(pages.home.SubmitIdea).isNotVisible(),
ensure(pages.home.IdeaDescription).isNotVisible(),
]);
});
it('Test Case #2: Authenticated can submit ideas', async () => {
// Action
await pages.home.navigate();
await pages.home.signInWithGoogle();
await pages.google.signInAsDarthVader();
// Assert
await ensure(pages.home.UserMenu).textIs('Darth Vader');
// Action
await pages.home.submitNewIdea('Host a TypeScript workshop!', 'Workshop would be useful to have hands-on practice with the language.');
// Assert
await Promise.all([
ensure(pages.showIdea.Title).textIs('Host a TypeScript workshop!'),
ensure(pages.showIdea.Description).textIs('Workshop would be useful to have hands-on practice with the language.'),
ensure(pages.showIdea.SupportCounter).textIs('1'),
]);
});
after(async () => {
await pages.dispose();
});
});