Created
December 6, 2020 14:57
-
-
Save ssddi456/22ee39df325c37b74288e01cb0b14b93 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
TEST_FOLDER=$1 || "./e2e" | |
PATH_01=("${TEST_FOLDER}/cypress.json" "{ \"video\": false }\n") | |
PATH_02=("${TEST_FOLDER}/cypress/integration") | |
PATH_03=("${TEST_FOLDER}/cypress/integration/example.test.js" "context('Example', () => {\n beforeEach(() => { cy.visit('/'); });\n\n it('should have loaded', () => {\n cy.get('title').contains(/.*/);\n });\n});\n") | |
scaffold=(PATH_01[@] PATH_02[@] PATH_03[@]) | |
if [ ! -f "${!scaffold[0]:0:1}" ]; then | |
echo "[SCAFFOLD] Cypress test directory" | |
length=${#scaffold[@]} | |
for ((i=0; i<$length; i++)); do | |
path="${!scaffold[i]:0:1}" | |
contents="${!scaffold[i]:1:1}" | |
if [[ "${contents}" != "" ]]; then printf "${contents}" > "${path}"; else mkdir -p "${path}"; fi | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment