Skip to content

Commit 1a7ea58

Browse files
author
Triona Doyle
committed
update applications page locators for 1.21.0 compatibility
Signed-off-by: Triona Doyle <tekton@example.com>
1 parent 9171c63 commit 1a7ea58

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

test/ui-e2e/src/pages/ApplicationsPage.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ export class ApplicationsPage {
2020

2121
this.appNameInput = page.getByLabel('Application Name', { exact: true });
2222
this.projectInput = page.locator('[qe-id="application-create-field-project"]');
23-
this.repoUrlInput = page.locator('.argo-form-row').filter({ hasText: 'Repository URL' }).locator('input').first();
24-
this.pathInput = page.locator('.argo-form-row').filter({ hasText: 'Path' }).locator('input').first();
2523

24+
//src
25+
this.repoUrlInput = page.locator('[qe-id="application-create-field-repository-url"]')
26+
.or(page.getByPlaceholder(/github\.com/i)).first();
27+
28+
this.pathInput = page.locator('[qe-id="application-create-field-path"]')
29+
.or(page.getByText('Path').locator('..').locator('input')).first();
2630
//dest
27-
this.clusterUrlInput = page.locator('.argo-form-row').filter({ hasText: 'Cluster URL' }).locator('input').first();
28-
this.namespaceInput = page.locator('.argo-form-row')
29-
.filter({ has: page.getByText('Namespace', { exact: true }) })
30-
.locator('input').first();
31+
this.clusterUrlInput = page.locator('[qe-id="application-create-field-cluster-url"]')
32+
.or(page.getByText('Cluster URL', { exact: true }).locator('..').locator('input')).first();
33+
34+
this.namespaceInput = page.locator('[qe-id="application-create-field-namespace"]')
35+
.or(page.getByText('Namespace', { exact: true }).locator('..').locator('input')).first();
36+
3137
}
3238

3339
async navigate() {
@@ -76,7 +82,7 @@ export class ApplicationsPage {
7682
await this.createButton.click();
7783
}
7884

79-
async syncApplication(appName: string, expectedResource: string = 'spring-petclinic') {
85+
async syncApplication(appName: string, expectedResource: string = 'spring-petclinic') {
8086
//search for app
8187
await this.page.getByPlaceholder(/Search applications/i).fill(appName);
8288

@@ -85,25 +91,20 @@ export class ApplicationsPage {
8591
await appContainer.getByText('Sync', { exact: true }).click();
8692

8793
//slideout panel
88-
const resourcesSection = this.page.locator('.argo-form-row').filter({ hasText: 'SYNCHRONIZE RESOURCES' });
89-
await expect(resourcesSection).toContainText(expectedResource, { timeout: 15000 });
94+
// Wait for the manifests to fetch from Git and render on the panel
95+
await expect(this.page.getByText(expectedResource).first()).toBeVisible({ timeout: 15000 });
9096

91-
const validationWarning = resourcesSection.getByText('Select at least one resource');
92-
93-
//click 'all' until the UI registers it
94-
await expect(async () => {
95-
if (await validationWarning.isVisible()) {
96-
97-
//clickable anchor tag
98-
const allLink = resourcesSection.getByRole('link', { name: 'all', exact: true });
97+
//click 'all' to ensure all resource checkboxes are ticked across all Argo CD versions
98+
const allLink = this.page.getByRole('link', { name: 'all', exact: true });
99+
if (await allLink.isVisible()) {
99100
await allLink.click();
100-
//wait for re-render and hide the text
101-
await expect(validationWarning).toBeHidden({ timeout: 5000 });
102-
}
103-
}).toPass({ timeout: 15000 });
101+
}
104102

105103
//click the main sync button
106-
await this.page.getByRole('button', { name: /^synchronize$/i }).click();
104+
await this.page.getByRole('button', { name: /^synchronize$/i }).first().click();
105+
106+
//wait for the panel to close
107+
await expect(this.page.getByText('SYNCHRONIZE RESOURCES')).toBeHidden({ timeout: 10000 });
107108
}
108109

109110
async verifyStatus(appName: string) {

0 commit comments

Comments
 (0)