Skip to content

test(Transition): more test transition #1151

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

Merged
merged 6 commits into from
Jun 25, 2020
Merged

Conversation

underfin
Copy link
Member

@underfin underfin commented May 9, 2020

No description provided.

@underfin
Copy link
Member Author

underfin commented May 9, 2020

When I add transiton test.It always fail down in me local dev.So its is slow with add test. and it lead me to confused with diff the behavior with v2.So I want to get some help to improve it.

other.
When test the dom element with spy called argments.I get "{}".
When I get use page().evalate(()=> document.getelementbyid()),sometime is "{}", sometimes is "{_leavecb:{}}", or anther similar something.
I want to get some suitable suggestion to relsove this.
My idea is only check it is equal and ignore other property.

@yyx990803
Copy link
Member

The reason your tests were failing inconsistently is because we are testing by talking to Puppeteer so everything is async and may or may not be longer than the actual microtask inside Puppeteer. So when you await click('button'), the microtask may have already fired so you won't be able get the transition start state.

The way to fix that is by running the whole click -> wait for microtask tick -> get transition start classname procedures directly inside the Puppeteer browser by using page().evaluate. This guarantees consistent results.

Another thing is the nextFrame you were using is using the JSDOM requestAnimationFrame, which is not actually the requestAnimationFrame in the Puppeteer browser.

@yyx990803
Copy link
Member

See 9d111f5 for the fixed version.

@underfin
Copy link
Member Author

underfin commented May 13, 2020

Todo:
1.some test has bugs and I will commit pr and update test
2.test hooks called with arguments and transition element class state.I don't have correct solution. And this need your some help.

])
// todo test event with arguments. Note: not get dom, get object. '{}'
expect(beforeLeaveSpy).toBeCalled()
expect(onLeaveSpy).not.toBeCalled()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's here.Should test hooks arguments.It will be meet error when i use expect(beforeLeaveSpy).toBeCalledWith(await page().evaluate(() => // get dom)).I don't has right way.

@yyx990803 yyx990803 merged commit b3bdd70 into vuejs:master Jun 25, 2020
@underfin underfin deleted the transition-1 branch June 26, 2020 01:37
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.

2 participants