Skip to content

Commit

Permalink
Fix flakey tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavies committed Apr 26, 2018
1 parent 435f430 commit 216e9f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions test/browser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ describe('browser', () => {

it('should change the date when a date is clicked', async () => {
await driver.executeScript(`
document.write('<input class="my-modal" value="4/5/2006" />');
TinyDatePicker('.my-modal');
document.write('<input class="click-test" value="4/5/2006" />');
TinyDatePicker('.click-test');
`);
const el = await driver.findElement(By.css('.my-modal')).click();
const days = await driver.findElements(By.css('.dp-day:not(.dp-edge-day)'));
Array.from(days)[7].click();
const el = await driver.findElement(By.css('.click-test')).click();
const day = await driver.findElement(By.css('[data-date="1144468800000"]'));
day.click();
await driver.wait(untilRemoved('.dp-modal'));
const val = await driver.findElement(By.css('.my-modal')).getAttribute('value');
const val = await driver.findElement(By.css('.click-test')).getAttribute('value');

expect(val).toEqual('4/8/2006');
});
Expand Down
2 changes: 1 addition & 1 deletion test/date-manip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('date-manip', () => {
describe('setMonth', () => {
it('does not mutate the date', () => {
const dt = now();
const next = setMonth(dt, 3);
const next = setMonth(dt, (dt.getMonth() + 1) % 12);

expect(datesEq(dt, next)).toBeFalsy();
});
Expand Down

0 comments on commit 216e9f0

Please sign in to comment.