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 12, 2025
1 parent 9a39ea0 commit 9392ca6
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 6 deletions.
5 changes: 3 additions & 2 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 Down Expand Up @@ -50,7 +51,7 @@ 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
- name: Build themes
run: |
Expand Down Expand Up @@ -114,7 +115,7 @@ 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
- name: Upload Cypress Screenshots
Expand Down
37 changes: 37 additions & 0 deletions config/ProjectConfiguration.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
<?php
function docklog($message = "", $value = "")
{
if ($value != null) {
file_put_contents("php://stdout", $message.": ");
if (is_string($value)) {
file_put_contents("php://stdout", $value);
} else if (is_bool($value)) {
file_put_contents("php://stdout", $value ? "true" : "false");
} else {
file_put_contents("php://stdout", json_encode($value));
}
} else {
file_put_contents("php://stdout", json_encode($message));
}
$linebreak = "\n";
file_put_contents("php://stdout", $linebreak);
}

function prodlog($message = "", $value = "")
{
$logFile = "./log/qubit_prod.log";

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

error_log("PROD 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])
)
})
})
})
2 changes: 1 addition & 1 deletion docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ services:
gearmand:
image: artefactual/gearmand
ports:
- "127.0.0.1:63005:4730"
- "127.0.0.1:4730:4730"
1 change: 1 addition & 0 deletions vendor/net_gearman/Net/Gearman/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class Net_Gearman_Client
*/
public function __construct($servers, $timeout = 1000)
{
prodlog('servers', $servers);
if (!is_array($servers) && strlen($servers) > 0) {
$servers = array($servers);
} elseif (is_array($servers) && !count($servers)) {
Expand Down

0 comments on commit 9392ca6

Please sign in to comment.