From e35ca2212dd2f3f193afc35ae7c67a9733385816 Mon Sep 17 00:00:00 2001 From: Arlo Duff Date: Thu, 18 Apr 2019 22:40:07 -0400 Subject: [PATCH] Added test to check each link navigates correctly #33 --- test/e2e/home.js | 49 +++++++++++++++++++++++++++++++----------------- yarn.lock | 20 ++++++++++---------- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/test/e2e/home.js b/test/e2e/home.js index 44f92c36..ae379341 100644 --- a/test/e2e/home.js +++ b/test/e2e/home.js @@ -3,26 +3,41 @@ describe('Home', () => { await browser.url('/') const title = await browser.getTitle() expect(title).toBe('Force Vue Awakens') - }); + }) it('should list 10 people', async () => { - await browser.pause(4000); - const cards = await $$('a.card'); - expect(cards.length).toBe(10); - }); + await browser.pause(4000) + const cards = await $$('a.card') + expect(cards.length).toBe(10) + }) it('should list a name for each person', async () => { - const names = await $$('.card .card-title'); - expect(names.length).toBe(10); - }); + const names = await $$('.card .card-title') + expect(names.length).toBe(10) + }) it('should display an image for each person', async () => { - const images = await $$('.card img'); - expect(images.length).toBe(10); - - for(let img of images) { - const isDisplayed = await img.isDisplayed(); - expect(isDisplayed).toBe(true); - } - }); -}); + const images = await $$('.card img') + expect(images.length).toBe(10) + + for (let img of images) { + const isDisplayed = await img.isDisplayed() + expect(isDisplayed).toBe(true) + } + }) + + it('should display a functioning link', async () => { + const links = await $$('a.card') + + for (let i = 0; i < links.length; i++) { + let link = await $('a[href="#/people/' + i + '"]') + + await link.click() + const textDiv = await browser.$('main div') + const text = await textDiv.getText() + expect(text).toBe('Person ' + i) + + browser.back() + } + }) +}) diff --git a/yarn.lock b/yarn.lock index 35557c55..94306d3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -402,7 +402,7 @@ dom-event-types "^1.0.0" lodash "^4.17.4" -"@wdio/cli@^5.7.13": +"@wdio/cli@^5.7.14": version "5.7.14" resolved "https://registry.yarnpkg.com/@wdio/cli/-/cli-5.7.14.tgz#920f3ee5a767f0c9a41791942f9a9e0d2c1f7fb2" integrity sha512-U2r4zT59mDecKQ3+GdyTDTXulmlV4gfW254OSohxLACQweZkSLFvLkTq11tfgjfqeHnDNpg9tn1TTfYPY/ByVA== @@ -455,7 +455,7 @@ junit-report-builder "^1.3.0" validator "^9.4.1" -"@wdio/local-runner@^5.7.13": +"@wdio/local-runner@^5.7.14": version "5.7.14" resolved "https://registry.yarnpkg.com/@wdio/local-runner/-/local-runner-5.7.14.tgz#49a8e37d8d9de415db25a97bc6f90306b781cfa6" integrity sha512-SuxAxMbfHHT2uQBY0lapES5RX7Q7NrViPPscs6pGBMXnXmFIpS0ZaE7KpECU0sLhSlQ5iWCv20jRoqm1VpeZgw== @@ -3140,10 +3140,10 @@ eslint-plugin-es@^1.3.1: eslint-utils "^1.3.0" regexpp "^2.0.1" -eslint-plugin-import@^2.17.1: - version "2.17.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.17.1.tgz#b888feb4d9b3ee155113c8dccdd4bec5db33bdf4" - integrity sha512-lzD9uvRvW4MsHzIOMJEDSb5MOV9LzgxRPBaovvOhJqzgxRHYfGy9QOrMuwHIh5ehKFJ7Z3DcrcGKDQ0IbP0EdQ== +eslint-plugin-import@^2.17.2: + version "2.17.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.17.2.tgz#d227d5c6dc67eca71eb590d2bb62fb38d86e9fcb" + integrity sha512-m+cSVxM7oLsIpmwNn2WXTJoReOF9f/CtLMo7qOVmKd1KntBy0hEcuNZ3erTmWjx+DxRO0Zcrm5KwAvI9wHcV5g== dependencies: array-includes "^3.0.3" contains-path "^0.1.0" @@ -8557,10 +8557,10 @@ vue-loader@^15.2.0: vue-hot-reload-api "^2.3.0" vue-style-loader "^4.1.0" -vue-router@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.0.4.tgz#d6023e9db64d0b335771f0316c8bde8956f2d75d" - integrity sha512-wjirAFeMR53FFTRIM2ofLKH5BJte6Q9+MUiOj6fLzqhgerjVyQVeMmvgiQDslPJJHSqFfQ559EDvIi0lA1Lr6g== +vue-router@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.0.6.tgz#2e4f0f9cbb0b96d0205ab2690cfe588935136ac3" + integrity sha512-Ox0ciFLswtSGRTHYhGvx2L44sVbTPNS+uD2kRISuo8B39Y79rOo0Kw0hzupTmiVtftQYCZl87mwldhh2L9Aquw== vue-style-loader@^4.1.0: version "4.1.2"