Last active
August 18, 2017 09:18
-
-
Save MargaritaLubimova/2a47ae2ec1101f08b55308efb462ac0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"NAMBER_APLICANTS_CONTAINER": 4, | |
"NAMBER_VACANCIES_CONTAINER": 4, | |
"base_url": "https://da.profgallery.tech/" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Header = function () { | |
var self = null; | |
this.getSelf = function () { | |
if (self == null) { | |
self = element(by.id('header_nav')); | |
} | |
return self; | |
}; | |
this.getSearchLink = function () { | |
var container = this.getSelf(); | |
var SearchLink = container.element(by.css('.search')); | |
expect(SearchLink).toBeDefined(); | |
if (SearchLink == undefined) { | |
return { | |
link: '', | |
text: '' | |
} | |
} | |
return { | |
link: SearchLink.getAttribute('href'), | |
text: SearchLink.getText() | |
} | |
}; | |
this.getContainer = function () { | |
var EC = protractor.ExpectedConditions; | |
var List = element(by.css('.c-applicants-row')); | |
var Title = List.element(by.className("c-applicants-header")); | |
// console.log(Title) | |
var Vacancies = List.all(by.repeater('vacancyItem in shortVacancyList')); | |
browser.wait(EC.visibilityOf(Vacancies), 20000); | |
if (Vacancies == undefined || Title == undefined) { | |
console.log('вакансии или соискатели не определены'); | |
return { | |
Title: '', | |
Vacancies: '' | |
} | |
} | |
return { | |
Title: Title.getText(), | |
Vacancies: Vacancies | |
} | |
}; | |
}; | |
exports.Header = Header; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('check header home page', function() { | |
/** for long page loading */ | |
var originalTimeout; | |
beforeEach(function() { | |
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; | |
jasmine.DEFAULT_TIMEOUT_INTERVAL = 200000; | |
}); | |
afterEach(function() { | |
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; | |
}); | |
/** Const for count vacansies and applicant */ | |
var constants = require('./Constants.json'); | |
/** Header home page */ | |
var Helpers = require('./Helpers'); | |
var header = new Helpers.Header(); | |
it('check header default', function() { | |
/** Open browser */ | |
browser.get(constants.base_url); | |
/** Check search vacancy */ | |
var SearchVacancy = header.getSearchLink(); | |
expect(SearchVacancy["text"]).toEqual('Поиск вакансий'); | |
expect(SearchVacancy["link"]).toEqual(constants.base_url + 'app/applicant/search/result?geo=13819&publishPeriod=1&commonArea=0&isSearchGoals=1#'); | |
/** Check profgallery for recruter */ | |
var ProfgalleryForRecruter = header.getSelf().element(by.partialLinkText('Profgallery для работодателей')); | |
ProfgalleryForRecruter.isDisplayed().then(function (isVisible) { | |
if (isVisible) { | |
expect(ProfgalleryForRecruter.getText()).toEqual('Profgallery для работодателей'); | |
console.log('Элемент Profgallery для работодателей - Виден') | |
} else { | |
console.log('Элемент Profgallery для работодателей - НЕ Виден') | |
} | |
}); | |
/** Check sign in and register */ | |
var SignInRegister = header.getSelf().element(by.className("dropDownP dropdown-toggle")); | |
SignInRegister.isDisplayed().then(function (isVisible) { | |
if (isVisible) { | |
expect(SignInRegister.getText()).toEqual('Вход/регистрация'); | |
console.log('Элемент Вход/регистрация - Виден') | |
} else { | |
console.log('Элемент Вход/регистрация - НЕ Виден') | |
} | |
}); | |
}); | |
it('check vacancy', function() { | |
var Vacancies = header.getContainer(); | |
/** Check vacancy title */ | |
expect(Vacancies["Title"]).toEqual('Вакансии'); | |
/** Check vacancy count **/ | |
expect(Vacancies["Vacancies"].count()).toBe(constants.NAMBER_VACANCIES_CONTAINER); | |
}); | |
it('check header after click on "profgallery for recruter"', function() { | |
/** click on "profgallery for recruter" */ | |
var ProfgalleryForRecruiter = header.getSelf().element(by.partialLinkText('Profgallery для работодателей')); | |
ProfgalleryForRecruiter.click(); | |
/** Check search applicant */ | |
var SearchApplicant = header.getSearchLink(); | |
expect(SearchApplicant["text"]).toEqual('Поиск соискателей'); | |
expect(SearchApplicant["link"]).toEqual(constants.base_url + 'app/recruiter/search/result?geo=13819&commonArea=0&isSearchGoals=1'); | |
var ProfgalleryForRecruter = header.getSelf().element(by.partialLinkText('Profgallery для соискателей')); | |
ProfgalleryForRecruter.isDisplayed().then(function (isVisible) { | |
if (isVisible) { | |
expect(ProfgalleryForRecruter.getText()).toEqual('Profgallery для соискателей'); | |
console.log('Элемент Profgallery для соискателей - Виден') | |
} else { | |
console.log('Элемент Profgallery для соискателей - НЕ Виден') | |
} | |
/** Check sign in and register */ | |
var SignInRegister = header.getSelf().element(by.className("dropDownP dropdown-toggle")); | |
expect(SignInRegister.getText()).toEqual('Вход/регистрация'); | |
}); | |
}); | |
it('check application', function() { | |
var Applicants = header.getContainer(); | |
/** Check application title */ | |
expect(Applicants["Title"]).toEqual('Соискатели'); | |
/** Check application count */ | |
expect(Applicants["Vacancies"].count()).toBe(constants.NAMBER_APLICANTS_CONTAINER); | |
}); | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('check header home page', function() { | |
/** Constants for applicant sing in*/ | |
var constants = require('./Constants.json'); | |
/** Header home page */ | |
var Header = require('./Header'); | |
var header = new Header.Header(); | |
it('check header default', function() { | |
/** Open browser */ | |
browser.get(constants.BASE_URL); | |
/** Click on sing in */ | |
var SignInRegister = header.getSelf().element(by.className("btn-group dropdown")); | |
SignInRegister.click(); | |
var RegNewApp = SignInRegister.element(by.css('[ng-click="loginModal()"]')); | |
RegNewApp.click(); | |
}); | |
it('Check sing in with mistake', function() { | |
var modalLoginDialog = element(by.css('.form-horizontal')) ; | |
var modalLog = modalLoginDialog.element(by.css('[ng-submit="login()"]')); | |
var mail = modalLog.element(by.css('[ng-model="username"]')); | |
mail.sendKeys(constants.REGISTERED_EMAIL); | |
var password = modalLog.element(by.css('[ng-model="password"]')); | |
password.sendKeys(constants.DIFFERENT_PASSWORD); | |
var loginButton = element(by.css('[pg-options="preloaderOptions"]')); | |
loginButton.click(); | |
var errorLogin = modalLoginDialog.element(by.css(['.error ng-binding'])); | |
expect(errorLogin.getText()).toEqual('Логин или пароль неверны.'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment