Paste #128764 |
pasted on 31.10.2019 19:25
- Edit to this paste
- Raw
-
Compare with paste
#
Text paste
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | const assert = require('assert'); const fetch = require("node-fetch"); const request = require('request'); const pageToFollow = [ 'https://gepur.com', 'https://en.gepur.com', 'https://ua.gepur.com', 'https://m.gepur.com' ]; const mainBanner = [ '//*[@id="r_header"]/header/span/a/div', '//*[@id="root"]/div/header/div[2]/a/img' ]; let response, result; let statusCodeOk = [ '200', ] async function clickingMainBanner(page, banner){ await browser.url(page); const mBanner = await $(banner); await browser.pause(10000); await mBanner.click(); }; async function getStatus(url){ response = await fetch(url); result = response.status; if(response.ok){ console.log("IT'S ALIVE!!! " + result); }else{ console.log("ERROR!!! " + result); } }; // async function usingProxy(url, proxy){ request({ 'url': url, 'method': "GET", 'proxy': proxy, },function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } }) } // try{ describe('Главные страницы сайта доступны', () => { describe('RU', () => { beforeEach(async ()=> { await browser.reloadSession(); await browser.setWindowSize(1024, 768); }); it.skip('Статус код 200', async () => { }); it('Стрнаица загрузилась', async () => { await clickingMainBanner(pageToFollow[0], mainBanner[0]); } ); }); describe('EN', () => { beforeEach(async ()=> { await browser.reloadSession(); await browser.setWindowSize(1024, 768); }); it.skip('Статус код 200', async () => { }); it('Стрнаица загрузилась', async () => { await clickingMainBanner(pageToFollow[1], mainBanner[0]); } ); }); describe('UA', () => { beforeEach(async ()=> { await browser.reloadSession(); await browser.setWindowSize(1024, 768); }); it('Статус код 200', async () => { await getStatus(pageToFollow[2]); await assert.equal(result, statusCodeOk[0]); }); it('Стрнаица загрузилась', async () => { await clickingMainBanner(pageToFollow[2], mainBanner[0]); } ); }); describe('M', () => { beforeEach(async ()=> { await browser.reloadSession(); await browser.setWindowSize(415, 1000); }); it('Статус код 200', async () => { await getStatus(pageToFollow[3]); await assert.equal(result, statusCodeOk[0]); }); it('Стрнаица загрузилась', async () => { await clickingMainBanner(pageToFollow[3], mainBanner[1]); } ); }); }); }catch(error){ throw(error); } |