Skip to content
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

2.1.0 #95

Open
wants to merge 55 commits into
base: jasminewd1
Choose a base branch
from
Open

2.1.0 #95

wants to merge 55 commits into from

Conversation

FarazGolshahii
Copy link

add feture

hankduan and others added 30 commits January 5, 2015 12:32
Add some console logging, remove useless info about the last running
task in the control flow, and fix error where problems reported
from done.fail were getting pushed into the following spec.

Closes #18
Test wrapping for Jasmine 2 now more closely follows the test wrapping
for Mocha at https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/testing/index.js

This also adds more information to the task names in the control flow,
for easier debugging.
Note: this means that using `this.addMatchers` no longer works inside
before blocks or specs. It should have been changed to `jamsine.addMatchers`
since the upgrade to Jasmine 2. It was still working by accident up until
the previous commit.
Update selenium-webdriver to 2.47.0 from 2.45.1.
This update introduces a convoluted situation where some tests in
Proractor's suite would hang - see angular/protractor#2245

This change includes a fix for those issues which removes the explicit
`flow.execute` wrapper around `expect` calls. This appears not to introduce
any issues to existing tests.
… queue

Instead, expectations without promises in either expected or actual
are unchanged from the original Jasmine implementation.

See angular/protractor#2894
Latest selenium-webdriver no longer supports node 0.12.
Stop testing on it.
Fixex angular/protractor#3505, which was caused by Protractor and
Jasminewd finding different webdriver instances through require(), and
thus using different ControlFlows.
cnishina and others added 25 commits October 27, 2016 18:30
- isPromise checks to see if the input parameter has a then method
- Deferred class has a promise property and no longer has a then method
fix test "should wait till the expect to run the flow"

- `isPending` exists but it is no longer part of `ManagedPromise`
- `isPending` also is no longer exported in `lib/promise.js`
- wrote an `isPending` similar to selenium-webdriver in common.js

require a minimum node version

- selenium-webdriver 3.0.0 requires node >= 6.9.0
- update travis test to use node 6
* Fix undefined variable testFn

this causes jasminewd2 to be incompatible with strict mode.

* fix variable definition style
…72)

There are three major ways this was done in this change:
* In `callWhenIdle`, if `flow.isIdle` is not defined, we assume we are working
  with a `SimpleScheduler` instance, and so the flow is effectively idle.
* In `initJasmineWd`, if `flow.reset` is not defined, we assume we are working
  with a `SimpleScheduler` instance, and so don't bother resetting the flow.
* In `wrapInControlFlow`, we use `flow.promise` to create a new promise if
  possible.  Since `new webdriver.promise.Promise()` would have always made a
  `ManagedPromise`, but `flow.promise` will do the right thing.
* In `wrapCompare`, we avoid the webdriver library entirely, and never instance
  any extra promises. Using `webdriver.promise.when` and `webdriver.promise.all`
  could have been a problem if our instance of `webdriver` had the control flow
  turned on, but another instance somewhere did not (or even the same instance,
  but just at a different point in time).  Instead we use the new `maybePromise`
  tool, which is a mess but is also exactly what we want.
* In `specs/*`, we replace `webdriver.promise.fulfilled` with
  `webdriver.promise.when`.
* In `specs/*`, a new version of `adapterSpec.js` and `errorSpec.js` are
  created: `asyncAwaitAdapterSpec.ts` and `asyncAwaitErrorSpec.ts`.

I also also fixed a minor bug where we weren't correctly checking for promises
inside an array of expected results.  Before we had

```js
expected = Array.prototype.slice.call(arguments, 0)

...

webdriver.promise.isPromise(expected)
```

I thought about it for a little while, and there's no way that's correct.
`expected` is an `Array<any>`, there's no way it has a `.then` function.

Closes #69
…ctions (#82)

While we support `SELENIUM_PROMISE_MANAGER=0` already, we rely on `SimpleScheduler` and some other
utility functions which will be going away after the control flow has been fully deprecated.  This
commit allows jasminewd to work without those utility functions, and even allows people to pass
jasminewd their own custom scheduler implementation.

This does not fix our tests, which will also break when those utility functions go away.  See
#81

Closes #80
…)` instead of using `require()` (#83)

So where as before you would write:

```js
require('jasminewd').init(webdriver.promise.controlFlow());
```

Now you will write:

```js
require('jasminewd').init(webdriver.promise.controlFlow(), webdriver);
```

This removes the dependency on `selenium-webdriver` and protects jasminewd from having a different
webdriver instance than Protractor, which could be a huge problem if they had different control flow
settings.

This is a breaking change because it changes the API for the `init` function.

I also removed the dependency on jasmine, which didn't do anything anyway.  Maybe it should have
been a peerDependency but those are deprecated.
It was confusing having `master` refer to the branch for the old version of
jasmine.  I'm not moving `jasminewd2` to `master` though because that could
make old links very confusing.
In Node v7, Object.prototype.toString.call(async function(){}) returns '[object AsyncFunction]'
This makes the check more robust by using typeof
In case the matcher assigns a promise to the "pass" property, it wasn't possible to distinguish between positive and negative expectations to form a correct failure message. After this change a function taking an "isNot" argument and returning a failure message can be specified. Since it's called only when the matcher fails, there is enough information to produce that message.
@google-cla
Copy link

google-cla bot commented Jun 12, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.