-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.e2e.ts
47 lines (36 loc) · 1.46 KB
/
app.e2e.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
import {QuotesListPO} from './quotesList.po';
import {QuotesFormPO} from './quotesForm.po';
import {QuotePagePO} from './quotePage.po';
describe('Quotes app', () => {
let quotesListPO: QuotesListPO;
let quotesFormPO: QuotesFormPO;
let quotePagePO: QuotePagePO;
beforeEach(async () => {
quotesListPO = new QuotesListPO();
quotesFormPO = new QuotesFormPO();
quotePagePO = new QuotePagePO();
await quotesListPO.toMainPage();
});
it('A list of quotes should be displayed on the page', async () => {
expect(await quotesListPO.getQuotesCount()).toBeGreaterThan(0);
});
it('The created quote should be appended to list', async () => {
const text = `Dont hurt me (${Date.now()})`;
const author = 'Hulk';
await quotesFormPO.setAuthor(author);
await quotesFormPO.setText(text);
await quotesFormPO.sendForm();
await quotesListPO.waitForQuoteByText(text);
const lastQuote = quotesListPO.quotes.last();
expect(await quotesListPO.getQuoteText(lastQuote)).toBe(text);
});
it('Quote page should be opened on click to quote item', async () => {
const firstQuote = quotesListPO.quotes.first();
const text = await quotesListPO.getQuoteText(firstQuote);
const author = await quotesListPO.getQuoteAuthor(firstQuote);
await firstQuote.click();
await quotePagePO.waitForQuotePage();
expect(await quotePagePO.getQuoteText()).toBe(text);
expect(await quotePagePO.getQuoteAuthor()).toBe(author);
});
});