Skip to content

Commit

Permalink
fix: adjust elastic-package tests to select agent policy (#458)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dominiqueclarke committed Feb 15, 2022
1 parent d45ff71 commit 3ddd981
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion __tests__/core/runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,10 @@ describe('runner', () => {
* TODO: Move this as part of integration test
* Its really hard to ensure the journey/end is called for a real world page
* without actually testing on a real world webpage.
*
* FLAKY skipped
*/
it('run - ensure journey/end is written for real world pages', async () => {
it.skip('run - ensure journey/end is written for real world pages', async () => {
const j1 = journey('journey1', async ({ page }) => {
step('load homepage', async () => {
await page.goto('https://www.elastic.co');
Expand Down
12 changes: 10 additions & 2 deletions __tests__/e2e/synthetics.journey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,23 @@ async function goToUptime(page) {
await page.goto('http://localhost:5601/app/uptime');
}

async function selectAgentPolicy({ page }) {
const hosts = await page.isVisible('text="Existing hosts"');
if (hosts) {
await page.click('text="Existing hosts"');
await page.selectOption('[data-test-subj="agentPolicySelect"]', { label: 'Elastic-Agent (elastic-package)' });
}
}

async function createIntegrationPolicyName({ page, policyName }) {
await page.waitForSelector('[data-test-subj="packagePolicyNameInput"]', { timeout: 10000 });
await page.fill('[data-test-subj="packagePolicyNameInput"]', policyName);
await selectAgentPolicy({ page });
}

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

async function checkForSyntheticsData({ page, journeyName }) {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/e2e/uptime.journey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ journey('E2e test synthetics', async ({ page }) => {
});

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

step('It navigates to details page', async () => {
Expand All @@ -78,7 +78,7 @@ async function waitForSyntheticsData() {
filter: [
{
term: {
'monitor.id': 'my-monitor-inline',
'monitor.id': 'my-monitor',
},
},
{
Expand Down

0 comments on commit 3ddd981

Please sign in to comment.