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

Extensions compatibility tests 2.10 #11508

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
872f7de
saving WIP
aalves08 Jul 23, 2024
7ca533c
testing workflow for the first time
aalves08 Jul 24, 2024
00e5db1
fix bash script + prevent a lot of e2e tests from running
aalves08 Jul 24, 2024
e14a973
script adjustment
aalves08 Jul 24, 2024
e15ee89
script adjustment
aalves08 Jul 24, 2024
104e80c
script adjustment
aalves08 Jul 24, 2024
c9eda1e
script adjustment/fix
aalves08 Jul 25, 2024
320d53b
script adjustment/fix
aalves08 Jul 25, 2024
befd075
Revert "script adjustment/fix"
aalves08 Jul 25, 2024
b0211ff
script adjustment/fix
aalves08 Jul 25, 2024
169d8fa
script adjustment/fix
aalves08 Jul 25, 2024
8f6433b
test matrix for multiple envs
aalves08 Jul 25, 2024
3750ef0
bind to only v2.9 to check if tests pass + comment other workflows
aalves08 Jul 25, 2024
7b31b9c
comment workflows
aalves08 Jul 25, 2024
6ffcb11
use only before hook on elemental spec
aalves08 Jul 25, 2024
969e0e8
comment workflows
aalves08 Jul 25, 2024
bf55aec
comment workflows
aalves08 Jul 25, 2024
18c48c2
comment workflows
aalves08 Jul 25, 2024
83afae9
update
aalves08 Jul 25, 2024
27df437
update
aalves08 Jul 25, 2024
239f6e9
see if setup runs
aalves08 Jul 25, 2024
6c53815
test multi rancher tests + add official extensions repo as first step…
aalves08 Jul 25, 2024
c7ef7a2
add main repo of extensions to see if test passes
aalves08 Jul 25, 2024
eb65060
add main repo of extensions to see if test passes
aalves08 Jul 25, 2024
486351c
adjust e2e test run to pass spec + adjust add of main extensions repo
aalves08 Jul 26, 2024
9cf3c24
small change
aalves08 Jul 26, 2024
73c6182
fix matrix stuff
aalves08 Jul 26, 2024
e9824cc
use same version as master for test.yaml
aalves08 Jul 31, 2024
a59f4ad
update
aalves08 Jul 31, 2024
0afc69b
fix merge conflicts
aalves08 Jul 31, 2024
f0aeef8
add build of UI
aalves08 Jul 31, 2024
a7c69ad
adjust branch for 2.9
aalves08 Jul 31, 2024
77fabc1
name
aalves08 Jul 31, 2024
a0e56a5
change branch
aalves08 Jul 31, 2024
7ed37c7
echo on e2e-docker-start
aalves08 Aug 1, 2024
84aec8d
another test run
aalves08 Aug 1, 2024
e6cc196
finalized workflow + remove echos from e2e-docker-start + working on …
aalves08 Aug 2, 2024
5761ac4
continue work on elemental spec
aalves08 Aug 2, 2024
c408f9d
finished elemental spec
aalves08 Aug 8, 2024
be3ca51
final test elemental spec
aalves08 Aug 8, 2024
c289a21
some minor adjustments to elemental spec + start work on kubewarden spec
aalves08 Aug 8, 2024
b4aa28b
tidy up pr to prepare for merge + stop kw spec form running + working…
aalves08 Aug 9, 2024
f77ec32
changes
aalves08 Aug 9, 2024
d63e0be
fix lint issues
aalves08 Aug 9, 2024
7481a96
revert test.yaml
aalves08 Aug 14, 2024
c006f3d
fix after rebase
aalves08 Aug 14, 2024
206723c
reshuffle folders
aalves08 Aug 14, 2024
4007b2c
fix test.yaml change + add push trigger to compatibility tests to see…
aalves08 Aug 14, 2024
13ba16d
fix trigger
aalves08 Aug 14, 2024
a046402
remove BUILD_DASHBOARD reference
aalves08 Aug 14, 2024
2614dc3
add
aalves08 Aug 14, 2024
06db495
tweak path to spec file
aalves08 Aug 14, 2024
76fe0da
include extensions folder in cypress config
aalves08 Aug 14, 2024
934e105
trigger wf
aalves08 Aug 14, 2024
97ff592
get back script optimisations + revert small change used to trigger w…
aalves08 Aug 14, 2024
9a6bc1c
trigger workflow
aalves08 Aug 14, 2024
61b6235
script adjustment
aalves08 Aug 14, 2024
1dc44a5
Refactor
richard-cox Aug 14, 2024
c15a3a1
final adjustments
aalves08 Aug 14, 2024
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
66 changes: 66 additions & 0 deletions .github/workflows/extensions-compatibility-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Extensions Compatibility Tests
on:
schedule:
- cron: "0 0 * * *" # runs at midnight every day

