Skip to content

Commit 3ddd981

Browse files
fix: adjust elastic-package tests to select agent policy (#458)
* adjust test to select agent policy * adjust uptime.journey test * adjust timeout for long running test * Update __tests__/core/runner.test.ts * Update __tests__/e2e/synthetics.journey.ts * skip flaky test * Apply suggestions from code review
1 parent d45ff71 commit 3ddd981

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

__tests__/core/runner.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,10 @@ describe('runner', () => {
695695
* TODO: Move this as part of integration test
696696
* Its really hard to ensure the journey/end is called for a real world page
697697
* without actually testing on a real world webpage.
698+
*
699+
* FLAKY skipped
698700
*/
699-
it('run - ensure journey/end is written for real world pages', async () => {
701+
it.skip('run - ensure journey/end is written for real world pages', async () => {
700702
const j1 = journey('journey1', async ({ page }) => {
701703
step('load homepage', async () => {
702704
await page.goto('https://www.elastic.co');

__tests__/e2e/synthetics.journey.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,23 @@ async function goToUptime(page) {
5757
await page.goto('http://localhost:5601/app/uptime');
5858
}
5959

60+
async function selectAgentPolicy({ page }) {
61+
const hosts = await page.isVisible('text="Existing hosts"');
62+
if (hosts) {
63+
await page.click('text="Existing hosts"');
64+
await page.selectOption('[data-test-subj="agentPolicySelect"]', { label: 'Elastic-Agent (elastic-package)' });
65+
}
66+
}
67+
6068
async function createIntegrationPolicyName({ page, policyName }) {
6169
await page.waitForSelector('[data-test-subj="packagePolicyNameInput"]', { timeout: 10000 });
6270
await page.fill('[data-test-subj="packagePolicyNameInput"]', policyName);
71+
await selectAgentPolicy({ page });
6372
}
6473

6574
async function confirmAndSavePolicy(page) {
6675
await page.click('[data-test-subj="createPackagePolicySaveButton"]');
67-
await page.click('[data-test-subj="confirmModalConfirmButton"]');
68-
await page.waitForSelector('[data-test-subj="packagePolicyCreateSuccessToast"]', { timeout: 20000 });
76+
await Promise.all([page.waitForNavigation(), page.click('[data-test-subj="confirmModalConfirmButton"]')]);
6977
}
7078

7179
async function checkForSyntheticsData({ page, journeyName }) {

__tests__/e2e/uptime.journey.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ journey('E2e test synthetics', async ({ page }) => {
5656
});
5757

5858
step('Click on my monitor', async () => {
59-
await page.click('[data-test-subj=monitor-page-link-my-monitor-inline]');
59+
await page.click('[data-test-subj=monitor-page-link-my-monitor]');
6060
});
6161

6262
step('It navigates to details page', async () => {
@@ -78,7 +78,7 @@ async function waitForSyntheticsData() {
7878
filter: [
7979
{
8080
term: {
81-
'monitor.id': 'my-monitor-inline',
81+
'monitor.id': 'my-monitor',
8282
},
8383
},
8484
{

0 commit comments

Comments
 (0)