Skip to content

Commit

Permalink
Test compatibility fix (#4092)
Browse files Browse the repository at this point in the history
  • Loading branch information
walmazacn authored Dec 23, 2024
1 parent 07cd311 commit 0094d24
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
22 changes: 10 additions & 12 deletions container/cypress/e2e/test-app/compound/wc-compound-container.cy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
describe('Compound Container Tests', () => {
describe('LuigiClient API - LuigiCompoundContainer', () => {
const containerSelector = '[data-test-id="luigi-client-api-test-compound-01"]';
let consoleLog;
let stub;

beforeEach(() => {
cy.visit('http://localhost:8080/compound/compoundClientAPI.html', {
onBeforeLoad(win) {
// Set up a spy on console.log
cy.stub(win.console, 'log').as('consoleLogSpy');
cy.stub(win.console, 'log', (value) => {
consoleLog = value;
});
}
});
stub = cy.stub();
Expand Down Expand Up @@ -283,17 +286,12 @@ describe('Compound Container Tests', () => {
it('LuigiClient API publishEvent', () => {
cy.on('window:alert', stub);

cy.get(containerSelector)
.shadow()
.contains('Publish event')
.click()
.then(() => {
expect(stub.getCall(0)).to.be.calledWith('sendInput');
cy.get('@consoleLogSpy').should(
'be.calledWith',
'dataConverter(): Received Custom Message from "input1" MF My own event data'
);
});
cy.get(containerSelector).shadow().contains('Publish event').click();

cy.should(() => {
expect(stub.getCall(0)).to.be.calledWith('custom-message: sendInput');
expect(consoleLog).to.equal('dataConverter(): Received Custom Message from "input1" MF My own event data');
});
});

it('LuigiClient API uxManagerChainRequests', () => {
Expand Down
4 changes: 0 additions & 4 deletions container/test-app/assets/panelHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ class panelHeader extends LuigiElement {
});
}

afterInit(ctx) {
console.debug('after init', ctx);
}

render(ctx) {
return html`
<style>
Expand Down
2 changes: 1 addition & 1 deletion container/test-app/compound/compoundClientAPI.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ <h3>
);
compoundContainer.addEventListener(MFEventID.CUSTOM_MESSAGE, (event) => {
if (event.detail.id !== 'timer') {
alert(event.detail.id);
alert(MFEventID.CUSTOM_MESSAGE + ': ' + event.detail.id);
}
});

Expand Down
16 changes: 8 additions & 8 deletions scripts/testCompatibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ cd $BASE_DIR/../
source $BASE_DIR/shared/bashHelpers.sh

declare -a APP_FOLDERS=(
"/test/e2e-client-api-test-app"
"/test/e2e-test-application"
"/test/e2e-js-test-application"
"/test/e2e-test-application/externalMf"
"test/e2e-client-api-test-app"
"test/e2e-test-application"
"test/e2e-js-test-application"
"test/e2e-test-application/externalMf"
)

# Used for setting up webserver and killing them
Expand Down Expand Up @@ -183,7 +183,7 @@ checkoutLuigiToTestfolder() {
echoe "Checking out selected release tag $TAG"
git checkout tags/$TAG
for FOLDER in "${APP_FOLDERS[@]}"; do
echoe "Installing app $FOLDER"
echoe "Installing app $FOLDER in $LUIGI_DIR_TESTING"
cd $LUIGI_DIR_TESTING/$FOLDER
npm i
done
Expand Down Expand Up @@ -256,12 +256,12 @@ verifyAndStartWebserver() {
for i in "${!APP_FOLDERS[@]}"; do
echoe "Run app webserver on ${APP_PORTS[$i]}"
cd $LUIGI_DIR_TESTING/${APP_FOLDERS[$i]}
if [ "${APP_FOLDERS[$i]}" == "/test/e2e-test-application/externalMf" ]; then
if [ "${APP_FOLDERS[$i]}" == "test/e2e-test-application/externalMf" ]; then
# required for starting externalMF, otherwise webserver tries to start on /test/e2e-test-application/externalMf/externalMf
echoe "Stepping out"
cd ..
fi
if [ "${APP_FOLDERS[$i]}" != "/test/e2e-client-api-test-app" ] && [ "${APP_FOLDERS[$i]}" != "/test/e2e-js-test-application" ]; then
if [ "${APP_FOLDERS[$i]}" != "test/e2e-client-api-test-app" ] && [ "${APP_FOLDERS[$i]}" != "test/e2e-js-test-application" ]; then
runWebserver ${APP_PORTS[$i]} ${APP_PUBLIC_FOLDERS[$i]} ${APP_PATH_CHECK[$i]}
else
npm run dev &
Expand All @@ -271,7 +271,7 @@ verifyAndStartWebserver() {

startE2eTestrunner() {
echoe "Starting e2e test headless"
cd $LUIGI_DIR_TESTING/${APP_FOLDERS[0]}
cd $LUIGI_DIR_TESTING/${APP_FOLDERS[1]}

if [ "$USE_CYPRESS_DASHBOARD" == "true" ]; then
echo "Running compatibility tests with recording"
Expand Down

0 comments on commit 0094d24

Please sign in to comment.