Skip to content

Commit

Permalink
refactor extension uninstall tests (#11286)
Browse files Browse the repository at this point in the history
* split extension uninstall tests by extension so retries work

* disable failing fleet test

* comment out test instead of using .skip

* stop running kubewarden-ui tests in dashboard ci
  • Loading branch information
mantis-toboggan-md authored Jun 21, 2024
1 parent bfaf90e commit 374a839
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 49 deletions.
44 changes: 42 additions & 2 deletions cypress/e2e/tests/pages/extensions/extensions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,51 @@ describe('Extensions page', { tags: ['@extensions', '@adminUser'] }, () => {
extensionsPo.uninstallModaluninstallClick();
extensionsPo.extensionReloadBanner().should('be.visible');

// let's check the extension reload banner and reload the page
extensionsPo.extensionReloadBanner().should('be.visible');
extensionsPo.extensionReloadClick();

// make sure extension card is in the available tab
extensionsPo.extensionTabAvailableClick();
extensionsPo.extensionCardClick(EXTENSION_NAME);
extensionsPo.extensionDetailsTitle().should('contain', EXTENSION_NAME);
});

it('Should uninstall unathenticated extensions', () => {
// Because we logged out in the previous test this one will also have to use an uncached login
cy.login(undefined, undefined, false);
const extensionsPo = new ExtensionsPagePo();

extensionsPo.goTo();

extensionsPo.extensionTabInstalledClick();

// click on uninstall button on card
extensionsPo.extensionCardUninstallClick(UNAUTHENTICATED_EXTENSION_NAME);
extensionsPo.extensionUninstallModal().should('be.visible');
extensionsPo.uninstallModaluninstallClick();
extensionsPo.extensionReloadBanner().should('be.visible');

// let's check the extension reload banner and reload the page
extensionsPo.extensionReloadBanner().should('be.visible');
extensionsPo.extensionReloadClick();

// make sure extension card is in the available tab
extensionsPo.extensionTabAvailableClick();
extensionsPo.extensionCardClick(UNAUTHENTICATED_EXTENSION_NAME);
extensionsPo.extensionDetailsTitle().should('contain', UNAUTHENTICATED_EXTENSION_NAME);
});

it('Should uninstall un-cached extensions', () => {
// Because we logged out in the previous test this one will also have to use an uncached login
cy.login(undefined, undefined, false);
const extensionsPo = new ExtensionsPagePo();

extensionsPo.goTo();

extensionsPo.extensionTabInstalledClick();

// click on uninstall button on card
extensionsPo.extensionCardUninstallClick(DISABLED_CACHE_EXTENSION_NAME);
extensionsPo.extensionUninstallModal().should('be.visible');
extensionsPo.uninstallModaluninstallClick();
Expand All @@ -359,7 +399,7 @@ describe('Extensions page', { tags: ['@extensions', '@adminUser'] }, () => {

// make sure extension card is in the available tab
extensionsPo.extensionTabAvailableClick();
extensionsPo.extensionCardClick(EXTENSION_NAME);
extensionsPo.extensionDetailsTitle().should('contain', EXTENSION_NAME);
extensionsPo.extensionCardClick(DISABLED_CACHE_EXTENSION_NAME);
extensionsPo.extensionDetailsTitle().should('contain', DISABLED_CACHE_EXTENSION_NAME);
});
});
90 changes: 47 additions & 43 deletions cypress/e2e/tests/pages/fleet/gitrepo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,50 +197,54 @@ describe('Git Repo', { testIsolation: 'off', tags: ['@fleet', '@adminUser'] }, (
});
});

