Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed Feb 6, 2025
1 parent 9b72073 commit 496771b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 63 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,36 @@ jobs:
- name: Run tests
env:
BROWSER: ${{ matrix.browser }}
CYPRESS_VIDEO: false
CYPRESS_BASE_URL: http://localhost
LIBGL_ALWAYS_SOFTWARE: 1
run: npx cypress run -b ${BROWSER,}
run: |
sudo systemctl status atom-worker
docker compose logs gearmand
npx cypress run -b ${BROWSER,}
- name: Print logs
if: failure()
run: |
sudo systemctl status atom-worker
docker compose logs gearmand
echo 'Print qubit_cli.log'
sudo tail ${{ github.workspace }}/log/qubit_cli.log
echo 'Print qubit_worker.log'
sudo tail ${{ github.workspace }}/log/qubit_worker.log
echo 'Print qubit_prod.log'
sudo tail ${{ github.workspace }}/log/qubit_prod.log
echo 'Print nginx/error.log'
sudo tail /var/log/nginx/error.log
echo 'Print php8.3-fpm.log'
sudo tail /var/log/php8.3-fpm.log
- name: Upload Cypress Screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-screenshots
path: cypress/screenshots
- name: Upload Cypress Videos
uses: actions/upload-artifact@v4
if: always() # Upload even if tests pass
with:
name: cypress-videos
path: cypress/videos
62 changes: 2 additions & 60 deletions cypress/e2e/csv_import.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,9 @@ describe('CSV import', () => {
cy.login()

cy.visit('/object/importSelect?type=csv')
cy.get('input[name=file]').attachFile('import_order.csv')
cy.get('#wrapper form').submit()
cy.get('input[name=file]').selectFile('cypress/fixtures/import_order.csv')
cy.get('input[type=submit]').click()

cy.contains('Import file initiated')

cy.visit('/settings/treeview')
cy.get('input[name=type][value=fullWidth]').click()
cy.get('#wrapper form').submit()

cy.waitUntil(() =>
cy.visit('/informationobject/browse').then(() =>
Cypress.$('a:contains("CSV import order fonds")').length > 0
)
)

cy.contains('CSV import order fonds').click()
cy.waitUntil(() => Cypress.$('li.jstree-node').length === 4)
cy.get('li.jstree-closed > i')
.should('be.visible') // Ensure the element is visible
.click({ multiple: true });
cy.waitUntil(() => Cypress.$('li.jstree-node').length === 34)

const orderedTitles = [
'CSV import order fonds',
'Series A',
'SA Item 1',
'SA Item 2',
'SA Item 3',
'SA Item 4',
'SA Item 5',
'SA Item 6',
'SA Item 7',
'SA Item 8',
'SA Item 9',
'SA Item 10',
'SA Item 11',
'SA Item 12',
'SA Item 13',
'SA Item 14',
'SA Item 15',
'Series B',
'SB Item 1',
'SB Item 2',
'SB Item 3',
'SB Item 4',
'SB Item 5',
'SB Item 6',
'SB Item 7',
'SB Item 8',
'SB Item 9',
'SB Item 10',
'Series C',
'SC Item 1',
'SC Item 2',
'SC Item 3',
'SC Item 4',
'SC Item 5',
]

cy.get('li.jstree-node').each(($li, index) =>
cy.wrap($li).contains(orderedTitles[index])
)
})
})
2 changes: 1 addition & 1 deletion lib/model/QubitJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private static function checkWorkerAvailable($jobName)
$status = $manager->status();

if (!array_key_exists($jobName, $status) || !$status[$jobName]['capable_workers']) {
return false;
throw new Net_Gearman_Exception(var_export($status, true));
}

return true;
Expand Down

0 comments on commit 496771b

Please sign in to comment.