qwik icon indicating copy to clipboard operation
qwik copied to clipboard

feat: Add qwik add command for Nightwatch.

Open garg3133 opened this issue 1 year ago • 11 comments

Overview

Add an integration for Nightwatch, an e2e testing framework that allows users to run their tests against real browsers.

What is it?

  • [x] Feature / enhancement
  • [ ] Bug
  • [ ] Docs / tests / types / typos

Description

Add a starter for Nightwatch integration.

Use cases and why

    1. Allows users to write and run e2e tests against real browsers on both desktop and mobile platforms.
    1. Serves as an alternative to Playwright for e2e testing.

Checklist:

  • [ ] My code follows the developer guidelines of this project
  • [ ] I have performed a self-review of my own code
  • [ ] I have made corresponding changes to the documentation
  • [ ] Added new tests to cover the fix / functionality

/cc: @AutomatedTester

garg3133 avatar May 30 '24 14:05 garg3133

Deploy request for qwik-insights rejected.

Name Link
Latest commit 4c07d1894a3146db5cf951d8107df78c6dad8187

netlify[bot] avatar May 30 '24 14:05 netlify[bot]

One question I had for the maintainers here, whenever we add an integration to the Qwik project that comes with a bunch of .ts files, all the TypeScript files show the following error:

image

(the above screenshot is from the Playwright integration)

How can we fix this?

garg3133 avatar May 30 '24 14:05 garg3133

Hi @garg3133 Thanks for this PR, can you add few test examples pls? eg. signals, input etc. etc.

gioboa avatar Jun 22 '24 15:06 gioboa

Ohh didn't realize I forgot to push the example file. Thanks!

garg3133 avatar Jun 24 '24 20:06 garg3133

@gioboa I've added the example test.

garg3133 avatar Jun 24 '24 20:06 garg3133

Thanks @garg3133 I tried the integration and I have this error with pnpm test.e2e

> nightwatch ./test

│   cannot read external global file using "nightwatch/globals.js"                                                      
│   Cannot find package 'chalk' imported from <my-folder>/nightwatch/globals.js 
│   Did you mean to import [email protected]/node_modules/chalk/source/index.js?                                              

 ELIFECYCLE  Command failed with exit code 10.

Am I missing something?

gioboa avatar Jun 24 '24 22:06 gioboa

This is strange because chalk is a dependency of nightwatch, so if you've installed nightwatch you should have chalk as well.

How can I test this integration locally myself? How I've created this PR is by creating a new Qwik project using pnpm create qwik, adding the required files and dependencies for Nightwatch in it (and making sure it runs) and then copying the added files to this repository.

garg3133 avatar Jun 25 '24 05:06 garg3133

you can build the Qwik core with pnpm build.core and then in a new project you can use these dependencies

"@builder.io/qwik": "file:<your-path-here>/qwik/packages/qwik/dist",
"@builder.io/qwik-city": "file:<your-path-here>/qwik/packages/qwik-city/lib",

Install the new deps and then you can run pnpm qwik add to run the Qwik CLI.

The CLI is a small part of Qwik package but I usually build and link everything to avoid clashes.

gioboa avatar Jun 25 '24 06:06 gioboa

So, here are the steps I followed:

  • Create a new Qwik project using pnpm create qwik.
  • Change the version for qwik and qwik-city in package.json to the file: paths as mentioned above.
  • Run pnpm install
  • Run pnpm qwik add nightwatch
  • Run pnpm test.e2e.

And the test runs perfectly fine for me.

garg3133 avatar Jun 25 '24 06:06 garg3133

I see, thanks. @thejackshelton are you able to run it? Maybe my local environment is not perfectly configured.

gioboa avatar Jun 25 '24 06:06 gioboa

Thanks a lot @garg3133 !

We're planning to move integrations into community plugins under the "QwikCommunity" org so we could share the maintenance work with community plugin maintainers.

It's first pending that we'll implement this QwikDev/qwik-evolution#20 and after that it'll be easy to make sure this will be created as a plugin.

So I'm keeping this PR opened until we'll implement the plugin system

Thanks again! 🙏

shairez avatar Jul 09 '24 20:07 shairez