env:
TEST_USERNAME: admin
TEST_PASSWORD: password
CATTLE_BOOTSTRAP_PASSWORD: password
TEST_BASE_URL: https://127.0.0.1:8005
API: https://127.0.0.1
TEST_PROJECT_ID: rancher-dashboard
CYPRESS_API_URL: http://139.59.134.103:1234/
TEST_RUN_ID: ${{github.run_number}}-${{github.run_attempt}}-extensions-compatibility-tests

jobs:
e2e-test-extensions-compatibility:
strategy:
fail-fast: false
matrix:
role: [
{ username: 'admin', tag: '@adminUser' }
]
features: [
['@elemental', 'elemental']
]
rancherEnv: [
['2.10', 'v2.9-head'],
# ['2.9', 'v2.9-head']
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup env
uses: ./.github/actions/setup

# this is where docker is set up with the enviroment
- name: Run Rancher system ${{ matrix.rancherEnv[0] }} - image:${{ matrix.rancherEnv[1] }}
run: export RANCHER_VERSION_E2E=${{ matrix.rancherEnv[1] }} && yarn e2e:docker

## this is just setting up rancher and user
- name: Setup Rancher and user
run: |
yarn e2e:prod
env:
GREP_TAGS: ${{ matrix.role.tag }}Setup+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}Setup+${{ matrix.features[0] }} --@jenkins
TEST_USERNAME: ${{ matrix.role.username }}
TEST_ONLY: setup

# This is the actual triggering of the e2e test specs
- name: Run user tests
run: |
export SPEC_FILE="cypress/e2e/tests/extensions/${{ matrix.features[1] }}/${{ matrix.features[1] }}.spec.ts" && yarn e2e:prod
env:
TEST_SKIP: setup
GREP_TAGS: ${{ matrix.role.tag }}+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}+${{ matrix.features[0] }} --@jenkins
TEST_USERNAME: ${{ matrix.role.username }}

- name: Upload screenshots
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{github.run_number}}-${{github.run_attempt}}-extensions-compatibility-tests-screenshots-${{ matrix.role.tag }}+${{ matrix.features[0] }}
path: cypress/screenshots
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require('dotenv').config();
* VARIABLES
*/
const hasCoverage = (process.env.TEST_INSTRUMENT === 'true') || false; // Add coverage if instrumented
const testDirs = ['priority', 'components', 'setup', 'pages', 'navigation', 'global-ui', 'features'];
const testDirs = ['priority', 'components', 'setup', 'pages', 'navigation', 'global-ui', 'features', 'extensions'];
const skipSetup = process.env.TEST_SKIP?.includes('setup');
const baseUrl = (process.env.TEST_BASE_URL || 'https://localhost:8005').replace(/\/$/, '');
const DEFAULT_USERNAME = 'admin';
Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/po/components/labeled-select.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ export default class LabeledSelectPo extends ComponentPo {
return this.self().click();
}

setOptionAndClick(label: string) {
this.self().get('input[type="search"]').type(label);

return this.clickOption(1);
}

clickOption(optionIndex: number) {
return this.self().get(`.vs__dropdown-menu .vs__dropdown-option:nth-child(${ optionIndex })`).click();
}
Expand Down
5 changes: 5 additions & 0 deletions cypress/e2e/po/components/resource-yaml.po.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ComponentPo from '@/cypress/e2e/po/components/component.po';
import { CypressChainable } from '@/cypress/e2e/po/po.types';
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';
import CodeMirrorPo from '@/cypress/e2e/po/components/code-mirror.po';

