Skip to content

Commit 1264db6

Browse files
author
Vladislav
committed
Small fixes
1 parent bb09d00 commit 1264db6

File tree

6 files changed

+49
-89
lines changed

6 files changed

+49
-89
lines changed

eform-client/e2e/Helper methods/other-helper-methods.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
import {browser, by, element, ElementFinder, ExpectedConditions} from 'protractor';
22
import {LoginPage} from '../Page objects/LoginPage';
3-
import {default as data} from '../data';
43
import {Navbar} from '../Page objects/Navbar';
54

6-
const loginPage = new LoginPage();
7-
const navbar = new Navbar();
85

9-
export function waitTillVisibleAndClick(element): void {
6+
export function waitTillVisibleAndClick(element: ElementFinder): void {
107
browser.waitForAngular();
118
browser.wait(ExpectedConditions.visibilityOf(element));
129
element.click();
1310
}
1411

15-
export function getToPage(page) {
16-
browser.get(data.startPageUrl);
17-
loginPage.login();
18-
waitTillVisibleAndClick(page);
19-
}
20-
2112
export function signOut() {
13+
const loginPage = new LoginPage();
14+
const navbar = new Navbar();
15+
// browser.waitForAngular();
16+
// browser.wait(ExpectedConditions.elementToBeClickable(navbar.signOutButton));
17+
// browser.wait(ExpectedConditions.elementToBeClickable(navbar.signOutButton));
18+
// navbar.signOutDropdown.click();
19+
// browser.waitForAngular();
20+
// navbar.signOutButton.click();
21+
// browser.wait(ExpectedConditions.elementToBeClickable(loginPage.loginButton));
2222
browser.waitForAngular();
23-
navbar.signOutDropdown.click();
23+
waitTillVisibleAndClick(navbar.signOutDropdown);
2424
browser.waitForAngular();
25-
navbar.signOutButton.click();
26-
browser.wait(ExpectedConditions.elementToBeClickable(loginPage.loginButton));
25+
waitTillVisibleAndClick(navbar.signOutButton);
26+
waitTillVisibleAndClick(loginPage.loginButton);
2727
}
2828

2929
export function waitFor(element) {

eform-client/e2e/Page objects/LoginPage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {$, by, element, ElementFinder} from 'protractor';
1+
import {$, browser, by, element, ElementFinder, ExpectedConditions} from 'protractor';
22
import {By} from '@angular/platform-browser';
33
import {default as data} from '../data';
44

@@ -16,7 +16,9 @@ export class LoginPage {
1616

1717
// login method, used on Login Page
1818
public login(): void {
19+
// browser.wait(ExpectedConditions.elementToBeClickable(this.usernameInput));
1920
this.usernameInput.clear();
21+
// browser.wait(ExpectedConditions.elementToBeClickable(this.passwordInput));
2022
this.passwordInput.clear();
2123
this.usernameInput.sendKeys(data.login);
2224
this.passwordInput.sendKeys(data.password);

eform-client/e2e/tests/main-page/main-page.create-eform.e2e-spec.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,14 @@ import {getMainPageRowObject} from '../../Page objects/Main Page/mainPage.row-ob
88
const mainPage = new MainPage();
99

1010
describe('Main Page - CREATE', function () {
11-
12-
beforeAll(done => {
13-
goToMainPage();
14-
done();
15-
});
16-
afterAll(done => {
17-
signOut();
18-
done();
19-
});
2011
describe('Positive: user', function () {
2112
beforeAll(done => {
22-
browser.get(data.startPageUrl);
23-
signOut();
24-
done();
25-
});
26-
beforeEach(done => {
2713
goToMainPage();
2814
browser.waitForAngular();
2915
done();
3016
});
31-
afterEach(done => {
17+
afterAll(done => {
3218
signOut();
33-
browser.waitForAngular();
3419
done();
3520
});
3621
it('should create eform without any tags', async function (done) {
@@ -195,10 +180,14 @@ describe('Main Page - CREATE', function () {
195180
});
196181
});
197182
describe('Negative: user ', function () {
198-
beforeEach(done => {
183+
beforeAll(done => {
199184
goToMainPage();
200185
done();
201186
});
187+
afterAll(done => {
188+
signOut();
189+
done();
190+
});
202191
it('should not create eform if xml is empty', async function (done) {
203192
browser.waitForAngular();
204193
const initRowNum = await mainPage.getRowNumber();
@@ -211,6 +200,5 @@ describe('Main Page - CREATE', function () {
211200
browser.waitForAngular();
212201
done();
213202
});
214-
215203
});
216204
});

eform-client/e2e/tests/main-page/main-page.delete-eform.e2e-spec.ts

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,13 @@ import {goToMainPage} from '../../Helper methods/go-to-pages';
77
const mainPage = new MainPage();
88

99

10-
describe('Main page - DELETE', function () {
11-
beforeAll(done => {
12-
goToMainPage();
13-
done();
14-
});
15-
afterAll(done => {
16-
signOut();
17-
done();
18-
});
19-
describe('user', function () {
20-
beforeEach(done => {
21-
waitTillVisibleAndClick(mainPage.newEformBtn);
22-
mainPage.createEFormModal.enterXML(data.MainPage.wordToReplaceBy);
23-
mainPage.createEFormModal.saveEFormBtn.click();
10+
describe('Main page - DELETE. User', function () {
11+
beforeAll(done => {
12+
goToMainPage();
13+
done();
14+
});
15+
afterAll(done => {
16+
signOut();
2417
done();
2518
});
2619
it('should delete existing eform', async function (done) {
@@ -30,19 +23,6 @@ describe('Main page - DELETE', function () {
3023
const allMainPageRowObjects = await MainPage.getAllMainPageRowObjects();
3124
const rowIsDeleted: boolean = allMainPageRowObjects.filter(item => item.id === firstRowObj.id).length === 0;
3225
expect(rowIsDeleted).toBeTruthy('Some error occured during delettion');
33-
// try {
34-
// const initObj = await getMainPageRowObject(1);
35-
// if (initObj.id !== firstRowObj.id) {
36-
// while ( await mainPage.getRowNumber() > 0 ) {
37-
// let o = await getMainPageRowObject(1);
38-
// o.deleteEFormBtn.click();
39-
// waitTillVisibleAndClick(mainPage.deleteEformModal.deleteEFormOkBtn);
40-
// waitFor(mainPage.newEformBtn);
41-
// }
42-
// }
43-
// } catch (e) {
44-
// }
4526
done();
4627
});
47-
});
4828
});

eform-client/e2e/tests/main-page/main-page.filter-eform.e2e-spec.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ const mainPage = new MainPage();
99

1010

1111
describe('Main page - FILTERS', function () {
12-
13-
beforeAll(done => {
14-
goToMainPage();
15-
done();
16-
});
17-
afterAll(done => {
18-
signOut();
19-
done();
20-
});
21-
2212
describe('By label user', function () {
13+
beforeAll(done => {
14+
goToMainPage();
15+
done();
16+
});
17+
afterAll(done => {
18+
signOut();
19+
done();
20+
});
2321
it('should be able to filter by 1 word in label input', async function (done) {
2422
const initRowNum = await mainPage.getRowNumber();
2523
const initRowObjArr: MainPageRowObject[] = [];
@@ -29,8 +27,8 @@ describe('Main page - FILTERS', function () {
2927
const initNameArr = initRowObjArr.map(obj => obj.nameEForm);
3028
// const randomName: string = initNameArr[Math.floor(Math.random() * initNameArr.length)];
3129
const randomName: string = initNameArr[0];
32-
mainPage.labelInput.sendKeys(randomName);
33-
mainPage.labelInput.sendKeys(protractor.Key.ENTER);
30+
await mainPage.labelInput.sendKeys(randomName);
31+
await mainPage.labelInput.sendKeys(protractor.Key.ENTER);
3432
const finalRowNum = await mainPage.getRowNumber();
3533
const finalRowObjArr: MainPageRowObject[] = [];
3634
for (let i = 1; i <= finalRowNum; i++) {
@@ -41,7 +39,7 @@ describe('Main page - FILTERS', function () {
4139
expect(everyNameContainsSelecedLabel).toBeTruthy();
4240
done();
4341
});
44-
xit('should be able to see all eforms by leaving label input empty', async function (done) {
42+
it('should be able to see all eforms by leaving label input empty', async function (done) {
4543
const initRowNum = await mainPage.getRowNumber();
4644
mainPage.labelInput.clear();
4745
mainPage.labelInput.sendKeys(protractor.Key.ENTER);
@@ -50,7 +48,15 @@ describe('Main page - FILTERS', function () {
5048
done();
5149
});
5250
});
53-
xdescribe('By tag user', function () {
51+
describe('By tag user', function () {
52+
beforeAll(done => {
53+
goToMainPage();
54+
done();
55+
});
56+
afterAll(done => {
57+
signOut();
58+
done();
59+
});
5460
it('should be able to filter using 1 tag', async function (done) {
5561
mainPage.tagSelector.click();
5662
const tagArray: ElementArrayFinder = mainPage.getTagsForFilter(); // ElementArrayFinder lacks functionality compared to ordinary

eform-client/e2e/tests/main-page/main-page.sort-eform.e2e-spec.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,7 @@ const mainPage: MainPage = new MainPage();
99

1010

1111
describe('Main Page - SORT', function () {
12-
// beforeAll(done => {
13-
// goToMainPage();
14-
// done();
15-
// }
16-
// );
17-
18-
// afterAll(done => {
19-
// signOut();
20-
// done();
21-
// });
2212
describe('user', function () {
23-
// beforeAll(done => {
24-
// browser.get(data.startPageUrl);
25-
// signOut();
26-
// done();
27-
// });
2813
beforeEach(done => {
2914
goToMainPage();
3015
browser.waitForAngular();
@@ -36,7 +21,6 @@ describe('Main Page - SORT', function () {
3621
done();
3722
});
3823
it('should be able to sort by ID', async function (done) {
39-
// mainPage.idSortBtn.click();
4024
const initIDArr: number[] = [];
4125
const rowNum = await mainPage.getRowNumber();
4226
for (let i = 1; i <= rowNum; i++) {

0 commit comments

Comments
 (0)