-
-
Save iketari/8779fb90097e7d43b54c384f6dd2dec7 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
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 NAMBER_APLICANTS_CONTAINER = 4; | |
var NAMBER_VACANCIES_CONTAINER = 4; | |
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 List = element(by.css('.c-applicants-row')); | |
expect(List).toBeDefined(); | |
var Title = List.element(by.className("c-applicants-header")); | |
// console.log(Title) | |
var Vacancies = List.all(by.repeater('vacancyItem in shortVacancyList')); | |
if (Vacancies == undefined || Title == undefined) { | |
console.log('вакансии или соискатели не определены') | |
return { | |
Title: '', | |
Vacancies: '' | |
} | |
} | |
return { | |
Title: Title.getText(), | |
Vacancies: Vacancies | |
} | |
}; | |
}; | |
/** Header home page */ | |
var header = new Header(); | |
it('check header default', function() { | |
/** Open browser */ | |
browser.get('https://da.profgallery.tech/'); | |
/** Check search vacancy */ | |
var SearchVacancy = header.getSearchLink(); | |
expect(SearchVacancy["text"]).toEqual('Поиск вакансий'); | |
expect(SearchVacancy["link"]).toEqual('https://da.profgallery.tech/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(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('https://da.profgallery.tech/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(NAMBER_APLICANTS_CONTAINER); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment