-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathCalculatorWithPageObject.test.ts
48 lines (38 loc) · 1.48 KB
/
CalculatorWithPageObject.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
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { driver, By2, windowsAppDriverCapabilities } from 'selenium-appium'
import CalculatorPage from '../Pages/CalculatorPage'
import { calculatorAppId } from '../Setup'
jest.setTimeout(50000);
const capabilites = windowsAppDriverCapabilities(calculatorAppId)
beforeAll(() => {
return driver.startWithCapabilities(capabilites);
});
afterAll(() => {
return driver.quit();
});
describe('Calulator Test', () => {
// Applies only to tests in this describe block
beforeEach(async () => {
await CalculatorPage.waitForPageLoaded();
await CalculatorPage.clearButton.click();
});
test('Addition', async () => {
// Find the buttons by their names and click them in sequence to perform 1 + 7 = 8
expect(await CalculatorPage.plus('1', '7')).toBe('8');
});
test('Division', async () => {
// Find the buttons by their accessibility ids and click them in sequence to perform 88 / 11 = 8
expect(await CalculatorPage.divid('88', '11')).toBe('8');
});
test('Multiplication', async () => {
// Find the buttons by their names using XPath and click them in sequence to perform 9 x 9 = 81
expect(await CalculatorPage.multiply('9', '9')).toBe('81');
});
test('Subtraction', async () => {
// Find the buttons by their accessibility ids using XPath and click them in sequence to perform 9 - 1 = 8
expect(await CalculatorPage.minus('9', '1')).toBe('8');
});
});