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

refactor extension uninstall tests #11286

Merged
merged 4 commits into from
Jun 21, 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
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
Loading