Skip to content

Commit

Permalink
Test integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed Feb 11, 2025
1 parent 9a39ea0 commit 7016ec4
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 6 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- qa/**
- stable/**
- dev/integration-test-test
jobs:
integration-tests:
runs-on: ubuntu-24.04
Expand All @@ -22,6 +23,7 @@ jobs:
run: |
sudo sysctl -w vm.max_map_count=262144
docker compose up -d percona elasticsearch gearmand
docker compose ps
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -50,14 +52,16 @@ jobs:
run: sudo npm install -g npm && npm ci
- name: Modify Gearman config
run: |
echo -e "all:\n servers:\n default: 127.0.0.1:63005" \
echo -e "all:\n servers:\n default: 127.0.0.1:4730" \
> apps/qubit/config/gearman.yml
docker compose ps gearmand
- name: Build themes
run: |
sudo npm install -g "less@<4.0.0"
make -C plugins/arDominionPlugin
make -C plugins/arArchivesCanadaPlugin
npm run build
docker compose ps
- name: Run the installer
run: |
php symfony tools:install \
Expand All @@ -71,11 +75,13 @@ jobs:
--search-index=atom \
--demo \
--no-confirmation
docker compose ps
- name: Change filesystem permissions
run: |
sudo chown -R www-data:www-data ${{ github.workspace }}
sudo chmod 755 /home
sudo chmod 755 /home/runner
docker compose ps
- name: Start application services
run: |
sudo cp test/etc/fpm_conf /etc/php/8.3/fpm/pool.d/atom.conf
Expand All @@ -85,6 +91,7 @@ jobs:
sudo cp test/etc/worker_conf /usr/lib/systemd/system/atom-worker.service
sudo systemctl daemon-reload
sudo systemctl start atom-worker
docker compose ps
- name: Install and configure Nginx
run: |
sudo apt install nginx
Expand All @@ -93,6 +100,7 @@ jobs:
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginx
docker compose ps
- name: Create writable Cypress videos and screenshots dirs
run: |
sudo mkdir -p ${{ github.workspace }}/cypress/screenshots ${{ github.workspace }}/cypress/videos
Expand All @@ -103,7 +111,9 @@ jobs:
CYPRESS_VIDEO: false
CYPRESS_BASE_URL: http://localhost
LIBGL_ALWAYS_SOFTWARE: 1
run: npx cypress run -b ${BROWSER,}
run: |
docker compose ps gearmand
npx cypress run -b ${BROWSER,}
- name: Print logs
if: failure()
run: |
Expand All @@ -114,9 +124,13 @@ jobs:
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
sudo tail -n 30 /var/log/nginx/error.log
echo 'Print php8.3-fpm.log'
sudo tail /var/log/php8.3-fpm.log
echo 'Print gearmand log'
docker compose ps gearmand
sudo systemctl status atom-worker
sudo php symfony jobs:worker
- name: Upload Cypress Screenshots
uses: actions/upload-artifact@v4
if: always()
Expand Down
19 changes: 19 additions & 0 deletions config/ProjectConfiguration.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
<?php
function prodlog($message = "", $value = "")
{
$logFile = "./log/qubit_prod.log";

if ($value != null) {
$logMessage = $message.": ";
if (is_string($value)) {
$logMessage .= $value;
} elseif (is_bool($value)) {
$logMessage .= $value ? 'true' : 'false';
} else {
$logMessage .= json_encode($value);
}
} else {
$logMessage =json_encode($message);
}

error_log("DEV LOG: " . $logMessage . "\n", 3, $logFile);
}

/*
* This file is part of the Access to Memory (AtoM) software.
Expand Down
64 changes: 61 additions & 3 deletions cypress/e2e/csv_import.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,67 @@ describe('CSV import', () => {
cy.login()

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

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])
)
})
})
})

0 comments on commit 7016ec4

Please sign in to comment.