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
execution: | |
steps: | |
- parallel: | |
- step: | |
name: run1 | |
identifier: run1 | |
type: Run | |
spec: | |
connectorRef: myDockerConnector | |
image: myorg/cypress-test:run-<+pipeline.sequenceId> |
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
serviceDependencies: | |
- identifier: Cypress_Server | |
name: Cypress Server | |
type: Service | |
spec: | |
connectorRef: myDockerConnector | |
image: myorg/cypress-test:run-<+pipeline.sequenceId> |
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
# reference https://docs.cypress.io/guides/continuous-integration/introduction#Xvfb | |
Xvfb -screen 0 1024x768x24 :8099 & | |
# start the mock node server | |
node /opt/cypress/server.js |
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
FROM cypress/browsers:node14.16.0-chrome90-ff88 | |
WORKDIR /opt/cypress | |
# copy the built app | |
COPY dist /opt/app | |
# copy cypress folder | |
COPY cypress /opt/cypress |
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
execution: | |
steps: | |
- step: | |
type: Run | |
name: Build | |
identifier: Build | |
spec: | |
connectorRef: myDockerConnector | |
image: node:16 | |
shell: Sh |
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
import React from "react"; | |
import { useLocaleStrings, LocaleString } from "./StringsContext"; | |
export default function HomePage(): React.ReactElement { | |
const { getString } = useLocaleStrings(); | |
return ( | |
<div> | |
<h1>Home</h1> | |
- <p>{getString("homePageContent.para1")}</p> |
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
# strings.yaml | |
homePageContent: | |
para1: | | |
+ Hello {{name}} | |
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquam, eos | |
animi. Corporis harum quaerat dicta possimus illum aut unde laborum | |
excepturi suscipit quibusdam perspiciatis dolorum alias, exercitationem | |
similique illo? Distinctio. | |
para2: | | |
+ Hello {{name}} |
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
// StringsContext.tsx | |
+ import mustache from "mustache"; | |
export interface UseLocaleStringsReturn { | |
- getString(key: string): string; | |
+ getString(key: string, variables?: any): string; | |
} | |
export function useLocaleStrings() { | |
const strings = useStringsContext(); |
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
// HomePage.tsx | |
import React from "react"; | |
- import { useLocaleStrings } from "./StringsContext"; | |
+ import { useLocaleStrings, LocaleString } from "./StringsContext"; | |
export default function HomePage(): React.ReactElement { | |
const { getString } = useLocaleStrings(); | |
return ( | |
<div> | |
<h1>Home</h1> | |
<p>{getString("homePageContent.para1")}</p> |
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
// StringsContext.tsx | |
export interface LocaleStringProps extends React.HTMLAttributes<any> { | |
strKey: string; | |
as?: keyof JSX.IntrinsicElements; | |
} | |
export function LocaleString(props: LocaleStringProps): React.ReactElement { | |
const { strKey, as, ...rest } = props; | |
const { getString } = useLocaleStrings(); | |
const Component = as || "span"; |
NewerOlder