send/test/integration/homepage-tests.js

55 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-10-04 00:39:39 +00:00
/* global browser */
2018-10-02 20:15:02 +00:00
const assert = require('assert');
2018-10-04 00:39:39 +00:00
const HomePage = require('./pages/desktop/home_page');
2018-10-02 20:15:02 +00:00
2018-10-04 00:39:39 +00:00
describe('Firefox Send homepage', function() {
2018-10-02 20:15:02 +00:00
const baseUrl = browser.options['baseUrl'];
const legalLinks = [
'legal',
'about',
'legal',
'cookies',
'report-infringement'
];
const socialLinks = ['github', 'twitter', 'mozilla'];
2018-10-04 00:39:39 +00:00
beforeEach(function() {
2018-10-02 20:15:02 +00:00
browser.url('/');
browser.pause(500);
});
2018-10-04 00:39:39 +00:00
it('should have the right title', function() {
assert.equal(browser.getTitle(), 'Firefox Send');
2018-10-02 20:15:02 +00:00
});
legalLinks.forEach((link, i) => {
2018-10-04 00:39:39 +00:00
it(`should navigate to the correct legal pages, page: ${link}`, function() {
const homePage = new HomePage();
2018-10-02 20:15:02 +00:00
// Click links on bottom of page
2018-10-04 00:39:39 +00:00
const els = browser.elements(homePage.legalLinks);
2018-10-02 20:15:02 +00:00
browser.elementIdClick(els.value[i].ELEMENT);
// Wait for page to load
browser.waitUntil(() => {
2018-10-04 00:39:39 +00:00
const url = browser.getUrl();
2018-10-02 20:15:02 +00:00
return url !== baseUrl;
});
assert.ok(browser.getUrl().includes(link));
});
});
socialLinks.forEach((link, i) => {
2018-10-04 00:39:39 +00:00
it(`should navigate to the correct social pages, page: ${link}`, function() {
const homePage = new HomePage();
2018-10-02 20:15:02 +00:00
// Click links on bottom of page
2018-10-04 00:39:39 +00:00
const els = browser.elements(homePage.socialLinks);
2018-10-02 20:15:02 +00:00
browser.elementIdClick(els.value[i].ELEMENT);
// Wait for page to load
browser.waitUntil(() => {
2018-10-04 00:39:39 +00:00
const url = browser.getUrl();
2018-10-02 20:15:02 +00:00
return url !== baseUrl;
});
assert.ok(browser.getUrl().includes(link));
});
});
});