Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global e2e tests refactoring and improvement #283

Merged
merged 3 commits into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/e2e/pages/api-page.po.js
Original file line number Diff line number Diff line change
@@ -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)');
}
};

File renamed without changes.
2 changes: 1 addition & 1 deletion test/e2e/pages/demo-modal.po.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
1 change: 1 addition & 0 deletions test/e2e/pages/footer.po.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
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');
this.teamTopMenuLink = Selector('.clearfix > li:nth-child(4) > a');
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');
}
};
11 changes: 11 additions & 0 deletions test/e2e/pages/home-page.po.js
Original file line number Diff line number Diff line change
@@ -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');
}
};

2 changes: 1 addition & 1 deletion test/e2e/pages/quick-links.po.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
14 changes: 14 additions & 0 deletions test/e2e/pages/social-links.po.js
Original file line number Diff line number Diff line change
@@ -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');
}
};

3 changes: 0 additions & 3 deletions test/e2e/test_runs/content/pagesContent.e2e_run.md

This file was deleted.

3 changes: 0 additions & 3 deletions test/e2e/test_runs/footer/footerLinks.e2e_run.md

This file was deleted.

3 changes: 0 additions & 3 deletions test/e2e/test_runs/footer/quickLinks.e2e_run.md

This file was deleted.

3 changes: 0 additions & 3 deletions test/e2e/test_runs/form/contactUs.e2e_run.md

This file was deleted.

3 changes: 0 additions & 3 deletions test/e2e/test_runs/form/requestDemo.e2e_run.md

This file was deleted.

3 changes: 0 additions & 3 deletions test/e2e/test_runs/header/topMenuLinks.e2e_run.md

This file was deleted.

35 changes: 35 additions & 0 deletions test/e2e/tests/assertApiPage.e2e.js
Original file line number Diff line number Diff line change
@@ -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/`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use base host (e.g. https://www-stage.adtechmedia.io) from a config.js like this: config.www_base_host

// config.js

export default {
  www_base_host: process.env.WWW_BASE_HOST || 'https://www-test.adtechmedia.io',
}

You can run tests like WWW_BASE_HOST='https://www-stage.adtechmedia.io' recink run e2e

Copy link
Contributor Author

@avozicov avozicov Jul 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it, thank you.

Latest status: Fixed


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');
});
136 changes: 0 additions & 136 deletions test/e2e/tests/assertContent.e2e.js

This file was deleted.

28 changes: 28 additions & 0 deletions test/e2e/tests/assertFooter.e2e.js
Original file line number Diff line number Diff line change
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try setting default window size from config (see nighmare docs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it, thank you.

Latest status: Fixed

.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');
});
61 changes: 61 additions & 0 deletions test/e2e/tests/assertHeader.e2e.js
Original file line number Diff line number Diff line change
@@ -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();
});
29 changes: 29 additions & 0 deletions test/e2e/tests/assertHomePage.e2e.js
Original file line number Diff line number Diff line change
@@ -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 });
});
Loading