Question: test.js Script in index.html Please write code for the above functions describe ('Assignment 1', () => { context('The index page', ()=>{ = it('Test 1: Should

test.js

test.js Script in index.html Please write code for the above functions describe

('Assignment 1', () => { context('The index page', ()=>{ = it('Test 1:

Should have the page title "Poke Dextr", async() => { let pageTitle

await page.title(); expect(pageTitle).to.eql("Poke Dextr'); }); it('Test 2: Should have a nav bar

with containing the text "Poke Dextr", async ()=>{ let navhtml = await

getHTML('nav'); let result = navhtml null ? -1 : navhtml.search('Poke Dextr'); expect(result).to.not.eql(-1);

Script in index.html

}); === it('Test 3: Should have a main element', async () =>{

Please write code for the above functions

describe ('Assignment 1', () => { context('The index page', ()=>{ = it('Test 1: Should have the page title "Poke Dextr", async() => { let pageTitle await page.title(); expect(pageTitle).to.eql("Poke Dextr'); }); it('Test 2: Should have a nav bar with containing the text "Poke Dextr", async ()=>{ let navhtml = await getHTML('nav'); let result = navhtml null ? -1 : navhtml.search('Poke Dextr'); expect(result).to.not.eql(-1); }); === it('Test 3: Should have a main element', async () =>{ let mainHandle = await page. $('main'); expect(mainHandle).to.be.ok; }); it('Test 4: Should have a link to index.html in nav entitled "Listing", async ()=>{ let linkHandle await page. $('nav a[href="index.html"]'); expect(linkHandle).to.be.ok; }); it('Test 5: Should make an siav call which requests nokomon data on load', async ()=>{ let url = 'https: (property) Chai.Assertion.equal: Chai.Equal let match reque (value: any, message?: string) => Chai.Assertion expect(match).to.equal(true); }).timeout(2000); it('Test 6: Should load a list of 50 links with the class "collection-item" within an element with the id "listing", async ()=>{ let links = await page.$$('a.collection-item'); expect(links.length).to.equal(50); ); it('Test 7: Should have an element with the id "listing" and a max height of 600px', async ()= { let listing = await getStyles('#listing'); expect(listing.maxHeight).to.equal('600px'); 7. = it('Test 8: Should have an element with the id "listing" and be vertically scrollable', async ()=>{ let listing await getStyles('#listing'); expect(listing.overflowy).to.equal('scroll'); }); it('Test 9: Should show a #dugtrio link when the page is loaded', async() => { const dugtrioLink = await (await (await page.$('#dugtrio')).getProperty('textcontent')).jsonValue(); expect(dugtriolink).to.equal('dugtrio'); }); let regs = it('Test 10: Should send an ajax request for pokemon details on link click', async ()=>{ ['https://pokeapi.co/api/v2/pokemon/dugtrio', l'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/51.png']; let count 0; await page.click('a#dugtrio'); await pause (1000); reqs.forEach(req => { if(requests.includes(req)) count++ }) expect(count).to.equal(2); }).timeout(2000); it('Test 11: Should show pokemon image, id, types, weight and height in #result on link click', async ()=>{ await page.click('a#dugtrio'); await pause (500); await page.waitForSelector('#result'); let searchkeys { weight: 'ground', id:'51', name: 'dugtrio', weight: '333', height:'7' }; = let result await getHTML('#result'); let checks { name: false, type: false, id: false, weight: false, height: false }; for(let key of Object.keys (checks)) { checks[key] result.search(searchkeys [key]) != -1; } = expect(checks).to.eql({ name: true, type: true, id: true, weight: true, height: true }); }); }); }) after(async () => { await browser.close(); });

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!