-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from garg3133/nightwatch-v3
- Loading branch information
Showing
31 changed files
with
3,574 additions
and
2,291 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
File renamed without changes.
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,21 @@ | ||
import {ElementProperties, NightwatchAPI} from 'nightwatch'; | ||
|
||
/** | ||
* A class-based custom-command in Nightwatch. The command name is the filename. | ||
* | ||
* Usage: | ||
* browser.strictClick(selector) | ||
* | ||
* This command is being used in: | ||
* test/fileUpload.ts | ||
* | ||
* For more information on working with custom-commands see: | ||
* https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html | ||
*/ | ||
export default class StrictClick { | ||
async command(this: {api: NightwatchAPI}, selector: string | ElementProperties) { | ||
await this.api.element.find(selector).waitUntil('visible'); | ||
|
||
return this.api.click(selector); | ||
} | ||
}; |
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 {ExtendDescribeThis} from 'nightwatch'; | ||
|
||
interface CustomThis { | ||
duckDuckGoUrl: string; | ||
searchBox: string; | ||
submitButton: string; | ||
} | ||
|
||
// callback passed to `describe` should be a regular function (not an arrow function). | ||
describe('duckduckgo example', function(this: ExtendDescribeThis<CustomThis>) { | ||
this.duckDuckGoUrl = 'https://duckduckgo.com'; | ||
this.searchBox = 'input[name=q]'; | ||
this.submitButton = '*[type=submit]'; | ||
|
||
// callback can be a regular function as well as an arrow function. | ||
beforeEach(function(this: ExtendDescribeThis<CustomThis>, browser) { | ||
browser.navigateTo(this.duckDuckGoUrl!); | ||
}); | ||
|
||
// no need to specify `this` parameter when passing an arrow function | ||
// as callback to `it`. | ||
it('Search Nightwatch.js and check results', (browser) => { | ||
browser | ||
.waitForElementVisible(this.searchBox!) | ||
.sendKeys(this.searchBox!, ['Nightwatch.js']) | ||
.click(this.submitButton!) | ||
.assert.visible('.react-results--main') | ||
.assert.textContains('.react-results--main', 'Nightwatch.js'); | ||
}); | ||
}); |
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,18 @@ | ||
describe('Ecosia.org Demo', function() { | ||
this.tags = ['demo']; | ||
|
||
before(browser => browser.navigateTo('https://www.ecosia.org/')); | ||
|
||
it('Demo test ecosia.org', function(browser) { | ||
browser | ||
.waitForElementVisible('body') | ||
.assert.titleContains('Ecosia') | ||
.assert.visible('input[type=search]') | ||
.setValue('input[type=search]', 'nightwatch') | ||
.assert.visible('button[type=submit]') | ||
.click('button[type=submit]') | ||
.assert.textContains('.layout__content', 'Nightwatch.js'); | ||
}); | ||
|
||
after(browser => browser.end()); | ||
}); |
Oops, something went wrong.