adobe / aem-project-archetype

Maven template to create best-practice websites on AEM.
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html
Apache License 2.0
544 stars 419 forks source link

Enforce local build of ui-tests module by default #1173

Closed kwin closed 5 months ago

kwin commented 7 months ago

Currently the submodule within ui-tests (e.g. either https://github.com/adobe/aem-project-archetype/tree/develop/src/main/archetype/ui.tests.wdio/test-module or https://github.com/adobe/aem-project-archetype/tree/develop/src/main/archetype/ui.tests.cypress/test-module) are only built through the special profiles. Those profiles either require Docker to be installed and/or Selenium and AEM running.

For regular local and pre Cloud Manager CI builds those conditions are usually not fulfilled therefore the profiles are not set and this module is not checked at all.

There should be a dedicated profile (active by default) which just builds/checks the tests with the frontend-maven-plugin but without actually executing them.

This is similar to what is provided in https://github.com/adobe/aem-project-archetype/blob/ea3b2b862ab9299008233b47264ceb9940bbb266/src/main/archetype/ui.tests.wdio/pom.xml#L107 but without the execution part and being active by default.

buuhuu commented 6 months ago

@dulvac something you could look into?

dulvac commented 6 months ago

@kwin , thanks for bringing this up. IIUC, you'd like the ui test modules themselves to be built when building with maven, in order to catch any build errors locally, when executing a maven build on e.g. the whole archetype. Did I get it right?

kwin commented 6 months ago

@dulvac That is correct

dulvac commented 6 months ago

@kwin , sorry for the delay. I had a look at this today and I came to the realization that I'm not sure what you need. The ui tests being javascript, there's no build. Also, idk what a check would be for e.g. cypress. What would be the npm command that we would run as part of the maven build?

kwin commented 6 months ago

I was assuming that something like node --check could be used (https://nodejs.org/api/cli.html#-c---check)

dulvac commented 6 months ago

Yeah, but that doesn't catch much at all. For example, adding a random string wrongtoken to a random line doesn't throw any error. The only thing it catches is stuff like unclosed brackets

dulvac commented 6 months ago

Ok, I think the best thing to do is to run eslint. This seems to be working best. I'll add that for both js modules.

dulvac commented 5 months ago

@kwin sorry for the delay. This fell off the radar for a bit. Should be fixed now