-
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.
- Loading branch information
Sijo Cheeran
committed
Dec 30, 2021
1 parent
2d5e515
commit 4ecb962
Showing
8 changed files
with
3,739 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
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,4 @@ | ||
{ | ||
"skipJsErrors": true, | ||
"skipUncaughtErrors": true | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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,22 @@ | ||
{ | ||
"name": "testcafe-example", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sijosyn/testcafe-example.git" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/sijosyn/testcafe-example/issues" | ||
}, | ||
"homepage": "https://github.com/sijosyn/testcafe-example#readme", | ||
"dependencies": { | ||
"testcafe": "^1.18.1" | ||
} | ||
} |
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,10 @@ | ||
import { Selector } from 'testcafe'; | ||
|
||
class accountPage { | ||
|
||
myAccount = Selector('[title="MY ACCOUNT"]'); | ||
emailAddress = Selector('[name="EMAIL_ADDRESS"]') | ||
|
||
} | ||
|
||
export let account = new accountPage(); |
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,13 @@ | ||
import { Selector } from 'testcafe'; | ||
|
||
class searchPage { | ||
|
||
searchIcon = Selector('.js-esearch-open-icon'); | ||
searchTextBox = Selector('[name=search]'); | ||
searchSuggestionItem = Selector('.search-suggestions__item'); | ||
productResults = Selector('.product-results'); | ||
esearchProduct = Selector('.esearch-product'); | ||
searchNoResults = Selector('.search-no-results'); | ||
} | ||
|
||
export let search = new searchPage(); |
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,10 @@ | ||
import { account } from '../pages/account'; | ||
|
||
fixture`Account functionality fixture` | ||
.page`https://www.darphin.com/`; | ||
|
||
test('Check account sign up functionality', async t => { | ||
// Click search icon and search for milk | ||
await t.click(account.myAccount); | ||
|
||
}); |
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,39 @@ | ||
import { search } from '../pages/search'; | ||
|
||
fixture`Search functionality fixture` | ||
.page`https://www.darphin.com/`; | ||
|
||
test('Check search suggestion works and matches search result items', async t => { | ||
// Click search icon and search for milk | ||
await t.click(search.searchIcon); | ||
await t.typeText(search.searchTextBox, 'milk'); | ||
|
||
// Check the product results suggestion box is visible | ||
await t.expect(search.productResults.visible).ok(); | ||
|
||
// Extract the number of search result items from search suggestion | ||
let text = await search.searchSuggestionItem.textContent; | ||
let itemNumber =text.replace(/\D/g,"") | ||
|
||
// Hit enter key to navigate to search results page | ||
await t.pressKey('enter'); | ||
|
||
// Verify the search results shows the expected number of items | ||
await t.expect(search.esearchProduct.count).eql(parseInt(itemNumber)); | ||
}); | ||
|
||
|
||
test('Check search returns no matching items', async t => { | ||
// Click search icon and search for milk | ||
await t.click(search.searchIcon); | ||
await t.typeText(search.searchTextBox, 'honey'); | ||
|
||
// Check the product results suggestion box is not shown | ||
await t.expect(search.productResults.visible).notOk(); | ||
|
||
// Hit enter key to navigate to search results page | ||
await t.pressKey('enter'); | ||
|
||
// Verify no items found matching text is displayed | ||
await t.expect(search.searchNoResults.textContent).contains('No items found matching'); | ||
}); |