-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into handle-uncaught
- Loading branch information
Showing
66 changed files
with
1,424 additions
and
209 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,22 @@ | ||
name: Publish to NPM | ||
on: | ||
push: | ||
tags: | ||
- vv* # to enable this action, change this tag back to v* | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Publish package on NPM 📦 | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,35 @@ | ||
describe('Element Drag & Drop Demo', function () { | ||
before(browser => { | ||
browser.navigateTo( | ||
'https://mdn.github.io/dom-examples/drag-and-drop/copy-move-DataTransfer.html' | ||
); | ||
}); | ||
|
||
it('move element demo', async function (browser) { | ||
const srcMoveElem = browser.element('#src_move'); // returns a Nightwatch Element Wrapper with loads of element commands. | ||
|
||
// pause to see the initial state | ||
browser.pause(1000); | ||
|
||
// drag src element 80 pixels below. | ||
srcMoveElem.dragAndDrop({x: 0, y: 80}); | ||
}); | ||
|
||
it('copy element demo', async function (browser) { | ||
const srcCopyElem = browser.element('#src_copy'); // returns a Nightwatch Element Wrapper with loads of element commands. | ||
const destCopyWebElem = await browser.element('#dest_copy'); // awaiting the browser.element command returns a WebElement object (actual result). | ||
|
||
// pause to see the initial state | ||
browser.pause(1000); | ||
|
||
// drag src element to dest element. | ||
srcCopyElem.dragAndDrop(destCopyWebElem); | ||
}); | ||
|
||
after((browser) => { | ||
// pause to see the final state | ||
browser.pause(2000); | ||
|
||
browser.end(); | ||
}); | ||
}); |
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 @@ | ||
describe('Take Screenshot Demo', function () { | ||
before((browser) => { | ||
browser.navigateTo('https://nightwatchjs.org/'); | ||
}); | ||
|
||
it('takes screenshot without async-await', function (browser) { | ||
browser.waitForElementVisible('body'); | ||
|
||
const heading = browser.element('.hero__heading'); | ||
const screenshot = heading.takeScreenshot(); | ||
screenshot.then((screenshotData) => { | ||
require('fs').writeFile('heading.png', screenshotData, 'base64', (err) => { | ||
browser.assert.strictEqual(err, null); | ||
}); | ||
}); | ||
}); | ||
|
||
it('takes screenshot with async-await', async function (browser) { | ||
browser.waitForElementVisible('body'); | ||
|
||
const heading = browser.element('.hero__heading'); | ||
const screenshotData = await heading.takeScreenshot(); | ||
|
||
require('fs').writeFile('heading1.png', screenshotData, 'base64', (err) => { | ||
browser.assert.strictEqual(err, null); | ||
}); | ||
}); | ||
|
||
after((browser) => browser.end()); | ||
}); |
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,35 @@ | ||
describe('Element "is" commands Demo', function () { | ||
before((browser) => { | ||
browser.navigateTo('https://www.ecosia.org/settings'); | ||
}); | ||
|
||
it('Demo', async function (browser) { | ||
// accepting cookies to remove modal | ||
browser.element('.cookie-consent__actions').getLastElementChild().click(); | ||
|
||
const saveButton = browser.element('.settings-form__buttons > .base-button--variant-solid-green'); | ||
const cancelButton = browser.element('.settings-form__buttons > .base-button--variant-outline'); | ||
|
||
saveButton.isVisible().assert.equals(true); | ||
cancelButton.isVisible().assert.equals(true); | ||
|
||
saveButton.isEnabled().assert.equals(false); | ||
cancelButton.isEnabled().assert.equals(true); | ||
|
||
const newTabCheckbox = browser.element('#e-field-newTab'); | ||
|
||
newTabCheckbox.isSelected().assert.equals(false); | ||
|
||
// Clicking the checkbox selects it. | ||
// Also our save button becomes enabled. | ||
newTabCheckbox.click(); | ||
|
||
newTabCheckbox.isSelected().assert.equals(true); | ||
saveButton.isEnabled().assert.equals(true); | ||
|
||
// click the cancel button | ||
cancelButton.click(); | ||
}); | ||
|
||
after((browser) => browser.end()); | ||
}); |
This file was deleted.
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Determines if an element is currently active/focused in the DOM. | ||
* | ||
* For more info on working with DOM elements in Nightwatch, refer to the <a href="https://nightwatchjs.org/guide/writing-tests/finding-interacting-with-dom-elements.html">Finding & interacting with DOM Elements</a> guide page. | ||
* For more info on the new `browser.element.find()` syntax, refer to the <a href="/api/element/"> new Element API Overview </a> page. | ||
* | ||
* @example | ||
* describe('isActive Demo', function() { | ||
* it('test isActive', function(browser) { | ||
* browser.element.find('#search') | ||
* .isActive() | ||
* .assert.equals(true); | ||
* }); | ||
* | ||
* it('test async isActive', async function(browser) { | ||
* const result = await browser.element.find('#search').isActive(); | ||
* browser.assert.equal(result, true); | ||
* }); | ||
* }); | ||
* | ||
* @since 3.9.0 | ||
* @method isActive | ||
* @memberof ScopedWebElement | ||
* @instance | ||
* @syntax browser.element.find(selector).isActive() | ||
* @link /#get-active-element | ||
* @returns {ScopedValue<boolean>} | ||
*/ | ||
module.exports.command = function () { | ||
return this.runQueuedCommandScoped('isElementActive'); | ||
}; |
Oops, something went wrong.