export default class ResourceYamlPo extends ComponentPo {
constructor(parent?: CypressChainable) {
Expand All @@ -15,6 +16,10 @@ export default class ResourceYamlPo extends ComponentPo {
return this.self().find('.footer');
}

codeMirror() {
return CodeMirrorPo.bySelector(this.self(), '[data-testid="yaml-editor-code-mirror"]');
}

saveOrCreate(): AsyncButtonPo {
return new AsyncButtonPo('[data-testid="action-button-async-button"]', this.self());
}
Expand Down
47 changes: 47 additions & 0 deletions cypress/e2e/po/extensions/elemental/elemental.utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import ExtensionsCompatibilityUtils from '~/cypress/e2e/po/extensions/extensions-compatibility.utils';
import BannersPo from '@/cypress/e2e/po/components/banners.po';
import LabeledSelectPo from '@/cypress/e2e/po/components/labeled-select.po';
import RadioGroupInputPo from '@/cypress/e2e/po/components/radio-group-input.po';
import PagePo from '@/cypress/e2e/po/pages/page.po';

class DashboardPagePo extends PagePo {
private static url = '/elemental/c/_/dashboard';

constructor() {
super(DashboardPagePo.url);
}

waitForTitle(): Cypress.Chainable {
return this.self().find('h1').should('contain', 'OS Management');
}

installOperator(): Cypress.Chainable {
return this.self().getId('charts-install-button').click();
}

createElementalCluster() {
return this.self().getId('button-create-elemental-cluster').click();
}

createUpdateGroupClick() {
return this.self().getId('create-update-group-btn').click();
}
}

export default class ElementalPo extends ExtensionsCompatibilityUtils {
dashboard() {
return new DashboardPagePo();
}

elementalClusterSelectorTemplateBanner() {
return new BannersPo('[provider="machineinventoryselectortemplate"] .banner.warning');
}

updateGroupTargetClustersSelect() {
return new LabeledSelectPo('[data-testid="cluster-target"]');
}

updateGroupImageOption() {
return new RadioGroupInputPo('[data-testid="upgrade-choice-selector"]');
}
}
41 changes: 41 additions & 0 deletions cypress/e2e/po/extensions/extensions-compatibility.utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import PagePo from '@/cypress/e2e/po/pages/page.po';
import { InstallChartPage } from '@/cypress/e2e/po/pages/explorer/charts/install-charts.po';
import ChartInstalledAppsPagePo from '@/cypress/e2e/po/pages/chart-installed-apps.po';
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';
import NameNsDescriptionPo from '@/cypress/e2e/po/components/name-ns-description.po';
import ResourceDetailPo from '@/cypress/e2e/po/edit/resource-detail.po';
import CodeMirrorPo from '~/cypress/e2e/po/components/code-mirror.po';

const installChartPage = new InstallChartPage();
const appsPage = new ChartInstalledAppsPagePo('local', 'apps');
const root = '.dashboard-root';

export default class ExtensionsCompatibilityUtils {
appsPage() {
return appsPage;
}

chartInstallPage() {
return installChartPage;
}

genericPage(path: string) {
return new PagePo(path);
}

genericResourceList(): BaseResourceList {
return new BaseResourceList(cy.get(root));
}

genericNameNsDescription(): NameNsDescriptionPo {
return new NameNsDescriptionPo(cy.get(root));
}

genericResourceDetail() {
return new ResourceDetailPo(cy.get(root));
}

genericCodeMirror() {
return CodeMirrorPo.bySelector(cy.get(root), '[data-testid="yaml-editor-code-mirror"]');
}
}
19 changes: 19 additions & 0 deletions cypress/e2e/po/pages/chart-installed-apps.po.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import PagePo from '@/cypress/e2e/po/pages/page.po';
import ChartInstalledAppsListPo from '@/cypress/e2e/po/lists/chart-installed-apps.po';
import Kubectl from '@/cypress/e2e/po/components/kubectl.po';

const terminal = new Kubectl();

/**
* List page for catalog.cattle.io.app resources
Expand All @@ -24,4 +27,20 @@ export default class ChartInstalledAppsPagePo extends PagePo {
list(): ChartInstalledAppsListPo {
return new ChartInstalledAppsListPo('[data-testid="installed-app-catalog-list"]');
}

waitForInstallCloseTerminal(interceptName: string, installableParts: Array<String>) {
cy.wait(`@${ interceptName }`, { requestTimeout: 20000 }).its('response.statusCode').should('eq', 201);

// giving it a small buffer so that the install is properly triggered
cy.wait(15000); // eslint-disable-line cypress/no-unnecessary-waiting
terminal.closeTerminal();

installableParts.forEach((item:string) => {
this.list().state(item).should('contain', 'Deployed');
});

// timeout to give time for everything to be setup, otherwise the extension
// won't find the chart and show the correct screen
return cy.wait(10000); // eslint-disable-line cypress/no-unnecessary-waiting
}
}
38 changes: 38 additions & 0 deletions cypress/e2e/po/pages/extensions.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import NameNsDescriptionPo from '@/cypress/e2e/po/components/name-ns-description
import RepositoriesPagePo from '@/cypress/e2e/po/pages/chart-repositories.po';
import BannersPo from '@/cypress/e2e/po/components/banners.po';
import ChartRepositoriesCreateEditPo from '@/cypress/e2e/po/edit/chart-repositories.po';
import AppClusterRepoEditPo from '@/cypress/e2e/po/edit/catalog.cattle.io.clusterrepo.po';
import { LONG_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts';

export default class ExtensionsPagePo extends PagePo {
Expand Down Expand Up @@ -83,6 +84,35 @@ export default class ExtensionsPagePo extends PagePo {
appRepoList.list().state(name).should('contain', 'Active');
}

/**
* Adds a cluster repo for extensions
* @param repo - The repository url (e.g. https://github.com/rancher/ui-plugin-examples)
* @param branch - The git branch to target
* @param name - A name for the repository
* @returns {Cypress.Chainable}
*/
addExtensionsRepositoryDirectLink(repo: string, branch: string, name: string, waitForActiveState = true): Cypress.Chainable {
const appRepoList = new RepositoriesPagePo('local', 'apps');
const appRepoCreate = new AppClusterRepoEditPo('local', 'create');

appRepoCreate.goTo();
appRepoCreate.waitForPage();

appRepoCreate.nameNsDescription().name().self().scrollIntoView()
.should('be.visible');
appRepoCreate.nameNsDescription().name().set(name);
appRepoCreate.selectRadioOptionGitRepo(1);
// fill the git repo form
appRepoCreate.enterGitRepoName(repo);
appRepoCreate.enterGitBranchName(branch);
appRepoCreate.create().click();

if (waitForActiveState) {
appRepoList.waitForPage();
appRepoList.list().state(name).should('contain', 'Active');
}
}

// ------------------ extension card ------------------
extensionCard(extensionName: string) {
return this.self().getId(`extension-card-${ extensionName }`);
Expand Down Expand Up @@ -113,6 +143,14 @@ export default class ExtensionsPagePo extends PagePo {
return this.self().get('[data-modal="installPluginDialog"]');
}

installModalSelectVersionLabel(label: string): Cypress.Chainable {
const selectVersion = new LabeledSelectPo(this.extensionInstallModal().getId('install-ext-modal-select-version'));

selectVersion.toggle();

return selectVersion.setOptionAndClick(label);
}

installModalSelectVersionClick(optionIndex: number): Cypress.Chainable {
const selectVersion = new LabeledSelectPo(this.extensionInstallModal().getId('install-ext-modal-select-version'));

Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/po/pages/page.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export default class PagePo extends ComponentPo {
return this.self().find('.primaryheader h1').invoke('text');
}

waitForMastheadTitle(title: string) {
return this.mastheadTitle().should('contain', title);
}

navToMenuEntry(label: string) {
BurgerMenuPo.toggle();
BurgerMenuPo.burgerMenuNavToMenubyLabel(label);
Expand Down
Loading
Loading