Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automation: part 2 of fixing flaky tests #10792

Merged
merged 6 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cypress/e2e/tests/pages/explorer/cluster-dashboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,12 @@ describe('Cluster Dashboard', { testIsolation: 'off', tags: ['@explorer', '@admi

// create project
cy.createProject(projName, 'local', userId).then((resp: Cypress.Response<any>) => {
const projId = resp.body.id.trim();
cy.wrap(resp.body.id.trim()).as('projId');

// create ns
cy.createNamespace(nsName, projId);
cy.get<string>('@projId').then((projId) => {
cy.createNamespace(nsName, projId);
});

// create pod
// eslint-disable-next-line no-return-assign
Expand All @@ -217,9 +219,11 @@ describe('Cluster Dashboard', { testIsolation: 'off', tags: ['@explorer', '@admi
.should('have.length.gte', 2);
});

after(() => {
after(function() {
if (removePod) {
cy.deleteRancherResource('v1', `pods/${ nsName }`, `pod-${ podName }`);
cy.deleteRancherResource('v1', 'namespaces', `${ nsName }`);
cy.deleteRancherResource('v3', 'projects', this.projId);
}
});
});
13 changes: 7 additions & 6 deletions cypress/e2e/tests/pages/explorer/namespace-picker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Namespace picker', { testIsolation: 'off' }, () => {
});

it('can filter workloads by project/namespace from the picker dropdown', { tags: ['@explorer', '@adminUser'] }, () => {
// Verify 'Namespace: cattle-fleet-local-system' appears once when filtering by Namespace
// Verify 'Namespace: cattle-fleet-system' appears once when filtering by Namespace
// Verify multiple namespaces within Project: System display when filtering by Project

// group workloads by namespace
Expand All @@ -38,13 +38,14 @@ describe('Namespace picker', { testIsolation: 'off' }, () => {
WorkloadsPodsListPagePo.navTo();
workloadsPodPage.waitForPage();

// Filter by Namespace: Select 'cattle-fleet-local-system'
// Filter by Namespace: Select 'cattle-fleet-system'
namespacePicker.toggle();
namespacePicker.clickOptionByLabel('cattle-fleet-local-system');
namespacePicker.isChecked('cattle-fleet-local-system');
namespacePicker.getOptions().find('#ns_cattle-fleet-system').should('exist');
namespacePicker.clickOptionByLabel('cattle-fleet-system');
namespacePicker.isChecked('cattle-fleet-system');
namespacePicker.closeDropdown();
workloadsPodPage.sortableTable()
.groupElementWithName('cattle-fleet-local-system')
.groupElementWithName('cattle-fleet-system')
.scrollIntoView().should('be.visible')
.and('have.length', 1);

Expand All @@ -59,7 +60,7 @@ describe('Namespace picker', { testIsolation: 'off' }, () => {
namespacePicker.isChecked('Project: System');
namespacePicker.closeDropdown();
workloadsPodPage.sortableTable().groupElementWithName('kube-system').scrollIntoView().should('be.visible');
workloadsPodPage.sortableTable().groupElementWithName('cattle-fleet-local-system').scrollIntoView().should('be.visible');
workloadsPodPage.sortableTable().groupElementWithName('cattle-fleet-system').scrollIntoView().should('be.visible');
});

it('can select only one of the top 5 resource filters at a time', { tags: ['@explorer', '@adminUser', '@standardUser'] }, () => {
Expand Down
12 changes: 12 additions & 0 deletions cypress/e2e/tests/pages/fleet/gitrepo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ describe('Git Repo', { tags: ['@fleet', '@adminUser'] }, () => {
prefPage.languageDropdownMenu().checkVisible();
prefPage.languageDropdownMenu().toggle();
prefPage.languageDropdownMenu().isOpened();

cy.intercept('PUT', 'v1/userpreferences/*').as(`prefUpdateZhHans`);
prefPage.languageDropdownMenu().clickOption(2);
cy.wait('@prefUpdateZhHans').then(({ response }) => {
expect(response?.statusCode).to.eq(200);
expect(response?.body.data).to.have.property('locale', 'zh-hans');
});
prefPage.languageDropdownMenu().isClosed();

listPage.goTo();
Expand All @@ -100,7 +106,13 @@ describe('Git Repo', { tags: ['@fleet', '@adminUser'] }, () => {
prefPage.languageDropdownMenu().checkVisible();
prefPage.languageDropdownMenu().toggle();
prefPage.languageDropdownMenu().isOpened();

cy.intercept('PUT', 'v1/userpreferences/*').as(`prefUpdateEnUs`);
prefPage.languageDropdownMenu().clickOption(1);
cy.wait('@prefUpdateEnUs').then(({ response }) => {
expect(response?.statusCode).to.eq(200);
expect(response?.body.data).to.have.property('locale', 'en-us');
});
prefPage.languageDropdownMenu().isClosed();

const fleetDashboardPage = new FleetDashboardPagePo('_');
Expand Down
Loading