Skip to content

Commit

Permalink
Merge pull request #245 from adobecom/MWPW-167330
Browse files Browse the repository at this point in the history
test(mwpw-167330): create e2e/integration tests for dexter event page to check in GH Action
  • Loading branch information
sanrai authored Feb 11, 2025
2 parents ee90306 + c08cd1d commit 3fa33e2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
14 changes: 14 additions & 0 deletions e2e-tests/specs/all.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,17 @@ describe('Analytics Tracking', () => {
expect(analyticsAttr).toContain('Test Collection');
});
});

describe('Dexter Events Page', () => {
let url = 'http://localhost:8000/html/dexter-events.html';
if (process.env.GITHUB_ACTIONS) {
// eslint-disable-next-line no-template-curly-in-string
url = 'https://adobecom.github.io/caas/html/dexter-events.html';
}
it('should load the events data and display at least one card', async () => {
await browser.url(url);
const cardSelector = '.consonant-Card';
await $(cardSelector).waitForExist({ timeout: 10000 });
expect(await $(cardSelector).isDisplayed()).toBe(true);
});
});
17 changes: 17 additions & 0 deletions html/dexter-events.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,23 @@
</div>
</div>

<script>
(function() {
if (window.location.hostname.includes('github.io')) {
const coll = document.querySelector('consonant-card-collection');
if (coll) {
const rawConfig = coll.getAttribute('data-config');
const parsed = JSON.parse(rawConfig);

// Override endpoint for GitHub Pages
parsed.collection.endpoint = './caas/mock-json/dexter/events.json';

// Put it back
coll.setAttribute('data-config', JSON.stringify(parsed));
}
}
})();
</script>
<script type="text/javascript" src="../dist/main.source.js"></script>

</body>
Expand Down
4 changes: 2 additions & 2 deletions mock-json/dexter/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
},
{
"type": "date-interval",
"startTime": "2024-11-14T22:30:00.000Z",
"endTime": "2024-11-15T01:00:00.000Z"
"startTime": "2030-11-14T22:30:00.000Z",
"endTime": "2030-11-15T01:00:00.000Z"
}
],
"center": [],
Expand Down

0 comments on commit 3fa33e2

Please sign in to comment.