forked from vuejs/vuex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate e2e test to puppeteer from nightwatch (vuejs#1778)
- Loading branch information
Showing
14 changed files
with
707 additions
and
1,190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { setupPuppeteer, E2E_TIMEOUT } from 'test/helpers' | ||
|
||
describe('e2e/cart', () => { | ||
const { page, text, count, click, sleep } = setupPuppeteer() | ||
|
||
test('cart app', async () => { | ||
await page().goto('http://localhost:8080/shopping-cart/') | ||
|
||
await sleep(120) // api simulation | ||
|
||
expect(await count('li')).toBe(3) | ||
expect(await count('.cart button[disabled]')).toBe(1) | ||
expect(await text('li:nth-child(1)')).toContain('iPad 4 Mini') | ||
expect(await text('.cart')).toContain('Please add some products to cart') | ||
expect(await text('.cart')).toContain('Total: $0.00') | ||
|
||
await click('li:nth-child(1) button') | ||
expect(await text('.cart')).toContain('iPad 4 Mini - $500.01 x 1') | ||
expect(await text('.cart')).toContain('Total: $500.01') | ||
|
||
await click('li:nth-child(1) button') | ||
expect(await text('.cart')).toContain('iPad 4 Mini - $500.01 x 2') | ||
expect(await text('.cart')).toContain('Total: $1,000.02') | ||
expect(await count('li:nth-child(1) button[disabled]')).toBe(1) | ||
|
||
await click('li:nth-child(2) button') | ||
expect(await text('.cart')).toContain('H&M T-Shirt White - $10.99 x 1') | ||
expect(await text('.cart')).toContain('Total: $1,011.01') | ||
|
||
await click('.cart button') | ||
await sleep(200) | ||
expect(await text('.cart')).toContain('Please add some products to cart') | ||
expect(await text('.cart')).toContain('Total: $0.00') | ||
expect(await text('.cart')).toContain('Checkout successful') | ||
expect(await count('.cart button[disabled]')).toBe(1) | ||
}, E2E_TIMEOUT) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { setupPuppeteer, E2E_TIMEOUT } from 'test/helpers' | ||
|
||
describe('e2e/chat', () => { | ||
const { page, text, count, click, enterValue, sleep } = setupPuppeteer() | ||
|
||
test('chat app', async () => { | ||
await page().goto('http://localhost:8080/chat/') | ||
|
||
expect(await text('.thread-count')).toContain('Unread threads: 2') | ||
expect(await count('.thread-list-item')).toBe(3) | ||
expect(await text('.thread-list-item.active')).toContain('Functional Heads') | ||
expect(await text('.message-thread-heading')).toContain('Functional Heads') | ||
expect(await count('.message-list-item')).toBe(2) | ||
expect(await text('.message-list-item:nth-child(1) .message-author-name')).toContain('Bill') | ||
expect(await text('.message-list-item:nth-child(1) .message-text')).toContain('Hey Brian') | ||
|
||
await enterValue('.message-composer', 'hi') | ||
await sleep(50) // fake api | ||
expect(await count('.message-list-item')).toBe(3) | ||
expect(await text('.message-list-item:nth-child(3)')).toContain('hi') | ||
|
||
await click('.thread-list-item:nth-child(2)') | ||
expect(await text('.thread-list-item.active')).toContain('Dave and Bill') | ||
expect(await text('.message-thread-heading')).toContain('Dave and Bill') | ||
expect(await count('.message-list-item')).toBe(2) | ||
expect(await text('.message-list-item:nth-child(1) .message-author-name')).toContain('Bill') | ||
expect(await text('.message-list-item:nth-child(1) .message-text')).toContain('Hey Dave') | ||
|
||
await enterValue('.message-composer', 'hi') | ||
await sleep(50) // fake api | ||
expect(await count('.message-list-item')).toBe(3) | ||
expect(await text('.message-list-item:nth-child(3)')).toContain('hi') | ||
}, E2E_TIMEOUT) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { setupPuppeteer, E2E_TIMEOUT } from 'test/helpers' | ||
|
||
describe('e2e/counter', () => { | ||
const { page, text, click, sleep } = setupPuppeteer() | ||
|
||
test('counter app', async () => { | ||
await page().goto('http://localhost:8080/counter/') | ||
expect(await text('#app')).toContain('Clicked: 0 times') | ||
|
||
await click('button:nth-child(1)') | ||
expect(await text('#app')).toContain('Clicked: 1 times') | ||
|
||
await click('button:nth-child(2)') | ||
expect(await text('#app')).toContain('Clicked: 0 times') | ||
|
||
await click('button:nth-child(3)') | ||
expect(await text('#app')).toContain('Clicked: 0 times') | ||
|
||
await click('button:nth-child(1)') | ||
expect(await text('#app')).toContain('Clicked: 1 times') | ||
|
||
await click('button:nth-child(3)') | ||
expect(await text('#app')).toContain('Clicked: 2 times') | ||
|
||
await click('button:nth-child(4)') | ||
expect(await text('#app')).toContain('Clicked: 2 times') | ||
await sleep(1000) | ||
expect(await text('#app')).toContain('Clicked: 3 times') | ||
}, E2E_TIMEOUT) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.