// disabling test until it can be updated to account for a fleet change:
// - This test creates repos in the fleet-local workspace to test bundles in the upstream cluster
// - These bundles never successfully deployed given the fleet-agent failed to deploy (given the server-url in tests is localhost)
// - They passed before because fleet reported gitrepo status.resources for bundles that failed to deploy, now it does not and the test fails
// testing https://github.com/rancher/dashboard/issues/9866
it('in git repo details view we should display the correct bundle count', () => {
const basicRepos = [
{
name: 'e2e-git-repo1-test-bundle-count',
repo: 'https://github.com/rancher/fleet-examples.git',
branch: 'master',
path: 'simple'
},
{
name: 'e2e-git-repo2-test-bundle-count',
repo: 'https://github.com/rancher/fleet-examples.git',
branch: 'master',
path: 'single-cluster/helm'
}
];
const workspace = 'fleet-local';

// generate a fake cluster that can be usable in fleet
generateFakeClusterDataAndIntercepts(fakeProvClusterId, fakeMgmtClusterId);

// create first git-repo in fleet-local
cy.createRancherResource('v1', 'fleet.cattle.io.gitrepos', gitRepoTargetAllClustersRequest(workspace, basicRepos[0].name, basicRepos[0].repo, basicRepos[0].branch, basicRepos[0].path)).then(() => {
reposToDelete.push(`fleet-local/${ basicRepos[0].name }`);
});

// create second git-repo in fleet-local
cy.createRancherResource('v1', 'fleet.cattle.io.gitrepos', gitRepoTargetAllClustersRequest(workspace, basicRepos[1].name, basicRepos[1].repo, basicRepos[1].branch, basicRepos[1].path)).then(() => {
reposToDelete.push(`fleet-local/${ basicRepos[1].name }`);
});

// go to fleet gitrepo
listPage.goTo();
listPage.waitForPage();
listPage.selectWorkspace(workspace);

listPage.goToDetailsPage(basicRepos[1].name);

const gitRepoDetails = new FleetGitRepoDetailsPo('fleet-local', basicRepos[1].name);

gitRepoDetails.waitForPage();
gitRepoDetails.gitRepoTabs().clickTabWithSelector('[data-testid="bundles"]');
gitRepoDetails.bundlesCount().should('contain', '1');
});
// it('in git repo details view we should display the correct bundle count', () => {
// const basicRepos = [
// {
// name: 'e2e-git-repo1-test-bundle-count',
// repo: 'https://github.com/rancher/fleet-examples.git',
// branch: 'master',
// path: 'simple'
// },
// {
// name: 'e2e-git-repo2-test-bundle-count',
// repo: 'https://github.com/rancher/fleet-examples.git',
// branch: 'master',
// path: 'single-cluster/helm'
// }
// ];
// const workspace = 'fleet-local';

// // generate a fake cluster that can be usable in fleet
// generateFakeClusterDataAndIntercepts(fakeProvClusterId, fakeMgmtClusterId);

// // create first git-repo in fleet-local
// cy.createRancherResource('v1', 'fleet.cattle.io.gitrepos', gitRepoTargetAllClustersRequest(workspace, basicRepos[0].name, basicRepos[0].repo, basicRepos[0].branch, basicRepos[0].path)).then(() => {
// reposToDelete.push(`fleet-local/${ basicRepos[0].name }`);
// });

// // create second git-repo in fleet-local
// cy.createRancherResource('v1', 'fleet.cattle.io.gitrepos', gitRepoTargetAllClustersRequest(workspace, basicRepos[1].name, basicRepos[1].repo, basicRepos[1].branch, basicRepos[1].path)).then(() => {
// reposToDelete.push(`fleet-local/${ basicRepos[1].name }`);
// });

// // go to fleet gitrepo
// listPage.goTo();
// listPage.waitForPage();
// listPage.selectWorkspace(workspace);

// listPage.goToDetailsPage(basicRepos[1].name);

// const gitRepoDetails = new FleetGitRepoDetailsPo('fleet-local', basicRepos[1].name);

// gitRepoDetails.waitForPage();
// gitRepoDetails.gitRepoTabs().clickTabWithSelector('[data-testid="bundles"]');
// gitRepoDetails.bundlesCount().should('contain', '1');
// });

after(() => {
reposToDelete.forEach((r) => cy.deleteRancherResource('v1', 'fleet.cattle.io.gitrepo', r));
Expand Down
8 changes: 4 additions & 4 deletions shell/scripts/test-plugins-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ function clone_repo_test_extension_build() {
# test build-pkg
FORCE_COLOR=true yarn build-pkg $PKG_NAME | cat

# kubewarden has some unit tests and they should be quick to run... Let's check them as well
if [ "${REPO_NAME}" == "kubewarden-ui" ]; then
yarn test:ci
fi
# # kubewarden has some unit tests and they should be quick to run... Let's check them as well
# if [ "${REPO_NAME}" == "kubewarden-ui" ]; then
# yarn test:ci
# fi

# return back to the base path
popd
Expand Down

0 comments on commit 374a839

Please sign in to comment.