-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
19 changed files
with
234 additions
and
98 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
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
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
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 |
---|---|---|
|
@@ -2,42 +2,43 @@ import nightmare from '../index' | |
|
||
describe('home', () => { | ||
let instance = nightmare.getInstance() | ||
let productName | ||
beforeAll(async () => { | ||
productName = await instance | ||
await instance | ||
.wait('div[nm="login"]') | ||
.click('div[nm="login"] > button') | ||
.wait(100) | ||
.type('input[data-vv-name="email"]', '[email protected]') | ||
.type('input[data-vv-name="password"]', '123456') | ||
.click('button[nm="loginButton"]') | ||
.wait(1000) | ||
.click('a[nm="profile-link"]') | ||
.wait('a[nm="singleLink1"]') | ||
.click('a[nm="singleLink1"]') | ||
}) | ||
test('make sure product added to cart', async () => { | ||
let productName = await instance | ||
.wait('h1[nm="singleProductName"]') | ||
.evaluate(() => { | ||
return document.querySelector('h4[nm="productName"]').textContent | ||
return document.querySelector('h1[nm="singleProductName"]').textContent | ||
}) | ||
|
||
await instance | ||
.wait('a[nm="singleLink1"]') | ||
.click('a[nm="singleLink1"]') | ||
.wait(1000) | ||
let res = await instance | ||
.wait('button[nm="addToCart"]') | ||
.click('button[nm="addToCart"]') | ||
.wait(1000) | ||
.wait('div[nm="openCart"]') | ||
.click('div[nm="openCart"]') | ||
}) | ||
test('make sure product added to cart', async () => { | ||
let res = await instance | ||
.wait("h4[nm='cartProductName-0']") | ||
.evaluate(() => { | ||
return document.querySelector("h4[nm='cartProductName-0']").textContent | ||
}) | ||
.end() | ||
expect(res).toEqual(productName) | ||
}) | ||
|
||
it('should delete item from cart', async () => { | ||
let res = await instance | ||
.wait('button[nm="addToCart"]') | ||
.click('button[nm="addToCart"]') | ||
.wait(1000) | ||
.click('div[nm="openCart"]') | ||
.wait('div[nm="cartRemoveItem"]') | ||
.click('div[nm="cartRemoveItem"] > p') | ||
.wait(1000) | ||
|
@@ -46,13 +47,15 @@ describe('home', () => { | |
}) | ||
.wait(100) | ||
.exists("h4[nm='cartProductName-0']") | ||
.end() | ||
|
||
expect(res).toBe(false) | ||
}) | ||
|
||
it('should delete all items in cart', async () => { | ||
it.skip('should delete all items in cart', async () => { | ||
let res = await instance | ||
.wait('button[nm="addToCart"]') | ||
.click('button[nm="addToCart"]') | ||
.wait(1000) | ||
.click('div[nm="openCart"]') | ||
.wait('div[nm="deleteAllCart"]') | ||
.click('div[nm="deleteAllCart"] > button') | ||
.wait(1000) | ||
|
Oops, something went wrong.