-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1229 from Bolo89/refacto-common-cypress
Add cypress in common client
- Loading branch information
Showing
44 changed files
with
817 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...ech/jhipster/lite/generator/client/common/application/ClientCommonApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package tech.jhipster.lite.generator.client.common.application; | ||
|
||
import org.springframework.stereotype.Service; | ||
import tech.jhipster.lite.generator.client.common.domain.ClientCommonService; | ||
import tech.jhipster.lite.generator.project.domain.Project; | ||
|
||
@Service | ||
public class ClientCommonApplicationService { | ||
|
||
private final ClientCommonService clientCommonService; | ||
|
||
public ClientCommonApplicationService(ClientCommonService clientCommonService) { | ||
this.clientCommonService = clientCommonService; | ||
} | ||
|
||
public void excludeInTsconfigJson(Project project, String value) { | ||
clientCommonService.excludeInTsconfigJson(project, value); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ain/java/tech/jhipster/lite/generator/client/common/domain/ClientCommonDomainService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package tech.jhipster.lite.generator.client.common.domain; | ||
|
||
import static tech.jhipster.lite.common.domain.FileUtils.getPath; | ||
import static tech.jhipster.lite.common.domain.FileUtils.read; | ||
import static tech.jhipster.lite.generator.project.domain.Constants.TSCONFIG_JSON; | ||
|
||
import java.io.IOException; | ||
import tech.jhipster.lite.common.domain.JsonUtils; | ||
import tech.jhipster.lite.error.domain.GeneratorException; | ||
import tech.jhipster.lite.generator.project.domain.Project; | ||
import tech.jhipster.lite.generator.project.domain.ProjectRepository; | ||
|
||
public class ClientCommonDomainService implements ClientCommonService { | ||
|
||
private final ProjectRepository projectRepository; | ||
|
||
public ClientCommonDomainService(ProjectRepository projectRepository) { | ||
this.projectRepository = projectRepository; | ||
} | ||
|
||
@Override | ||
public void excludeInTsconfigJson(Project project, String value) { | ||
String tsConfigFilePath = getPath(project.getFolder(), TSCONFIG_JSON); | ||
String tsConfigContent; | ||
try { | ||
tsConfigContent = read(tsConfigFilePath); | ||
} catch (IOException e) { | ||
throw new GeneratorException("Cannot read tsconfig " + tsConfigFilePath + ": " + e.getMessage()); | ||
} | ||
|
||
String updatedTsConfigContent = JsonUtils.addValueInArray("exclude", value, tsConfigContent); | ||
projectRepository.write(project, updatedTsConfigContent, ".", TSCONFIG_JSON); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/tech/jhipster/lite/generator/client/common/domain/ClientCommonService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package tech.jhipster.lite.generator.client.common.domain; | ||
|
||
import tech.jhipster.lite.generator.project.domain.Project; | ||
|
||
public interface ClientCommonService { | ||
void excludeInTsconfigJson(Project project, String value); | ||
} |
22 changes: 22 additions & 0 deletions
22
...h/jhipster/lite/generator/client/common/infrastructure/ClientCommonBeanConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package tech.jhipster.lite.generator.client.common.infrastructure; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import tech.jhipster.lite.generator.client.common.domain.ClientCommonDomainService; | ||
import tech.jhipster.lite.generator.client.common.domain.ClientCommonService; | ||
import tech.jhipster.lite.generator.project.domain.ProjectRepository; | ||
|
||
@Configuration | ||
public class ClientCommonBeanConfiguration { | ||
|
||
private final ProjectRepository projectRepository; | ||
|
||
public ClientCommonBeanConfiguration(ProjectRepository projectRepository) { | ||
this.projectRepository = projectRepository; | ||
} | ||
|
||
@Bean | ||
public ClientCommonService clientCommonService() { | ||
return new ClientCommonDomainService(projectRepository); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/main/java/tech/jhipster/lite/generator/client/common/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@tech.jhipster.lite.SharedKernel | ||
package tech.jhipster.lite.generator.client.common; |
19 changes: 0 additions & 19 deletions
19
...pster/lite/generator/client/react/cypress/application/CypressReactApplicationService.java
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
src/main/java/tech/jhipster/lite/generator/client/react/cypress/domain/CypressReact.java
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
...a/tech/jhipster/lite/generator/client/react/cypress/domain/CypressReactDomainService.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...in/java/tech/jhipster/lite/generator/client/react/cypress/domain/CypressReactService.java
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...e/generator/client/react/cypress/infrastructure/config/CypressReactBeanConfiguration.java
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
src/main/java/tech/jhipster/lite/generator/client/react/cypress/package-info.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...h/jhipster/lite/generator/client/tools/cypress/application/CypressApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package tech.jhipster.lite.generator.client.tools.cypress.application; | ||
|
||
import org.springframework.stereotype.Service; | ||
import tech.jhipster.lite.generator.client.tools.cypress.domain.CypressService; | ||
import tech.jhipster.lite.generator.project.domain.Project; | ||
|
||
@Service | ||
public class CypressApplicationService { | ||
|
||
private final CypressService cypressService; | ||
|
||
public CypressApplicationService(CypressService cypressService) { | ||
this.cypressService = cypressService; | ||
} | ||
|
||
public void init(Project project) { | ||
cypressService.init(project); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/tech/jhipster/lite/generator/client/tools/cypress/domain/Cypress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package tech.jhipster.lite.generator.client.tools.cypress.domain; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class Cypress { | ||
|
||
private Cypress() {} | ||
|
||
public static final String JAVASCRIPT_INTEGRATION = "src/test/javascript/integration"; | ||
|
||
public static List<String> devDependencies() { | ||
return List.of("cypress", "eslint-plugin-cypress"); | ||
} | ||
|
||
public static Map<String, String> cypressScripts() { | ||
return Map.of( | ||
"e2e", | ||
"npm run test:component", | ||
"e2e:headless", | ||
"npm run test:component:headless", | ||
"test:component", | ||
"cypress open --config-file src/test/javascript/integration/cypress-config.json", | ||
"test:component:headless", | ||
"cypress run --headless --config-file src/test/javascript/integration/cypress-config.json" | ||
); | ||
} | ||
|
||
public static Map<String, String> cypressFiles() { | ||
String pathRoot = "src/test/javascript/integration"; | ||
return Map.ofEntries(Map.entry(".eslintrc.js", pathRoot), Map.entry("tsconfig.json", pathRoot)); | ||
} | ||
|
||
public static Map<String, String> cypressTestFiles() { | ||
String pathIntegrationTestPrimaryApp = "src/test/javascript/integration/common/primary/app"; | ||
|
||
return Map.ofEntries(Map.entry("Home.spec.ts", pathIntegrationTestPrimaryApp)); | ||
} | ||
|
||
public static List<String> tsconfigPatternsToExclude() { | ||
return List.of("src/test/javascript/integration/**/*spec.ts"); | ||
} | ||
} |
Oops, something went wrong.