-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix e2e clearValue and add shouldClear to control clearing behavior #117
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c9d0e13
Alternative puppeteer clear value implementation
gendeld 0e4dcc2
Merge commit '3d75f397304a92e9038a6e3d09716f97a991f94d' into puppetee…
gendeld 757eed7
Use selenium clear
gendeld 3f94a06
Add should clear option
gendeld 9208a94
Fix test
gendeld 261e392
Move shouldClear test to adapter specs
gendeld cbab9ab
Remove local change
gendeld e753876
Add comment to explain triple click
gendeld File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
import { browser, $} from 'protractor'; | ||
import { browser, $ } from 'protractor'; | ||
import { SetupFn, runTestSuite, getTestAppUrl } from '@unidriver/test-suite'; | ||
import { protractorUniDriver } from '.'; | ||
import { assert } from 'chai'; | ||
|
||
import { port } from './protractor.conf'; | ||
|
||
const setup: SetupFn = async (data) => { | ||
await browser.get(`http://localhost:${port}${getTestAppUrl(data)}`); | ||
const driver = protractorUniDriver(() => Promise.resolve($('body'))); | ||
await browser.get(`http://localhost:${port}${getTestAppUrl(data)}`); | ||
const driver = protractorUniDriver(() => Promise.resolve($('body'))); | ||
const tearDown = async () => {}; | ||
return {driver, tearDown}; | ||
return { driver, tearDown }; | ||
}; | ||
|
||
describe('protractor', () => { | ||
|
||
runTestSuite({setup}); | ||
|
||
runTestSuite({ setup }); | ||
}); | ||
|
||
describe('protractor specific tests', () => { | ||
|
||
it(`doesn't attempt to clear value when shouldClear is false`, async () => { | ||
const { driver } = await setup({ items: [], initialText: 'hello' }); | ||
await driver | ||
.$('header input') | ||
.enterValue(' world!', { shouldClear: false }); | ||
assert.equal(await driver.$('header input').value(), 'hello world!'); | ||
}); | ||
}); | ||
|
||
|
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 |
---|---|---|
@@ -1,45 +1,64 @@ | ||
import * as puppeteer from 'puppeteer'; | ||
import {Browser, Page} from 'puppeteer'; | ||
import {getTestAppUrl, startTestAppServer, SetupFn, runTestSuite} from '@unidriver/test-suite'; | ||
import {pupUniDriver} from './'; | ||
import {Server} from 'http'; | ||
import { Browser, Page } from 'puppeteer'; | ||
import { | ||
getTestAppUrl, | ||
startTestAppServer, | ||
SetupFn, | ||
runTestSuite, | ||
} from '@unidriver/test-suite'; | ||
import { pupUniDriver } from './'; | ||
import { Server } from 'http'; | ||
import { assert } from 'chai'; | ||
|
||
const port = require('find-free-port-sync')(); | ||
|
||
let server: Server; | ||
let browser: Browser; | ||
let page: Page; | ||
|
||
const before = async () => { | ||
const beforeFn = async () => { | ||
const args = process.env.CI ? ['--no-sandbox'] : []; | ||
const headless = !!process.env.CI; | ||
server = await startTestAppServer(port); | ||
browser = await puppeteer.launch({headless, args}); | ||
browser = await puppeteer.launch({ | ||
headless, | ||
args, | ||
}); | ||
page = await browser.newPage(); | ||
}; | ||
|
||
const after = async () => { | ||
const afterFn = async () => { | ||
server.close(); | ||
await page.close(); | ||
await browser.close(); | ||
}; | ||
|
||
const setup: SetupFn = async (params) => { | ||
await page.goto(`http://localhost:${port}${getTestAppUrl(params)}`); | ||
const driver = pupUniDriver({ | ||
page, | ||
selector: 'body' | ||
}); | ||
await page.goto(`http://localhost:${port}${getTestAppUrl(params)}`); | ||
const driver = pupUniDriver({ | ||
page, | ||
selector: 'body', | ||
}); | ||
|
||
const tearDown = async () => {}; | ||
const tearDown = async () => {}; | ||
|
||
return {driver, tearDown}; | ||
return { driver, tearDown }; | ||
}; | ||
|
||
describe('puppeteer', () => { | ||
runTestSuite({setup, before, after}); | ||
runTestSuite({ setup, before: beforeFn, after: afterFn }); | ||
}); | ||
|
||
describe('puppeteer specific tests', () => { | ||
|
||
before(beforeFn); | ||
after(afterFn); | ||
describe('enterValue', () => { | ||
it(`doesn't attempt to clear value when shouldClear is false`, async () => { | ||
const { driver } = await setup({ items: [], initialText: 'hello' }); | ||
await driver | ||
.$('header input') | ||
.enterValue(' world!', { shouldClear: false }); | ||
assert.equal(await driver.$('header input').value(), 'hello world!'); | ||
}); | ||
}); | ||
}); |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are 3 clicks needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
segment-boneyard/nightmare#810 (comment)
Triple click selects all input content