Skip to content

Commit

Permalink
chore: remove cypress dependency (frappe#144)
Browse files Browse the repository at this point in the history
- use frappe's on-demand cypress installation
- add retries
- setup redisearch
  • Loading branch information
netchampfaris authored Nov 6, 2022
1 parent d88280a commit a0eb548
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/helper/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ echo "Setting Up Procfile..."
sed -i 's/^watch:/# watch:/g' Procfile
sed -i 's/^schedule:/# schedule:/g' Procfile

echo "Setting up redisearch module..."
echo "loadmodule ${GITHUB_WORKSPACE}/.github/helper/redisearch.so" >> ./config/redis_cache.conf
chmod +x "${GITHUB_WORKSPACE}/.github/helper/redisearch.so"
cat ./config/redis_cache.conf

echo "Starting Bench..."

bench start &> bench_start.log &
Expand All @@ -42,6 +47,7 @@ build_pid=$!

bench --site gameplan.test reinstall --yes
bench --site gameplan.test install-app gameplan
bench --site gameplan.test execute gameplan.gameplan.doctype.team_discussion.search.rebuild_index_if_not_exists

# wait till assets are built succesfully
wait $build_pid
6 changes: 5 additions & 1 deletion .github/helper/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ set -e

echo "Setting Up System Dependencies..."

# redis repository
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list

sudo apt update
sudo apt install libcups2-dev redis-server mariadb-client-10.3
sudo apt install libcups2-dev redis mariadb-client-10.3

install_wkhtmltopdf() {
wget -q https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
Expand Down
Binary file added .github/helper/redisearch.so
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/workflows/ui-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ jobs:
bench --site gameplan.test execute frappe.tests.ui_test_helpers.create_test_user
- name: UI Tests
run: cd ~/frappe-bench/apps/gameplan/frontend && yarn test
run: cd ~/frappe-bench && bench --site gameplan.test run-ui-tests gameplan --headless
env:
CYPRESS_BASE_URL: http://gameplan.test:8000
CYPRESS_RECORD_KEY: 9c23c39a-b56b-46d5-b673-44faf1f1da83

- name: Stop server
run: |
Expand All @@ -108,4 +109,3 @@ jobs:
- name: Show bench output
if: ${{ always() }}
run: cat ~/frappe-bench/bench_start.log || true

4 changes: 4 additions & 0 deletions frontend/cypress.config.js → cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ module.exports = defineConfig({
baseUrl: 'http://gameplan-demo.test:8000',
adminPassword: 'admin',
},
retries: {
runMode: 2,
openMode: 0,
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ describe('Comment', () => {
).should('exist')

// delete comment
cy.intercept({
method: 'POST',
url: '/api/method/frappe.client.set_value',
}).as('deleteComment')
cy.get(
`div[data-id=${comment.name}] button[aria-label="Comment Options"]`
).click()
cy.button('Delete').click()
cy.dialog('button:contains("Delete")').click()
cy.wait('@deleteComment')
cy.get(`div[data-id=${comment.name}]`)
.contains('This message is deleted')
.should('exist')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit a0eb548

Please sign in to comment.