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

BeforeSuite and AfterSuite implement #231

Merged
merged 11 commits into from Oct 2, 2016
Merged

BeforeSuite and AfterSuite implement #231

merged 11 commits into from Oct 2, 2016

Conversation

APshenkin
Copy link
Collaborator

@APshenkin APshenkin commented Sep 21, 2016

For #232

@DavertMik
Copy link
Contributor

DavertMik commented Sep 21, 2016

Thank you. I will need some time to have a deep look. So this is Work In Progress?

@APshenkin
Copy link
Collaborator Author

APshenkin commented Sep 22, 2016

@DavertMik Yes. This enhancement is "In progress". I have problem with AfterSuite hook, when any scenario was failed during test run. Please check #232

@APshenkin
Copy link
Collaborator Author

APshenkin commented Sep 22, 2016

@DavertMik Looks like I fixed the issue with AfterSuite Hook. Now it works! Please review.
Any suggestions will be interesting.

BTW tested with WebdriverIO helper on Windows

@APshenkin
Copy link
Collaborator Author

APshenkin commented Sep 23, 2016

@DavertMik When you will be able to check this changes? Looks like it's working!

@DavertMik
Copy link
Contributor

DavertMik commented Sep 23, 2016

That's really cool. I hope I will have a time to review and merge it after the weekend. Thanks for your work.

@DavertMik
Copy link
Contributor

DavertMik commented Sep 23, 2016

What I need from you is an example of usage of this feature so I could document it.
If you can, please add some real life sample. Why you needed this feature.

@APshenkin
Copy link
Collaborator Author

APshenkin commented Sep 26, 2016

@DavertMik
Here is sample from my real life:)
During tests I use webdrivercss to test CSS https://github.com/webdriverio/webdrivercss . So for this I need reference screenshots. It's very expensive, to save all screenshots to repository, because the repository will be too large and also during tests run you don't need all screenshots. Because of this I use the remote server to save screenshots. Before tests I have to download them and during scenarios I check the CSS using these screenshots. And after test suite I upload difference to remote server.

Also You can use these feature, If your web application has any integration with client application. E.g. web application connects to client application in my project using Websockets to send/get information about installed apps(games) and statuses about installation on PC. Also webapplication calls client app to launch the game. So in my web tests sometimes I need to install different versions of client app for tests (with different settings) to check that everything works well. But I don't need to reinstall app after each test or one time (on launching tests). Because of this BeforeSuite|AfterSuite are best for me

@DavertMik
Copy link
Contributor

DavertMik commented Oct 2, 2016

Thank you very much! That was awesome work

@DavertMik DavertMik merged commit 0ee1efc into codeceptjs:master Oct 2, 2016
@DavertMik
Copy link
Contributor

DavertMik commented Oct 2, 2016

Just a question BeforeSuite will work for all files in suite or only for a file where it was declared?

@DavertMik
Copy link
Contributor

DavertMik commented Oct 2, 2016

Ok, I didn't come to a better way to write about it than to cite you on site http://codecept.io/basics/#beforeSuite

If you think this can be improved, please edit https://github.com/Codeception/CodeceptJS/blob/master/docs/basics.md

@APshenkin
Copy link
Collaborator Author

APshenkin commented Oct 3, 2016

@DavertMik Only for a file, where it was declared.

BTW, beforeSuite and afterSuite have access to I object. here is a sample from my tests:

BeforeSuite((I) => {
    I.syncDown('4game-referral-system', 'acc-1-qa-auth-referral');
});

note: I create custom handler in my custom helper to sync files from remote server. It'works as usual I function. But in BeforeSuite/AfterSuite you don't have an access to browser because it's not running in this moment. Will update the docs and send new PR

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

Successfully merging this pull request may close these issues.

None yet

2 participants