This is just a technology testing project based on Create React App and TailwindCSS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hooks.js 1.0KB

12345678910111213141516171819202122232425262728293031
  1. /*eslint no-console: ["error", { allow: ["log"] }] */
  2. // Dependencies
  3. const { After, Before, AfterAll } = require('@cucumber/cucumber');
  4. const config = require('./config');
  5. const scope = require('./support/scope');
  6. // Here is where you might clean up database tables to have a clean slate before the tests run
  7. // Before(async () => {
  8. // });
  9. // Here we clean up the browser session
  10. After(async () => {
  11. if (scope.browser && scope.context.page) {
  12. const cookies = await scope.context.page.cookies();
  13. if (cookies && cookies.length > 0) {
  14. await scope.context.page.deleteCookie(...cookies);
  15. }
  16. if(config.close) {
  17. await scope.context.page.close();
  18. scope.context.page = null;
  19. }
  20. }
  21. });
  22. AfterAll(async () => {
  23. if (config.close && scope.browser) await scope.browser.close();
  24. // If you have your API and Web servers running, you can shut them down afterwards
  25. // scope.api.shutdown(() => console.log('\nAPI is shut down'));
  26. // scope.web.shutdown(() => console.log('Web is shut down'));
  27. });