From 61dd61b2ffb4815095754fb04b76247bc56e082b Mon Sep 17 00:00:00 2001 From: avozicov Date: Tue, 18 Jul 2017 17:44:07 +0300 Subject: [PATCH 1/3] Global e2e tests refactoring and improvement --- test/e2e/pages/api-page.po.js | 10 ++ .../{contact.po.js => contact-page.po.js} | 0 test/e2e/pages/demo-modal.po.js | 2 +- test/e2e/pages/footer.po.js | 1 + .../pages/{top-menu.po.js => header.po.js} | 4 +- test/e2e/pages/home-page.po.js | 11 ++ test/e2e/pages/quick-links.po.js | 2 +- test/e2e/pages/social-links.po.js | 14 ++ .../test_runs/content/pagesContent.e2e_run.md | 3 - .../test_runs/footer/footerLinks.e2e_run.md | 3 - .../test_runs/footer/quickLinks.e2e_run.md | 3 - test/e2e/test_runs/form/contactUs.e2e_run.md | 3 - .../e2e/test_runs/form/requestDemo.e2e_run.md | 3 - .../test_runs/header/topMenuLinks.e2e_run.md | 3 - test/e2e/tests/assertApiPage.e2e.js | 35 +++++ test/e2e/tests/assertContent.e2e.js | 136 ------------------ test/e2e/tests/assertFooter.e2e.js | 28 ++++ test/e2e/tests/assertHeader.e2e.js | 61 ++++++++ test/e2e/tests/assertHomePage.e2e.js | 29 ++++ ...ckLinks.e2e.js => assertQuickLinks.e2e.js} | 54 +++---- test/e2e/tests/assertSocialLinks.e2e.js | 63 ++++++++ test/e2e/tests/checkFooterLinks.e2e.js | 21 --- test/e2e/tests/checkTopMenuLinks.js | 55 ------- test/e2e/tests/submitContactUs.e2e.js | 8 +- test/e2e/tests/submitDemoRequest.e2e.js | 26 ++-- 25 files changed, 296 insertions(+), 282 deletions(-) create mode 100644 test/e2e/pages/api-page.po.js rename test/e2e/pages/{contact.po.js => contact-page.po.js} (100%) rename test/e2e/pages/{top-menu.po.js => header.po.js} (80%) create mode 100644 test/e2e/pages/home-page.po.js create mode 100644 test/e2e/pages/social-links.po.js delete mode 100644 test/e2e/test_runs/content/pagesContent.e2e_run.md delete mode 100644 test/e2e/test_runs/footer/footerLinks.e2e_run.md delete mode 100644 test/e2e/test_runs/footer/quickLinks.e2e_run.md delete mode 100644 test/e2e/test_runs/form/contactUs.e2e_run.md delete mode 100644 test/e2e/test_runs/form/requestDemo.e2e_run.md delete mode 100644 test/e2e/test_runs/header/topMenuLinks.e2e_run.md create mode 100644 test/e2e/tests/assertApiPage.e2e.js delete mode 100644 test/e2e/tests/assertContent.e2e.js create mode 100644 test/e2e/tests/assertFooter.e2e.js create mode 100644 test/e2e/tests/assertHeader.e2e.js create mode 100644 test/e2e/tests/assertHomePage.e2e.js rename test/e2e/tests/{checkQuickLinks.e2e.js => assertQuickLinks.e2e.js} (74%) create mode 100644 test/e2e/tests/assertSocialLinks.e2e.js delete mode 100644 test/e2e/tests/checkFooterLinks.e2e.js delete mode 100644 test/e2e/tests/checkTopMenuLinks.js diff --git a/test/e2e/pages/api-page.po.js b/test/e2e/pages/api-page.po.js new file mode 100644 index 0000000..a6e9429 --- /dev/null +++ b/test/e2e/pages/api-page.po.js @@ -0,0 +1,10 @@ +import { Selector } from 'testcafe'; + +export default class apiPage { + constructor() { + this.apiPageCaseStudies = Selector('.flex-item-4:nth-child(1)'); + this.pageElementApiDocs = Selector('.flex-item-4:nth-child(2)'); + this.pageElementUserGuide = Selector('.flex-item-4:nth-child(3)'); + } +}; + diff --git a/test/e2e/pages/contact.po.js b/test/e2e/pages/contact-page.po.js similarity index 100% rename from test/e2e/pages/contact.po.js rename to test/e2e/pages/contact-page.po.js diff --git a/test/e2e/pages/demo-modal.po.js b/test/e2e/pages/demo-modal.po.js index a2dafe7..b60d392 100644 --- a/test/e2e/pages/demo-modal.po.js +++ b/test/e2e/pages/demo-modal.po.js @@ -1,6 +1,6 @@ import { Selector } from 'testcafe'; -export default class requestDemoPage { +export default class requestDemoForm { constructor() { this.demoFormEmailField = Selector('#mce-EMAIL'); this.demoFormNamelField = Selector('#mce-FNAME'); diff --git a/test/e2e/pages/footer.po.js b/test/e2e/pages/footer.po.js index 2e14ccb..859ddfb 100644 --- a/test/e2e/pages/footer.po.js +++ b/test/e2e/pages/footer.po.js @@ -2,6 +2,7 @@ import { Selector } from 'testcafe'; export default class footerLinks { constructor() { + this.company = Selector('a').withText('Mitoc Group'); this.termsOfUse = Selector('a').withText('Terms of Use'); this.privacyPolicy = Selector('a').withText('Privacy Policy'); } diff --git a/test/e2e/pages/top-menu.po.js b/test/e2e/pages/header.po.js similarity index 80% rename from test/e2e/pages/top-menu.po.js rename to test/e2e/pages/header.po.js index b4e3d6b..94ae7fb 100644 --- a/test/e2e/pages/top-menu.po.js +++ b/test/e2e/pages/header.po.js @@ -1,7 +1,8 @@ import { Selector } from 'testcafe'; -export default class topMenu { +export default class header { constructor() { + this.logoImage = Selector('.logo-cont'); this.challengesTopMenuLink = Selector('.clearfix > li:nth-child(1) > a'); this.solutionsTopMenuLink = Selector('.clearfix > li:nth-child(2) > a'); this.apiTopMenuLink = Selector('.clearfix > li:nth-child(3) > a'); @@ -9,5 +10,6 @@ export default class topMenu { this.contactTopMenuLink = Selector('.clearfix > li:nth-child(5) > a'); this.blogTopMenuLink = Selector('.clearfix > li:nth-child(6) > a'); this.requestDemoTopMenuItem = Selector('.custom-menu-link > a'); + this.topMenuRequestDemoModal = Selector('.modal__trigger'); } }; \ No newline at end of file diff --git a/test/e2e/pages/home-page.po.js b/test/e2e/pages/home-page.po.js new file mode 100644 index 0000000..052effe --- /dev/null +++ b/test/e2e/pages/home-page.po.js @@ -0,0 +1,11 @@ +import { Selector } from 'testcafe'; + +export default class homePage { + constructor() { + this.homeRequestDemoModal = Selector('.modal__trigger'); + this.homeRequestDemoModalClose = Selector('.close-btn'); + this.homeWatchNowModal = Selector('.video-show'); + this.homeWatchNowModalClose = Selector('.video-close'); + } +}; + diff --git a/test/e2e/pages/quick-links.po.js b/test/e2e/pages/quick-links.po.js index 69af1dc..3a06f45 100644 --- a/test/e2e/pages/quick-links.po.js +++ b/test/e2e/pages/quick-links.po.js @@ -1,6 +1,6 @@ import { Selector } from 'testcafe'; -export default class quickLink { +export default class quickLinks { constructor() { this.challengesQuickLink = Selector('.quick-links .clearfix > li:nth-child(1) > a'); this.solutionsQuickLink = Selector('.quick-links .clearfix > li:nth-child(3) > a'); diff --git a/test/e2e/pages/social-links.po.js b/test/e2e/pages/social-links.po.js new file mode 100644 index 0000000..ba8da82 --- /dev/null +++ b/test/e2e/pages/social-links.po.js @@ -0,0 +1,14 @@ +import { Selector } from 'testcafe'; + +export default class socialLinks { + constructor() { + this.wordpressLink = Selector('.wordpress'); + this.drupalLink = Selector('.drupal'); + this.githubLink = Selector('.github'); + this.linkedinLink = Selector('.linkedin'); + this.twitterLink = Selector('.twitter'); + this.facebookLink = Selector('.facebook'); + this.youtubeLink = Selector('.youtube'); + } +}; + diff --git a/test/e2e/test_runs/content/pagesContent.e2e_run.md b/test/e2e/test_runs/content/pagesContent.e2e_run.md deleted file mode 100644 index 2bbdbfc..0000000 --- a/test/e2e/test_runs/content/pagesContent.e2e_run.md +++ /dev/null @@ -1,3 +0,0 @@ -|Component|Script Name|Test Description|Check Item|Status|Created by| -|------------|---------------------------------------|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|------------| -|Content|pagesContent.e2e.js|Top-menu links verification|
Check "Challenges" top-menu link is clickable and valid information is displayed on the page

Check "Solutions" top-menu link is clickable and valid information is displayed on the page

Check "API" top-menu link is clickable and valid information is displayed on the page

Check "Team" top-menu link is clickable and valid information is displayed on the page

Check "Contact" top-menu link is clickable and valid information is displayed on the page

Check "Blog" top-menu link is clickable and valid information is displayed on the page
|Passed|Alexandr Vozicov| diff --git a/test/e2e/test_runs/footer/footerLinks.e2e_run.md b/test/e2e/test_runs/footer/footerLinks.e2e_run.md deleted file mode 100644 index 8c40d77..0000000 --- a/test/e2e/test_runs/footer/footerLinks.e2e_run.md +++ /dev/null @@ -1,3 +0,0 @@ -|Component|Script Name|Test Description|Check Item|Status|Created by| -|------------|---------------------------------------|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|------------| -|Footer|footerLinks.e2e.js|Footer links verification|
Check "Terms of Use" footer link is displayed on the page footer

Check "Privacy Policy" footer link is displayed on the page footer
|Passed|Alexandr Vozicov| diff --git a/test/e2e/test_runs/footer/quickLinks.e2e_run.md b/test/e2e/test_runs/footer/quickLinks.e2e_run.md deleted file mode 100644 index ccd8c2f..0000000 --- a/test/e2e/test_runs/footer/quickLinks.e2e_run.md +++ /dev/null @@ -1,3 +0,0 @@ -|Component|Script Name|Test Description|Check Item|Status|Created by| -|------------|---------------------------------------|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|------------| -|Footer|quickLinks.e2e.js|Footer quick-links and content verification|
Check "Challenges" quick-link is clickable and valid information is displayed on the page

Check "Solutions" quick-link is clickable and valid information is displayed on the page

Check "API" quick-link is clickable and valid information is displayed on the page

Check "Team" quick-link link is clickable and valid information is displayed on the page

Check "Contact" quick-link link is clickable and valid information is displayed on the page

Check "Blog" quick-link is clickable and valid information is displayed on the page
|Passed|Alexandr Vozicov| diff --git a/test/e2e/test_runs/form/contactUs.e2e_run.md b/test/e2e/test_runs/form/contactUs.e2e_run.md deleted file mode 100644 index 1055153..0000000 --- a/test/e2e/test_runs/form/contactUs.e2e_run.md +++ /dev/null @@ -1,3 +0,0 @@ -|Component|Script Name|Test Description|Check Item|Status|Created by| -|------------|---------------------------------------|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|------------| -|Form|contactUs.e2e.js|"Contact" form request submit verification|
Check "Contact" form request can be submitted by user with valid data
|Passed|Alexandr Vozicov| diff --git a/test/e2e/test_runs/form/requestDemo.e2e_run.md b/test/e2e/test_runs/form/requestDemo.e2e_run.md deleted file mode 100644 index a4f7dba..0000000 --- a/test/e2e/test_runs/form/requestDemo.e2e_run.md +++ /dev/null @@ -1,3 +0,0 @@ -|Component|Script Name|Test Description|Check Item|Status|Created by| -|------------|---------------------------------------|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|------------| -|Form|requestDemo.e2e.js|"Request a Demo" form submit verification|
Check if user can submit "Request a demo" form with valid email address
|Passed|Alexandr Vozicov| diff --git a/test/e2e/test_runs/header/topMenuLinks.e2e_run.md b/test/e2e/test_runs/header/topMenuLinks.e2e_run.md deleted file mode 100644 index cb8dd38..0000000 --- a/test/e2e/test_runs/header/topMenuLinks.e2e_run.md +++ /dev/null @@ -1,3 +0,0 @@ -|Component|Script Name|Test Description|Check Item|Status|Created by| -|------------|---------------------------------------|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|------------| -|Header|topMenuLinks.e2e.js|Top-menu links verification|
Check "Challenges" top-menu link is displayed on the page header

Check "Solutions" top-menu link is displayed on the page header

Check "API" top-menu link is displayed on the page header

Check "Team" top-menu link is displayed on the page header

Check "Contact" top-menu link is displayed on the page header

Check "Blog" top-menu link is displayed on the page header
|Passed|Alexandr Vozicov| diff --git a/test/e2e/tests/assertApiPage.e2e.js b/test/e2e/tests/assertApiPage.e2e.js new file mode 100644 index 0000000..62fc3e7 --- /dev/null +++ b/test/e2e/tests/assertApiPage.e2e.js @@ -0,0 +1,35 @@ +import { Selector } from 'testcafe'; +import ApiPage from '../pages/api-page.po'; + +const apiPage = new ApiPage(); + +fixture`Check valid content is displayed on "API" page` + .page`https://www-stage.adtechmedia.io/api/`; + +test('Assert "Case Studies" content is displayed on "API" page', async t => { + await t + .resizeWindow(1920, 1080) + .expect(apiPage.apiPageCaseStudies.with({ + selectorTimeout: 5000, + visibilityCheck: true, + }).visible).ok() + .expect(apiPage.apiPageCaseStudies.innerText).eql('\nWant to learn about what you can achieve by integrating with our APIs? The possibilities are endless, but you can find just a few examples\n MORE\n') +}); + +test('Assert "API-Docs" content is displayed on "API" page', async t => { + await t + .expect(apiPage.pageElementApiDocs.with({ + selectorTimeout: 5000, + visibilityCheck: true, + }).visible).ok() + .expect(apiPage.pageElementApiDocs.innerText).eql('\nSee what APIs we have on offer, including extensive documentation. Sign in to manage your subscriptions, see your current usage, get your API Key, and test against our live API.\n MORE\n'); +}); + +test('Assert "User-Guide" content is displayed on "API" page', async t => { + await t + .expect(apiPage.pageElementUserGuide.with({ + selectorTimeout: 5000, + visibilityCheck: true, + }).visible).ok() + .expect(apiPage.pageElementUserGuide.innerText).eql('\nReady to get started? This is the place that answers all your questions. We\'ll have you up and running in no time. Let\'s get started!\n MORE\n'); +}); \ No newline at end of file diff --git a/test/e2e/tests/assertContent.e2e.js b/test/e2e/tests/assertContent.e2e.js deleted file mode 100644 index 9da3c47..0000000 --- a/test/e2e/tests/assertContent.e2e.js +++ /dev/null @@ -1,136 +0,0 @@ -import { Selector } from 'testcafe'; - -fixture`Top-menu links and content verification` - .page`https://www-test.adtechmedia.io/`; - -test('Check "Challenges" top-menu link is clickable and valid information is displayed on the page', async t => { - const challengesTopMenuLink = await Selector('.clearfix > li:nth-child(1) > a'); - - await t - .resizeWindow(1920, 1080) - .expect(challengesTopMenuLink.exists).ok() - .hover(challengesTopMenuLink) - .click(challengesTopMenuLink) - - const pageElementChallenges = await Selector('.main-slide > section > h1'); - - await t - .expect(pageElementChallenges.with({ - selectorTimeout: 5000, - visibilityCheck: true, - }).visible).ok() - .expect(pageElementChallenges.innerText).eql('Challenges'); -}); - -test('Check "Solutions" top-menu link is clickable and valid information is displayed on the page', async t => { - const solutionsTopMenuLink = await Selector('.clearfix > li:nth-child(2) > a'); - - await t - .resizeWindow(1920, 1080) - .expect(solutionsTopMenuLink.exists).ok() - .hover(solutionsTopMenuLink) - .click(solutionsTopMenuLink) - - const pageElementSolutions = await Selector('.custom-headline'); - - await t - .expect(pageElementSolutions.with({ - selectorTimeout: 5000, - visibilityCheck: true, - }).visible).ok() - .expect(pageElementSolutions.innerText).eql('SOLUTIONS'); -}); - -test('Check "API" top-menu link is clickable and valid information is displayed on the page', async t => { - const apiTopMenuLink = await Selector('.clearfix > li:nth-child(3) > a'); - - await t - .resizeWindow(1920, 1080) - .expect(apiTopMenuLink.exists).ok() - .hover(apiTopMenuLink) - .click(apiTopMenuLink) - - const pageElementApiFirst = await Selector('.flex-item-4:nth-child(1)'); - - await t - .expect(pageElementApiFirst.with({ - selectorTimeout: 5000, - visibilityCheck: true, - }).visible).ok() - .expect(pageElementApiFirst.innerText).eql('\nWant to learn about what you can achieve by integrating with our APIs? The possibilities are endless, but you can find just a few examples\n MORE\n') - - const pageElementApiSecond = await Selector('.flex-item-4:nth-child(2)'); - - await t - .expect(pageElementApiSecond.with({ - selectorTimeout: 5000, - visibilityCheck: true, - }).visible).ok() - .expect(pageElementApiSecond.innerText).eql('\nSee what APIs we have on offer, including extensive documentation. Sign in to manage your subscriptions, see your current usage, get your API Key, and test against our live API.\n MORE\n'); - - const pageElementApiThird = await Selector('.flex-item-4:nth-child(3)'); - - await t - .expect(pageElementApiThird.with({ - selectorTimeout: 5000, - visibilityCheck: true, - }).visible).ok() - .expect(pageElementApiThird.innerText).eql('\nReady to get started? This is the place that answers all your questions. We\'ll have you up and running in no time. Let\'s get started!\n MORE\n'); -}); - -test('Check "Team" top-menu link is clickable and valid information is displayed on the page', async t => { - const teamTopMenuLink = await Selector('.clearfix > li:nth-child(4) > a'); - - await t - .resizeWindow(1920, 1080) - .expect(teamTopMenuLink.exists).ok() - .hover(teamTopMenuLink) - .click(teamTopMenuLink) - - const pageElementTeam = await Selector('.custom-headline-block'); - - await t - .expect(pageElementTeam.with({ - selectorTimeout: 5000, - visibilityCheck: true, - }).visible).ok() - .expect(pageElementTeam.innerText).eql('TEAM\nWe are a team of highly skilled and very passioned product engineers who dedicated years of building high quality technical solutions that solve large scale business problems.\n'); -}); - -test('Check "Contact" top-menu link is clickable and valid information is displayed on the page', async t => { - const contactTopMenuLink = await Selector('.clearfix > li:nth-child(5) > a'); - - await t - .resizeWindow(1920, 1080) - .expect(contactTopMenuLink.exists).ok() - .hover(contactTopMenuLink) - .click(contactTopMenuLink) - - const pageElementContact = await Selector('#contact:nth-child(1) > form > h1'); - - await t - .expect(pageElementContact.with({ - selectorTimeout: 5000, - visibilityCheck: true, - }).visible).ok() - .expect(pageElementContact.innerText).eql('Contact'); -}); - -test('Check "Blog" top-menu link is clickable and valid information is displayed on the page', async t => { - const blogTopMenuLink = await Selector('.clearfix > li:nth-child(6) > a'); - - await t - .resizeWindow(1920, 1080) - .expect(blogTopMenuLink.exists).ok() - .hover(blogTopMenuLink) - .click(blogTopMenuLink) - - const pageElementBlog = await Selector('.collectionHeader-blockNav > div > nav > div > li:nth-child(1) > a'); - - await t - .expect(pageElementBlog.with({ - selectorTimeout: 5000, - visibilityCheck: true, - }).visible).ok() - .expect(pageElementBlog.innerText).eql('AD BLOCKING'); -}); diff --git a/test/e2e/tests/assertFooter.e2e.js b/test/e2e/tests/assertFooter.e2e.js new file mode 100644 index 0000000..bce4da7 --- /dev/null +++ b/test/e2e/tests/assertFooter.e2e.js @@ -0,0 +1,28 @@ +import { Selector } from 'testcafe'; +import FooterLinks from '../pages/footer.po'; + +const footerLinks = new FooterLinks(); + +fixture`Check valid content and links are displayed on website footer` + .page`https://www-stage.adtechmedia.io/`; + +test('Check "Mitoc Group" link is displayed on the page footer', async t => { + await t + .resizeWindow(1920, 1080) + .expect(footerLinks.company.exists).ok() + .expect(footerLinks.company.innerText).eql('Mitoc Group'); +}); + +test('Check "Terms of Use" link is displayed on the page footer', async t => { + await t + .resizeWindow(1920, 1080) + .expect(footerLinks.termsOfUse.exists).ok() + .expect(footerLinks.termsOfUse.innerText).eql('Terms of Use'); +}); + +test('Check "Privacy Policy" link is displayed on the page footer', async t => { + await t + .resizeWindow(1920, 1080) + .expect(footerLinks.privacyPolicy.exists).ok() + .expect(footerLinks.privacyPolicy.innerText).eql('Privacy Policy'); +}); diff --git a/test/e2e/tests/assertHeader.e2e.js b/test/e2e/tests/assertHeader.e2e.js new file mode 100644 index 0000000..358bdd8 --- /dev/null +++ b/test/e2e/tests/assertHeader.e2e.js @@ -0,0 +1,61 @@ +import { Selector } from 'testcafe'; +import Header from '../pages/header.po'; + +const header = new Header(); + +fixture`Check valid content is displayed on website header` + .page`https://www-stage.adtechmedia.io/`; + +test('Check "CHALLENGES" top-menu link is displayed on website header', async t => { + await t + .resizeWindow(1920, 1080) + .expect(header.challengesTopMenuLink.exists).ok() + .expect(header.challengesTopMenuLink.innerText).eql('CHALLENGES'); +}); + +test('Check "Logo" image is displayed on website header', async t => { + await t + .resizeWindow(1920, 1080) + .expect(header.logoImage.exists).ok(); +}); + +test('Check "SOLUTIONS" top-menu link is displayed on website header', async t => { + await t + .resizeWindow(1920, 1080) + .expect(header.solutionsTopMenuLink.exists).ok() + .expect(header.solutionsTopMenuLink.innerText).eql('SOLUTIONS'); +}); + +test('Check "API" top-menu link is displayed on website header', async t => { + await t + .resizeWindow(1920, 1080) + .expect(header.apiTopMenuLink.exists).ok() + .expect(header.apiTopMenuLink.innerText).eql('API'); +}); + +test('Check "TEAM" top-menu link is displayed on website header', async t => { + await t + .resizeWindow(1920, 1080) + .expect(header.teamTopMenuLink.exists).ok() + .expect(header.teamTopMenuLink.innerText).eql('TEAM'); +}); + +test('Check "CONTACT" top-menu link is displayed on website header', async t => { + await t + .resizeWindow(1920, 1080) + .expect(header.contactTopMenuLink.exists).ok() + .expect(header.contactTopMenuLink.innerText).eql('CONTACT'); +}); + +test('Check "BLOG" top-menu link is displayed on website header', async t => { + await t + .resizeWindow(1920, 1080) + .expect(header.blogTopMenuLink.exists).ok() + .expect(header.blogTopMenuLink.innerText).eql('BLOG'); +}); + +test('Check "Request a Demo" modal is displayed on website header', async t => { + await t + .resizeWindow(1920, 1080) + .expect(header.topMenuRequestDemoModal.exists).ok(); +}); diff --git a/test/e2e/tests/assertHomePage.e2e.js b/test/e2e/tests/assertHomePage.e2e.js new file mode 100644 index 0000000..ef0dd57 --- /dev/null +++ b/test/e2e/tests/assertHomePage.e2e.js @@ -0,0 +1,29 @@ +import { Selector } from 'testcafe'; +import HomePage from '../pages/home-page.po'; + +const homePage = new HomePage(); + +fixture`Check valid content is displayed on "Home" page` + .page`https://www-stage.adtechmedia.io/`; + +test('Check "Request a Demo" modal is displayed on "Home" page and can be opened by the click', async t => { + await t + .resizeWindow(1920, 1080) + .expect(homePage.homeRequestDemoModal.exists).ok(); + + await t + .hover(homePage.homeRequestDemoModal) + .click(homePage.homeRequestDemoModal, { speed: 0.5 }) + .click(homePage.homeRequestDemoModalClose, { speed: 0.5 }); +}); + +test('Check "Watch now" modal is displayed on "Home" page and can be opened by the click', async t => { + await t + .resizeWindow(1920, 1080) + .expect(homePage.homeWatchNowModal.exists).ok(); + + await t + .hover(homePage.homeWatchNowModal) + .click(homePage.homeWatchNowModal, { speed: 0.5 }) + .click(homePage.homeWatchNowModalClose, { speed: 0.5 }); +}); \ No newline at end of file diff --git a/test/e2e/tests/checkQuickLinks.e2e.js b/test/e2e/tests/assertQuickLinks.e2e.js similarity index 74% rename from test/e2e/tests/checkQuickLinks.e2e.js rename to test/e2e/tests/assertQuickLinks.e2e.js index b06bdde..3cc67a2 100644 --- a/test/e2e/tests/checkQuickLinks.e2e.js +++ b/test/e2e/tests/assertQuickLinks.e2e.js @@ -1,17 +1,17 @@ import { Selector } from 'testcafe'; -import QuickLink from '../pages/quick-link.po'; +import QuickLinks from '../pages/quick-links.po'; -const quickLink = new QuickLink(); +const quickLinks = new QuickLinks(); -fixture`Footer quick-links and content verification` - .page`https://www-test.adtechmedia.io/`; +fixture`Check valid links are displayed on "Quick Links" area` + .page`https://www-stage.adtechmedia.io/`; test('Check "Challenges" quick-link is clickable and valid information is displayed on the page', async t => { await t .resizeWindow(1920, 1080) - .expect(quickLink.challengesQuickLink.exists).ok() - .hover(quickLink.challengesQuickLink) - .click(quickLink.challengesQuickLink) + .expect(quickLinks.challengesQuickLink.exists).ok() + .hover(quickLinks.challengesQuickLink) + .click(quickLinks.challengesQuickLink) const pageElementChallenges = await Selector('.main-slide > section > h1'); @@ -24,13 +24,11 @@ test('Check "Challenges" quick-link is clickable and valid information is displa }); test('Check "Solutions" quick-link is clickable and valid information is displayed on the page', async t => { - const solutionsQuickLink = await Selector('.quick-links .clearfix > li:nth-child(3) > a'); - await t .resizeWindow(1920, 1080) - .expect(solutionsQuickLink.exists).ok() - .hover(solutionsQuickLink) - .click(solutionsQuickLink) + .expect(quickLinks.solutionsQuickLink.exists).ok() + .hover(quickLinks.solutionsQuickLink) + .click(quickLinks.solutionsQuickLink) const pageElementSolutions = await Selector('.custom-headline'); @@ -43,13 +41,11 @@ test('Check "Solutions" quick-link is clickable and valid information is display }); test('Check "API" quick-link is clickable and valid information is displayed on the page', async t => { - const apiQuickLink = await Selector('.quick-links .clearfix > li:nth-child(5) > a'); - await t .resizeWindow(1920, 1080) - .expect(apiQuickLink.exists).ok() - .hover(apiQuickLink) - .click(apiQuickLink) + .expect(quickLinks.apiQuickLink.exists).ok() + .hover(quickLinks.apiQuickLink) + .click(quickLinks.apiQuickLink) const pageElementApiFirst = await Selector('.flex-item-4:nth-child(1)'); @@ -80,13 +76,11 @@ test('Check "API" quick-link is clickable and valid information is displayed on }); test('Check "Team" quick-link link is clickable and valid information is displayed on the page', async t => { - const teamQuickLink = await Selector('.quick-links .clearfix > li:nth-child(2) > a'); - await t .resizeWindow(1920, 1080) - .expect(teamQuickLink.exists).ok() - .hover(teamQuickLink) - .click(teamQuickLink) + .expect(quickLinks.teamQuickLink.exists).ok() + .hover(quickLinks.teamQuickLink) + .click(quickLinks.teamQuickLink) const pageElementTeam = await Selector('.custom-headline-block'); @@ -99,13 +93,11 @@ test('Check "Team" quick-link link is clickable and valid information is display }); test('Check "Contact" quick-link is clickable and valid information is displayed on the page', async t => { - const contactQuickLink = await Selector('.quick-links .clearfix > li:nth-child(4) > a'); - await t .resizeWindow(1920, 1080) - .expect(contactQuickLink.exists).ok() - .hover(contactQuickLink) - .click(contactQuickLink) + .expect(quickLinks.contactQuickLink.exists).ok() + .hover(quickLinks.contactQuickLink) + .click(quickLinks.contactQuickLink) const pageElementContact = await Selector('#contact:nth-child(1) > form > h1'); @@ -118,13 +110,11 @@ test('Check "Contact" quick-link is clickable and valid information is displayed }); test('Check "Blog" quick-link is clickable and valid information is displayed on the page', async t => { - const blogQuickLink = await Selector('.quick-links .clearfix > li:nth-child(6) > a'); - await t .resizeWindow(1920, 1080) - .expect(blogQuickLink.exists).ok() - .hover(blogQuickLink) - .click(blogQuickLink) + .expect(quickLinks.blogQuickLink.exists).ok() + .hover(quickLinks.blogQuickLink) + .click(quickLinks.blogQuickLink) const pageElementBlog = await Selector('.collectionHeader-blockNav > div > nav > div > li:nth-child(1) > a'); diff --git a/test/e2e/tests/assertSocialLinks.e2e.js b/test/e2e/tests/assertSocialLinks.e2e.js new file mode 100644 index 0000000..c2aa8cc --- /dev/null +++ b/test/e2e/tests/assertSocialLinks.e2e.js @@ -0,0 +1,63 @@ +import { Selector } from 'testcafe'; +import SocialLinks from '../pages/social-links.po'; + +const socialLinks = new SocialLinks(); + +fixture`Check valid links are displayed on "Social Links" area` + .page`https://www-stage.adtechmedia.io/`; + +test('Check "WordPress" clickable link is displayed on the page', async t => { + await t + .resizeWindow(1920, 1080) + .expect(socialLinks.wordpressLink.exists).ok() + .hover(socialLinks.wordpressLink) + .click(socialLinks.wordpressLink); +}); + +test('Check "Drupal" clickable link is displayed on the page', async t => { + await t + .resizeWindow(1920, 1080) + .expect(socialLinks.drupalLink.exists).ok() + .hover(socialLinks.drupalLink) + .click(socialLinks.drupalLink); +}); + +test('Check "Github" clickable link is displayed on the page', async t => { + await t + .resizeWindow(1920, 1080) + .expect(socialLinks.githubLink.exists).ok() + .hover(socialLinks.githubLink) + .click(socialLinks.githubLink); +}); + +test('Check "Linkedin" clickable link is displayed on the page', async t => { + await t + .resizeWindow(1920, 1080) + .expect(socialLinks.linkedinLink.exists).ok() + .hover(socialLinks.linkedinLink) + .click(socialLinks.linkedinLink); +}); + +test('Check "Twitter" clickable link is displayed on the page', async t => { + await t + .resizeWindow(1920, 1080) + .expect(socialLinks.twitterLink.exists).ok() + .hover(socialLinks.twitterLink) + .click(socialLinks.twitterLink); +}); + +test('Check "Facebook" clickable link is displayed on the page', async t => { + await t + .resizeWindow(1920, 1080) + .expect(socialLinks.facebookLink.exists).ok() + .hover(socialLinks.facebookLink) + .click(socialLinks.facebookLink); +}); + +test('Check "Facebook" clickable link is displayed on the page', async t => { + await t + .resizeWindow(1920, 1080) + .expect(socialLinks.youtubeLink.exists).ok() + .hover(socialLinks.youtubeLink) + .click(socialLinks.youtubeLink); +}); \ No newline at end of file diff --git a/test/e2e/tests/checkFooterLinks.e2e.js b/test/e2e/tests/checkFooterLinks.e2e.js deleted file mode 100644 index 73af283..0000000 --- a/test/e2e/tests/checkFooterLinks.e2e.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Selector } from 'testcafe'; -import FooterLinks from '../pages/footer.po'; - -const footerLinks = new FooterLinks(); - -fixture`Footer links verification` - .page`https://www-test.adtechmedia.io/`; - -test('Check "Terms of Use" footer link is displayed on the page footer', async t => { - await t - .resizeWindow(1920, 1080) - .expect(footerLinks.termsOfUse.exists).ok() - .expect(footerLinks.termsOfUse.innerText).eql('Terms of Use'); -}); - -test('Check "Privacy Policy" footer link is displayed on the page footer', async t => { - await t - .resizeWindow(1920, 1080) - .expect(footerLinks.privacyPolicy.exists).ok() - .expect(footerLinks.privacyPolicy.innerText).eql('Privacy Policy'); -}); diff --git a/test/e2e/tests/checkTopMenuLinks.js b/test/e2e/tests/checkTopMenuLinks.js deleted file mode 100644 index dea21ce..0000000 --- a/test/e2e/tests/checkTopMenuLinks.js +++ /dev/null @@ -1,55 +0,0 @@ -import { Selector } from 'testcafe'; -import TopMenu from '../pages/top-menu.po'; - -const topMemu = new TopMenu(); - -fixture`Top-menu links verification` - .page`https://www-test.adtechmedia.io/`; - -test('Check "CHALLENGES" top-menu link is displayed on the page header', async t => { - - await t - .resizeWindow(1920, 1080) - .expect(topMemu.challengesTopMenuLink.exists).ok() - .expect(topMemu.challengesTopMenuLink.innerText).eql('CHALLENGES'); -}); - -test('Check "SOLUTIONS" top-menu link is displayed on the page header', async t => { - - await t - .resizeWindow(1920, 1080) - .expect(topMemu.solutionsTopMenuLink.exists).ok() - .expect(topMemu.solutionsTopMenuLink.innerText).eql('SOLUTIONS'); -}); - -test('Check "API" top-menu link is displayed on the page header', async t => { - - await t - .resizeWindow(1920, 1080) - .expect(topMemu.apiTopMenuLink.exists).ok() - .expect(topMemu.apiTopMenuLink.innerText).eql('API'); -}); - -test('Check "TEAM" top-menu link is displayed on the page header', async t => { - - await t - .resizeWindow(1920, 1080) - .expect(topMemu.teamTopMenuLink.exists).ok() - .expect(topMemu.teamTopMenuLink.innerText).eql('TEAM'); -}); - -test('Check "CONTACT" top-menu link is displayed on the page header', async t => { - - await t - .resizeWindow(1920, 1080) - .expect(topMemu.contactTopMenuLink.exists).ok() - .expect(topMemu.contactTopMenuLink.innerText).eql('CONTACT'); -}); - -test('Check "BLOG" top-menu link is displayed on the page header', async t => { - - await t - .resizeWindow(1920, 1080) - .expect(topMemu.blogTopMenuLink.exists).ok() - .expect(topMemu.blogTopMenuLink.innerText).eql('BLOG'); -}); diff --git a/test/e2e/tests/submitContactUs.e2e.js b/test/e2e/tests/submitContactUs.e2e.js index 9abb484..fadea04 100644 --- a/test/e2e/tests/submitContactUs.e2e.js +++ b/test/e2e/tests/submitContactUs.e2e.js @@ -1,17 +1,17 @@ import { Selector } from 'testcafe'; -import ContactForm from '../pages/contact.po'; +import ContactForm from '../pages/contact-page.po'; const contactForm = new ContactForm(); -fixture`"Contact" form request submit verification` - .page`https://www-test.adtechmedia.io/contact/`; +fixture`Check "Contact" form request submit` + .page`https://www-stage.adtechmedia.io/contact/`; test('Check "Contact" form request can be submitted by user with valid data', async t => { await t .resizeWindow(1920, 1080) .expect(contactForm.formModal.exists).ok(); - await t + await t .expect(contactForm.nameField.exists).ok() .expect(contactForm.phoneField.exists).ok() .expect(contactForm.emailField.exists).ok() diff --git a/test/e2e/tests/submitDemoRequest.e2e.js b/test/e2e/tests/submitDemoRequest.e2e.js index 0b3853a..b276125 100644 --- a/test/e2e/tests/submitDemoRequest.e2e.js +++ b/test/e2e/tests/submitDemoRequest.e2e.js @@ -1,32 +1,32 @@ import { Selector } from 'testcafe'; -import RequestDemoPage from '../pages/demo-modal.po'; +import HomePage from '../pages/home-page.po'; +import RequestDemoForm from '../pages/demo-modal.po'; -fixture`"Request a Demo" form submit verification` - .page`https://www-test.adtechmedia.io/`; +fixture`Check "Request a Demo" form submit` + .page`https://www-stage.adtechmedia.io/`; -test('Check if user can submit "Request a demo" form with valid email address', async t => { - // const topMenu = new topMenu(); - const requestDemoTopMenuItem = await Selector('.custom-menu-link > a'); +test('Check user can submit "Request a demo" form with valid email address', async t => { + const homePage = new HomePage(); await t .resizeWindow(1920, 1080) - .click(requestDemoTopMenuItem, { speed: 0.5 }) + .click(homePage.homeRequestDemoModal, { speed: 0.5 }) .expect(Selector('#modal').with({ selectorTimeout: 5000, visibilityCheck: true, }).visible).ok(); - const requestDemoPage = new RequestDemoPage(); + const requestDemoForm = new RequestDemoForm(); await t - .typeText(requestDemoPage.demoFormEmailField, 'sakusha@yahoo.ca') - .typeText(requestDemoPage.demoFormNamelField, 'Test User') - .click(requestDemoPage.demoFormSubmitButton, { speed: 0.5 }); + .typeText(requestDemoForm.demoFormEmailField, 'hellfire@yahoo.com') + .typeText(requestDemoForm.demoFormNamelField, 'Test User') + .click(requestDemoForm.demoFormSubmitButton, { speed: 0.5 }); await t - .expect(Selector(requestDemoPage.demoFormResponseText).with({ + .expect(Selector(requestDemoForm.demoFormResponseText).with({ selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(Selector(requestDemoPage.demoFormResponseText).innerText).eql('\nThank you for the interest in AdTechMedia WordPress Plugin\nPlease check your inbox to schedule your demo.\n'); + .expect(Selector(requestDemoForm.demoFormResponseText).innerText).eql('\nThank you for the interest in AdTechMedia WordPress Plugin\nPlease check your inbox to schedule your demo.\n'); }); From ecd41950f69b4cf9082f4a1510a0970de81a05e8 Mon Sep 17 00:00:00 2001 From: avozicov Date: Thu, 20 Jul 2017 15:41:47 +0300 Subject: [PATCH 2/3] Applied Change Requests by AlexandrC --- test/e2e/.recink.yml | 83 ++++++++++++++++ test/e2e/config.js | 4 + test/e2e/libs.js | 3 + test/e2e/tests/assertApiPage.e2e.js | 14 ++- test/e2e/tests/assertFooter.e2e.js | 16 +-- test/e2e/tests/assertHeader.e2e.js | 27 +++-- test/e2e/tests/assertHomePage.e2e.js | 9 +- test/e2e/tests/assertQuickLinks.e2e.js | 29 +++--- test/e2e/tests/assertSocialLinks.e2e.js | 14 ++- test/e2e/tests/submitContactUs.e2e.js | 17 ++-- test/e2e/tests/submitDemoRequest.e2e.js | 15 ++- tslint.json | 126 ------------------------ 12 files changed, 167 insertions(+), 190 deletions(-) create mode 100644 test/e2e/.recink.yml create mode 100644 test/e2e/config.js create mode 100644 test/e2e/libs.js delete mode 100644 tslint.json diff --git a/test/e2e/.recink.yml b/test/e2e/.recink.yml new file mode 100644 index 0000000..f711c8d --- /dev/null +++ b/test/e2e/.recink.yml @@ -0,0 +1,83 @@ +--- +$: + # preprocess: + # '$.coverage.compare.storage.options.1.region': 'eval' + # '$.coverage.compare.storage.options.1.accessKeyId': 'eval' + # '$.coverage.compare.storage.options.1.secretAccessKey': 'eval' + # '$.cache.options.1.region': 'eval' + # '$.cache.options.1.accessKeyId': 'eval' + # '$.cache.options.1.secretAccessKey': 'eval' + # cache: + # driver: 's3' # Available drivers: void, s3 + # options: + # - 's3://travis-metadata/cache/sample-repo' # S3 cache directory + # - # S3 client options + # region: 'process.env.AWS_DEFAULT_REGION' + # accessKeyId: 'process.env.AWS_ACCESS_KEY_ID' + # secretAccessKey: 'process.env.AWS_SECRET_ACCESS_KEY' + npm: + scripts: [] # Scripts to run after installing dependencies + # - 'compile' + dependencies: # Dependencies to add/overwrite + chai: 'latest' + chance: 'latest' + emit: + pattern: # Files to include + - /.+\.js$/i + ignore: # Files to exclude + - /^(.*\/)?node_modules(\/?$)?/i + test: + mocha: + options: # Mocha options + ui: 'bdd' + reporter: 'spec' + pattern: # Files to include + - /.+\.spec\.js$/i + ignore: ~ # Files to exclude + e2e: + pattern: # Files to include + # - /.+\.e2e\.js$/i + - assertApiPage.e2e.js + - assertFooter.e2e.js + - assertHeader.e2e.js + - assertQuickLinks.e2e.js + - assertSocialLinks.e2e.js + - submitContactUs.e2e.js + - submitDemoRequest.e2e.js + ignore: ~ # Files to exclude + reporter: ~ # TestCafe framework reporter + browsers: # Browsers to run the tests against + - nightmare + # - chrome + # - chrome:headless + # - safari + + # wait: + # interval: 200 # Interval of running uri checks + # timeout: 15000 # Timeout to wait for uri's available + # uri: # uri's to wait before start running test cases + # - https://www.example.com + coverage: + pattern: # Files to include + - /.+\.js$/i + ignore: # Files to exclude + - /.+\.spec\.js$/i + - /.+\.e2e\.js$/i + - /^(.*\/)?node_modules(\/?$)?/i + reporters: # Istanbul reporters + text-summary: ~ + # compare: + # negative-delta: 3 # Compare coverage info and if negative delta is more than X fail (0.01-100.00) + # storage: + # driver: 's3' # Available drivers: s3, volative + # options: + # - 's3://travis-metadata/coverage/sample-repo' # S3 storage directory + # - # S3 storage options + # region: 'process.env.AWS_DEFAULT_REGION' + # accessKeyId: 'process.env.AWS_ACCESS_KEY_ID' + # secretAccessKey: 'process.env.AWS_SECRET_ACCESS_KEY' +main: # Main module definition + root: '.' # Root package directory (containing package.json and tests) + dependencies: ~ # Dependencies to add/overwrite (over $.npm.dependencies config) + +### Add other modules here... \ No newline at end of file diff --git a/test/e2e/config.js b/test/e2e/config.js new file mode 100644 index 0000000..0152318 --- /dev/null +++ b/test/e2e/config.js @@ -0,0 +1,4 @@ +export default { + www_base_host: process.env.WWW_BASE_HOST || 'https://www-stage.adtechmedia.io' +} + diff --git a/test/e2e/libs.js b/test/e2e/libs.js new file mode 100644 index 0000000..26ff7d1 --- /dev/null +++ b/test/e2e/libs.js @@ -0,0 +1,3 @@ +import Chance from 'chance'; + +export default { chance: new Chance() }; diff --git a/test/e2e/tests/assertApiPage.e2e.js b/test/e2e/tests/assertApiPage.e2e.js index 62fc3e7..44b47cb 100644 --- a/test/e2e/tests/assertApiPage.e2e.js +++ b/test/e2e/tests/assertApiPage.e2e.js @@ -1,19 +1,23 @@ import { Selector } from 'testcafe'; +import config from '../config'; import ApiPage from '../pages/api-page.po'; const apiPage = new ApiPage(); fixture`Check valid content is displayed on "API" page` - .page`https://www-stage.adtechmedia.io/api/`; + .page`${config.www_base_host}/api` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); test('Assert "Case Studies" content is displayed on "API" page', async t => { await t - .resizeWindow(1920, 1080) .expect(apiPage.apiPageCaseStudies.with({ selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(apiPage.apiPageCaseStudies.innerText).eql('\nWant to learn about what you can achieve by integrating with our APIs? The possibilities are endless, but you can find just a few examples\n MORE\n') + .expect(apiPage.apiPageCaseStudies.innerText).contains('Want to learn about what you can achieve by integrating with our APIs? The possibilities are endless, but you can find just a few examples'); }); test('Assert "API-Docs" content is displayed on "API" page', async t => { @@ -22,7 +26,7 @@ test('Assert "API-Docs" content is displayed on "API" page', async t => { selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(apiPage.pageElementApiDocs.innerText).eql('\nSee what APIs we have on offer, including extensive documentation. Sign in to manage your subscriptions, see your current usage, get your API Key, and test against our live API.\n MORE\n'); + .expect(apiPage.pageElementApiDocs.innerText).contains('See what APIs we have on offer, including extensive documentation. Sign in to manage your subscriptions, see your current usage, get your API Key, and test against our live API.'); }); test('Assert "User-Guide" content is displayed on "API" page', async t => { @@ -31,5 +35,5 @@ test('Assert "User-Guide" content is displayed on "API" page', async t => { selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(apiPage.pageElementUserGuide.innerText).eql('\nReady to get started? This is the place that answers all your questions. We\'ll have you up and running in no time. Let\'s get started!\n MORE\n'); + .expect(apiPage.pageElementUserGuide.innerText).contains('Ready to get started? This is the place that answers all your questions. We\'ll have you up and running in no time. Let\'s get started!'); }); \ No newline at end of file diff --git a/test/e2e/tests/assertFooter.e2e.js b/test/e2e/tests/assertFooter.e2e.js index bce4da7..825c93f 100644 --- a/test/e2e/tests/assertFooter.e2e.js +++ b/test/e2e/tests/assertFooter.e2e.js @@ -1,28 +1,30 @@ import { Selector } from 'testcafe'; +import config from '../config'; import FooterLinks from '../pages/footer.po'; const footerLinks = new FooterLinks(); fixture`Check valid content and links are displayed on website footer` - .page`https://www-stage.adtechmedia.io/`; + .page`${config.www_base_host}` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); test('Check "Mitoc Group" link is displayed on the page footer', async t => { await t - .resizeWindow(1920, 1080) .expect(footerLinks.company.exists).ok() - .expect(footerLinks.company.innerText).eql('Mitoc Group'); + .expect(footerLinks.company.innerText).contains('Mitoc Group'); }); test('Check "Terms of Use" link is displayed on the page footer', async t => { await t - .resizeWindow(1920, 1080) .expect(footerLinks.termsOfUse.exists).ok() - .expect(footerLinks.termsOfUse.innerText).eql('Terms of Use'); + .expect(footerLinks.termsOfUse.innerText).contains('Terms of Use'); }); test('Check "Privacy Policy" link is displayed on the page footer', async t => { await t - .resizeWindow(1920, 1080) .expect(footerLinks.privacyPolicy.exists).ok() - .expect(footerLinks.privacyPolicy.innerText).eql('Privacy Policy'); + .expect(footerLinks.privacyPolicy.innerText).contains('Privacy Policy'); }); diff --git a/test/e2e/tests/assertHeader.e2e.js b/test/e2e/tests/assertHeader.e2e.js index 358bdd8..f93a200 100644 --- a/test/e2e/tests/assertHeader.e2e.js +++ b/test/e2e/tests/assertHeader.e2e.js @@ -1,61 +1,58 @@ import { Selector } from 'testcafe'; +import config from '../config'; import Header from '../pages/header.po'; const header = new Header(); fixture`Check valid content is displayed on website header` - .page`https://www-stage.adtechmedia.io/`; + .page`${config.www_base_host}` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); test('Check "CHALLENGES" top-menu link is displayed on website header', async t => { await t - .resizeWindow(1920, 1080) .expect(header.challengesTopMenuLink.exists).ok() - .expect(header.challengesTopMenuLink.innerText).eql('CHALLENGES'); + .expect(header.challengesTopMenuLink.innerText).contains('CHALLENGES'); }); test('Check "Logo" image is displayed on website header', async t => { await t - .resizeWindow(1920, 1080) .expect(header.logoImage.exists).ok(); }); test('Check "SOLUTIONS" top-menu link is displayed on website header', async t => { await t - .resizeWindow(1920, 1080) .expect(header.solutionsTopMenuLink.exists).ok() - .expect(header.solutionsTopMenuLink.innerText).eql('SOLUTIONS'); + .expect(header.solutionsTopMenuLink.innerText).contains('SOLUTIONS'); }); test('Check "API" top-menu link is displayed on website header', async t => { await t - .resizeWindow(1920, 1080) .expect(header.apiTopMenuLink.exists).ok() - .expect(header.apiTopMenuLink.innerText).eql('API'); + .expect(header.apiTopMenuLink.innerText).contains('API'); }); test('Check "TEAM" top-menu link is displayed on website header', async t => { await t - .resizeWindow(1920, 1080) .expect(header.teamTopMenuLink.exists).ok() - .expect(header.teamTopMenuLink.innerText).eql('TEAM'); + .expect(header.teamTopMenuLink.innerText).contains('TEAM'); }); test('Check "CONTACT" top-menu link is displayed on website header', async t => { await t - .resizeWindow(1920, 1080) .expect(header.contactTopMenuLink.exists).ok() - .expect(header.contactTopMenuLink.innerText).eql('CONTACT'); + .expect(header.contactTopMenuLink.innerText).contains('CONTACT'); }); test('Check "BLOG" top-menu link is displayed on website header', async t => { await t - .resizeWindow(1920, 1080) .expect(header.blogTopMenuLink.exists).ok() - .expect(header.blogTopMenuLink.innerText).eql('BLOG'); + .expect(header.blogTopMenuLink.innerText).contains('BLOG'); }); test('Check "Request a Demo" modal is displayed on website header', async t => { await t - .resizeWindow(1920, 1080) .expect(header.topMenuRequestDemoModal.exists).ok(); }); diff --git a/test/e2e/tests/assertHomePage.e2e.js b/test/e2e/tests/assertHomePage.e2e.js index ef0dd57..bb5cc98 100644 --- a/test/e2e/tests/assertHomePage.e2e.js +++ b/test/e2e/tests/assertHomePage.e2e.js @@ -1,14 +1,18 @@ import { Selector } from 'testcafe'; +import config from '../config'; import HomePage from '../pages/home-page.po'; const homePage = new HomePage(); fixture`Check valid content is displayed on "Home" page` - .page`https://www-stage.adtechmedia.io/`; + .page`${config.www_base_host}` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); test('Check "Request a Demo" modal is displayed on "Home" page and can be opened by the click', async t => { await t - .resizeWindow(1920, 1080) .expect(homePage.homeRequestDemoModal.exists).ok(); await t @@ -19,7 +23,6 @@ test('Check "Request a Demo" modal is displayed on "Home" page and can be opened test('Check "Watch now" modal is displayed on "Home" page and can be opened by the click', async t => { await t - .resizeWindow(1920, 1080) .expect(homePage.homeWatchNowModal.exists).ok(); await t diff --git a/test/e2e/tests/assertQuickLinks.e2e.js b/test/e2e/tests/assertQuickLinks.e2e.js index 3cc67a2..cbfa076 100644 --- a/test/e2e/tests/assertQuickLinks.e2e.js +++ b/test/e2e/tests/assertQuickLinks.e2e.js @@ -1,14 +1,18 @@ import { Selector } from 'testcafe'; +import config from '../config'; import QuickLinks from '../pages/quick-links.po'; const quickLinks = new QuickLinks(); fixture`Check valid links are displayed on "Quick Links" area` - .page`https://www-stage.adtechmedia.io/`; + .page`${config.www_base_host}` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); test('Check "Challenges" quick-link is clickable and valid information is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(quickLinks.challengesQuickLink.exists).ok() .hover(quickLinks.challengesQuickLink) .click(quickLinks.challengesQuickLink) @@ -20,12 +24,11 @@ test('Check "Challenges" quick-link is clickable and valid information is displa selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(pageElementChallenges.innerText).eql('Challenges'); + .expect(pageElementChallenges.innerText).contains('Challenges'); }); test('Check "Solutions" quick-link is clickable and valid information is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(quickLinks.solutionsQuickLink.exists).ok() .hover(quickLinks.solutionsQuickLink) .click(quickLinks.solutionsQuickLink) @@ -37,12 +40,11 @@ test('Check "Solutions" quick-link is clickable and valid information is display selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(pageElementSolutions.innerText).eql('SOLUTIONS'); + .expect(pageElementSolutions.innerText).contains('SOLUTIONS'); }); test('Check "API" quick-link is clickable and valid information is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(quickLinks.apiQuickLink.exists).ok() .hover(quickLinks.apiQuickLink) .click(quickLinks.apiQuickLink) @@ -54,7 +56,7 @@ test('Check "API" quick-link is clickable and valid information is displayed on selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(pageElementApiFirst.innerText).eql('\nWant to learn about what you can achieve by integrating with our APIs? The possibilities are endless, but you can find just a few examples\n MORE\n') + .expect(pageElementApiFirst.innerText).contains('Want to learn about what you can achieve by integrating with our APIs? The possibilities are endless, but you can find just a few examples') const pageElementApiSecond = await Selector('.flex-item-4:nth-child(2)'); @@ -63,7 +65,7 @@ test('Check "API" quick-link is clickable and valid information is displayed on selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(pageElementApiSecond.innerText).eql('\nSee what APIs we have on offer, including extensive documentation. Sign in to manage your subscriptions, see your current usage, get your API Key, and test against our live API.\n MORE\n') + .expect(pageElementApiSecond.innerText).contains('See what APIs we have on offer, including extensive documentation. Sign in to manage your subscriptions, see your current usage, get your API Key, and test against our live API.') const pageElementApiThird = await Selector('.flex-item-4:nth-child(3)'); @@ -72,12 +74,11 @@ test('Check "API" quick-link is clickable and valid information is displayed on selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(pageElementApiThird.innerText).eql('\nReady to get started? This is the place that answers all your questions. We\'ll have you up and running in no time. Let\'s get started!\n MORE\n'); + .expect(pageElementApiThird.innerText).contains('Ready to get started? This is the place that answers all your questions. We\'ll have you up and running in no time. Let\'s get started!'); }); test('Check "Team" quick-link link is clickable and valid information is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(quickLinks.teamQuickLink.exists).ok() .hover(quickLinks.teamQuickLink) .click(quickLinks.teamQuickLink) @@ -89,12 +90,11 @@ test('Check "Team" quick-link link is clickable and valid information is display selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(pageElementTeam.innerText).eql('TEAM\nWe are a team of highly skilled and very passioned product engineers who dedicated years of building high quality technical solutions that solve large scale business problems.\n'); + .expect(pageElementTeam.innerText).contains('We are a team of highly skilled and very passioned product engineers who dedicated years of building high quality technical solutions that solve large scale business problems.'); }); test('Check "Contact" quick-link is clickable and valid information is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(quickLinks.contactQuickLink.exists).ok() .hover(quickLinks.contactQuickLink) .click(quickLinks.contactQuickLink) @@ -106,12 +106,11 @@ test('Check "Contact" quick-link is clickable and valid information is displayed selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(pageElementContact.innerText).eql('Contact'); + .expect(pageElementContact.innerText).contains('Contact'); }); test('Check "Blog" quick-link is clickable and valid information is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(quickLinks.blogQuickLink.exists).ok() .hover(quickLinks.blogQuickLink) .click(quickLinks.blogQuickLink) @@ -123,5 +122,5 @@ test('Check "Blog" quick-link is clickable and valid information is displayed on selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(pageElementBlog.innerText).eql('AD BLOCKING'); + .expect(pageElementBlog.innerText).contains('AD BLOCKING'); }); diff --git a/test/e2e/tests/assertSocialLinks.e2e.js b/test/e2e/tests/assertSocialLinks.e2e.js index c2aa8cc..343009c 100644 --- a/test/e2e/tests/assertSocialLinks.e2e.js +++ b/test/e2e/tests/assertSocialLinks.e2e.js @@ -1,14 +1,18 @@ import { Selector } from 'testcafe'; +import config from '../config'; import SocialLinks from '../pages/social-links.po'; const socialLinks = new SocialLinks(); fixture`Check valid links are displayed on "Social Links" area` - .page`https://www-stage.adtechmedia.io/`; + .page`${config.www_base_host}` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); test('Check "WordPress" clickable link is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(socialLinks.wordpressLink.exists).ok() .hover(socialLinks.wordpressLink) .click(socialLinks.wordpressLink); @@ -16,7 +20,6 @@ test('Check "WordPress" clickable link is displayed on the page', async t => { test('Check "Drupal" clickable link is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(socialLinks.drupalLink.exists).ok() .hover(socialLinks.drupalLink) .click(socialLinks.drupalLink); @@ -24,7 +27,6 @@ test('Check "Drupal" clickable link is displayed on the page', async t => { test('Check "Github" clickable link is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(socialLinks.githubLink.exists).ok() .hover(socialLinks.githubLink) .click(socialLinks.githubLink); @@ -32,7 +34,6 @@ test('Check "Github" clickable link is displayed on the page', async t => { test('Check "Linkedin" clickable link is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(socialLinks.linkedinLink.exists).ok() .hover(socialLinks.linkedinLink) .click(socialLinks.linkedinLink); @@ -40,7 +41,6 @@ test('Check "Linkedin" clickable link is displayed on the page', async t => { test('Check "Twitter" clickable link is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(socialLinks.twitterLink.exists).ok() .hover(socialLinks.twitterLink) .click(socialLinks.twitterLink); @@ -48,7 +48,6 @@ test('Check "Twitter" clickable link is displayed on the page', async t => { test('Check "Facebook" clickable link is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(socialLinks.facebookLink.exists).ok() .hover(socialLinks.facebookLink) .click(socialLinks.facebookLink); @@ -56,7 +55,6 @@ test('Check "Facebook" clickable link is displayed on the page', async t => { test('Check "Facebook" clickable link is displayed on the page', async t => { await t - .resizeWindow(1920, 1080) .expect(socialLinks.youtubeLink.exists).ok() .hover(socialLinks.youtubeLink) .click(socialLinks.youtubeLink); diff --git a/test/e2e/tests/submitContactUs.e2e.js b/test/e2e/tests/submitContactUs.e2e.js index fadea04..a66fdcd 100644 --- a/test/e2e/tests/submitContactUs.e2e.js +++ b/test/e2e/tests/submitContactUs.e2e.js @@ -1,14 +1,19 @@ import { Selector } from 'testcafe'; +import config from '../config'; +import libs from '../libs'; import ContactForm from '../pages/contact-page.po'; const contactForm = new ContactForm(); fixture`Check "Contact" form request submit` - .page`https://www-stage.adtechmedia.io/contact/`; + .page`${config.www_base_host}/contact` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); test('Check "Contact" form request can be submitted by user with valid data', async t => { await t - .resizeWindow(1920, 1080) .expect(contactForm.formModal.exists).ok(); await t @@ -18,10 +23,10 @@ test('Check "Contact" form request can be submitted by user with valid data', as .expect(contactForm.messageField.exists).ok(); await t - .typeText(contactForm.nameField, 'Alexandr Vozicov') - .typeText(contactForm.phoneField, '999 999 9999') - .typeText(contactForm.emailField, 'avozicov@mitocgroup.com') - .typeText(contactForm.messageField, 'Automation Testing Contact Form submit'); + .typeText(contactForm.nameField, libs.chance.name()) + .typeText(contactForm.phoneField, libs.chance.phone()) + .typeText(contactForm.emailField, libs.chance.email()) + .typeText(contactForm.messageField, libs.chance.sentence()); await t .hover(contactForm.submitButton) diff --git a/test/e2e/tests/submitDemoRequest.e2e.js b/test/e2e/tests/submitDemoRequest.e2e.js index b276125..1a90324 100644 --- a/test/e2e/tests/submitDemoRequest.e2e.js +++ b/test/e2e/tests/submitDemoRequest.e2e.js @@ -1,15 +1,20 @@ import { Selector } from 'testcafe'; +import config from '../config'; +import libs from '../libs'; import HomePage from '../pages/home-page.po'; import RequestDemoForm from '../pages/demo-modal.po'; fixture`Check "Request a Demo" form submit` - .page`https://www-stage.adtechmedia.io/`; + .page`${config.www_base_host}` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); test('Check user can submit "Request a demo" form with valid email address', async t => { const homePage = new HomePage(); await t - .resizeWindow(1920, 1080) .click(homePage.homeRequestDemoModal, { speed: 0.5 }) .expect(Selector('#modal').with({ selectorTimeout: 5000, @@ -19,8 +24,8 @@ test('Check user can submit "Request a demo" form with valid email address', asy const requestDemoForm = new RequestDemoForm(); await t - .typeText(requestDemoForm.demoFormEmailField, 'hellfire@yahoo.com') - .typeText(requestDemoForm.demoFormNamelField, 'Test User') + .typeText(requestDemoForm.demoFormEmailField, libs.chance.email()) + .typeText(requestDemoForm.demoFormNamelField, libs.chance.name()) .click(requestDemoForm.demoFormSubmitButton, { speed: 0.5 }); await t @@ -28,5 +33,5 @@ test('Check user can submit "Request a demo" form with valid email address', asy selectorTimeout: 5000, visibilityCheck: true, }).visible).ok() - .expect(Selector(requestDemoForm.demoFormResponseText).innerText).eql('\nThank you for the interest in AdTechMedia WordPress Plugin\nPlease check your inbox to schedule your demo.\n'); + .expect(Selector(requestDemoForm.demoFormResponseText).innerText).contains('\nThank you for the interest in AdTechMedia WordPress Plugin\nPlease check your inbox to schedule your demo.\n'); }); diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 5c89ec1..0000000 --- a/tslint.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "rulesDirectory": [ - "node_modules/codelyzer", - "node_modules/tslint-eslint-rules/dist/rules" - ], - "rules": { - "trailing-comma": [ - true, - { - "multiline": "always", - "singleline": "never" - } - ], - "no-conditional-assignment": true, - "no-console": [ - false - ], - "no-constant-condition": true, - "no-control-regex": true, - "no-debugger": true, - "no-duplicate-key": true, - "no-duplicate-case": true, - "no-empty": true, - "no-empty-character-class": true, - "no-ex-assign": true, - "no-extra-boolean-cast": true, - "no-extra-semi": true, - "no-inner-declarations": [ - true, - "functions" - ], - "no-invalid-regexp": true, - "no-irregular-whitespace": true, - "no-regex-spaces": true, - "no-unexpected-multiline": true, - "no-unreachable": true, - "use-isnan": true, - "valid-jsdoc": [ - false - ], - "valid-typeof": true, - "curly": true, - "switch-default": true, - "triple-equals": true, - "forin": true, - "no-arg": true, - "no-invalid-this": false, - "no-duplicate-variable": true, - "radix": true, - "no-shadowed-variable": false, - "no-unused-variable": true, - "handle-callback-err": [ - true, - "^(err|error|anySpecificError)$" - ], - "array-bracket-spacing": [ - false - ], - "block-spacing": [ - false - ], - "brace-style": [ - false - ], - "variable-name": [ - true, - "check-format" - ], - "indent": [ - true, - "spaces" - ], - "linebreak-style": [ - false, - "unix" - ], - "new-parens": false, - "object-curly-spacing": [ - false - ], - "arrow-parens": [ - false - ], - "directive-selector-name": [ - true, - "camelCase" - ], - "component-selector-name": [ - true, - "kebab-case" - ], - "directive-selector-type": [ - true, - "attribute" - ], - "component-selector-type": [ - true, - "element" - ], - "directive-selector-prefix": [ - true, - "sg" - ], - "component-selector-prefix": [ - true, - "sg" - ], - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-attribute-parameter-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "no-forward-ref": true, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "pipe-naming": [ - true, - "camelCase", - "sg" - ], - "component-class-suffix": true, - "directive-class-suffix": true, - "import-destructuring-spacing": true - } -} \ No newline at end of file From 786b7a128caeddf0d4013ef22a96701e35f37188 Mon Sep 17 00:00:00 2001 From: avozicov Date: Thu, 20 Jul 2017 15:44:55 +0300 Subject: [PATCH 3/3] Added tslint file --- tslint.json | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 tslint.json diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..5c89ec1 --- /dev/null +++ b/tslint.json @@ -0,0 +1,126 @@ +{ + "rulesDirectory": [ + "node_modules/codelyzer", + "node_modules/tslint-eslint-rules/dist/rules" + ], + "rules": { + "trailing-comma": [ + true, + { + "multiline": "always", + "singleline": "never" + } + ], + "no-conditional-assignment": true, + "no-console": [ + false + ], + "no-constant-condition": true, + "no-control-regex": true, + "no-debugger": true, + "no-duplicate-key": true, + "no-duplicate-case": true, + "no-empty": true, + "no-empty-character-class": true, + "no-ex-assign": true, + "no-extra-boolean-cast": true, + "no-extra-semi": true, + "no-inner-declarations": [ + true, + "functions" + ], + "no-invalid-regexp": true, + "no-irregular-whitespace": true, + "no-regex-spaces": true, + "no-unexpected-multiline": true, + "no-unreachable": true, + "use-isnan": true, + "valid-jsdoc": [ + false + ], + "valid-typeof": true, + "curly": true, + "switch-default": true, + "triple-equals": true, + "forin": true, + "no-arg": true, + "no-invalid-this": false, + "no-duplicate-variable": true, + "radix": true, + "no-shadowed-variable": false, + "no-unused-variable": true, + "handle-callback-err": [ + true, + "^(err|error|anySpecificError)$" + ], + "array-bracket-spacing": [ + false + ], + "block-spacing": [ + false + ], + "brace-style": [ + false + ], + "variable-name": [ + true, + "check-format" + ], + "indent": [ + true, + "spaces" + ], + "linebreak-style": [ + false, + "unix" + ], + "new-parens": false, + "object-curly-spacing": [ + false + ], + "arrow-parens": [ + false + ], + "directive-selector-name": [ + true, + "camelCase" + ], + "component-selector-name": [ + true, + "kebab-case" + ], + "directive-selector-type": [ + true, + "attribute" + ], + "component-selector-type": [ + true, + "element" + ], + "directive-selector-prefix": [ + true, + "sg" + ], + "component-selector-prefix": [ + true, + "sg" + ], + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-attribute-parameter-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "no-forward-ref": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "pipe-naming": [ + true, + "camelCase", + "sg" + ], + "component-class-suffix": true, + "directive-class-suffix": true, + "import-destructuring-spacing": true + } +} \ No newline at end of file