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

Add kubewarden spec to extension compatibility tests #11626

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5afcc0b
saving WIP
aalves08 Jul 23, 2024
1f35c4b
testing workflow for the first time
aalves08 Jul 24, 2024
27fd742
fix bash script + prevent a lot of e2e tests from running
aalves08 Jul 24, 2024
2ea6d3c
script adjustment
aalves08 Jul 24, 2024
9636085
script adjustment
aalves08 Jul 24, 2024
5c55b13
script adjustment
aalves08 Jul 24, 2024
1dcffc4
script adjustment/fix
aalves08 Jul 25, 2024
5d2f62b
script adjustment/fix
aalves08 Jul 25, 2024
2faed31
Revert "script adjustment/fix"
aalves08 Jul 25, 2024
890f975
script adjustment/fix
aalves08 Jul 25, 2024
4ce5f30
script adjustment/fix
aalves08 Jul 25, 2024
0d98205
test matrix for multiple envs
aalves08 Jul 25, 2024
991e924
bind to only v2.9 to check if tests pass + comment other workflows
aalves08 Jul 25, 2024
4f8e5cd
comment workflows
aalves08 Jul 25, 2024
ddba6d5
use only before hook on elemental spec
aalves08 Jul 25, 2024
d1b20c1
comment workflows
aalves08 Jul 25, 2024
aef1a47
comment workflows
aalves08 Jul 25, 2024
777c6c0
comment workflows
aalves08 Jul 25, 2024
f37a3b6
update
aalves08 Jul 25, 2024
5a03d17
update
aalves08 Jul 25, 2024
d5b6456
see if setup runs
aalves08 Jul 25, 2024
64353ce
test multi rancher tests + add official extensions repo as first step…
aalves08 Jul 25, 2024
aee3326
add main repo of extensions to see if test passes
aalves08 Jul 25, 2024
8736d11
add main repo of extensions to see if test passes
aalves08 Jul 25, 2024
31f8206
adjust e2e test run to pass spec + adjust add of main extensions repo
aalves08 Jul 26, 2024
f5bd3e3
small change
aalves08 Jul 26, 2024
ec82852
fix matrix stuff
aalves08 Jul 26, 2024
608452d
use same version as master for test.yaml
aalves08 Jul 31, 2024
087a321
update
aalves08 Jul 31, 2024
4d1bd32
fix merge conflicts
aalves08 Jul 31, 2024
303c634
add build of UI
aalves08 Jul 31, 2024
7978f02
adjust branch for 2.9
aalves08 Jul 31, 2024
b210e67
name
aalves08 Jul 31, 2024
5b527d5
change branch
aalves08 Jul 31, 2024
bb468a3
echo on e2e-docker-start
aalves08 Aug 1, 2024
008e727
another test run
aalves08 Aug 1, 2024
594fe5b
finalized workflow + remove echos from e2e-docker-start + working on …
aalves08 Aug 2, 2024
0413875
continue work on elemental spec
aalves08 Aug 2, 2024
ee07186
finished elemental spec
aalves08 Aug 8, 2024
9974770
final test elemental spec
aalves08 Aug 8, 2024
8842877
some minor adjustments to elemental spec + start work on kubewarden spec
aalves08 Aug 8, 2024
a254707
tidy up pr to prepare for merge + stop kw spec form running + working…
aalves08 Aug 9, 2024
5654bbd
changes
aalves08 Aug 9, 2024
61a16e5
fix lint issues
aalves08 Aug 9, 2024
1895c19
working on kubewarden spec
aalves08 Aug 9, 2024
4d8b007
working on kubewarden spec
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
2 changes: 1 addition & 1 deletion .github/workflows/check-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: check-plugins-build
on:
pull_request:
branches:
- master
- master-bananas
env:
TEST_PERSIST_BUILD: true
jobs:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docusaurus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
# pull_request:
# branches:
# - master
jobs:
build:
name: Build
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/extensions-compatibility-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Extensions Compatibility Tests
on:
schedule:
- cron: "0 0 * * *" # runs at midnight every day
# TODO: DELETE THIS!!!! JUST FOR TESTING PURPOSES!
pull_request:
branches:
- master

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
# Build the dashboard to use in tests. When set to false it will grab `latest` from CDN (useful for running e2e tests quickly)
BUILD_DASHBOARD: true

jobs:
e2e-test-extensions-compatibility:
strategy:
fail-fast: false
matrix:
role: [
{ username: 'admin', tag: '@adminUser' }
]
features: [
['@elemental', 'elemental'],
['@kubewarden', 'kubewarden']
]
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/pages/extensions-compatibility-tests/${{ matrix.features[1] }}.spec.ts" && yarn e2e:prod
[ "$BUILD_DASHBOARD" != "false" ] || exit 0
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
6 changes: 3 additions & 3 deletions .github/workflows/storybook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
# pull_request:
# branches:
# - master
jobs:
storybook:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
branches:
- master
- 'release-*'
pull_request:
branches:
- master
- 'release-*'
# pull_request:
# branches:
# - master
# - 'release-*'
workflow_dispatch:
inputs:
environment:
Expand Down
6 changes: 4 additions & 2 deletions cypress/e2e/po/components/kubectl.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ export default class Kubectl extends ComponentPo {
* @param command Kube command without the 'kubectl'
* @returns executeCommand for method chanining
*/
executeCommand(command: string, wait = 3000) {
this.self().get(this.terminalRow).type(`${ this.kubeCommand } ${ command }{enter}`);
executeCommand(command: string, prependKubectl = true, wait = 3000) {
const parsedCommand = prependKubectl ? `${ this.kubeCommand } ${ command }{enter}` : `${ command }{enter}`;

this.self().get(this.terminalRow).type(parsedCommand);
cy.wait(wait);

return this;
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import ExtensionsCompatibiliyPo from '@/cypress/e2e/po/pages/extensions-compatibility-tests/extensions-compatibility.po';
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';
export default class ElementalPo extends ExtensionsCompatibiliyPo {
static url = '/elemental/c/_/dashboard';
static goTo(): Cypress.Chainable<Cypress.AUTWindow> {
return super.goTo(ElementalPo.url);
}

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

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

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

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

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"]');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import PagePo from '@/cypress/e2e/po/pages/page.po';
import { InstallChartPage } from '@/cypress/e2e/po/pages/explorer/charts/install-charts.po';
import Kubectl from '@/cypress/e2e/po/components/kubectl.po';
import ChartInstalledAppsPagePo from '@/cypress/e2e/po/pages/chart-installed-apps.po';
import ProductNavPo from '@/cypress/e2e/po/side-bars/product-side-nav.po';
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';
import CodeMirrorPo from '@/cypress/e2e/po/components/code-mirror.po';
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';
import LabeledInputPo from '@/cypress/e2e/po/components/labeled-input.po';
import CheckboxInputPo from '@/cypress/e2e/po/components/checkbox-input.po';
import TabbedPo from '@/cypress/e2e/po/components/tabbed.po';
import ResourceTablePo from '@/cypress/e2e/po/components/resource-table.po';
import LabeledSelectPo from '@/cypress/e2e/po/components/labeled-select.po';

const installChart = new InstallChartPage();
const terminal = new Kubectl();
const installedApps = new ChartInstalledAppsPagePo();

export default class ExtensionsCompatibiliyPo extends PagePo {
title(selector: string): Cypress.Chainable<string> {
return this.self().find(selector).invoke('text');
}

waitForTitle(selector: string, title: string) {
return this.title(selector).should('contain', title);
}

goToInstallChartPage(clusterId:string, queryParams = '') {
return installChart.goTo(clusterId, queryParams);
}

waitForInstallChartPage(repoName:string, chartName:string) {
return installChart.waitForChartPage(repoName, chartName);
}

chartInstallNext() {
return installChart.nextPage();
}

chartInstallClick() {
return installChart.installChart();
}

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

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

installableParts.forEach((item:string) => {
installedApps.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
}

chartInstallWaitForUpgradeAndCloseTerminal(interceptName: string, beforeTimeout = 15000) {
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(beforeTimeout); // eslint-disable-line cypress/no-unnecessary-waiting
terminal.closeTerminal();

cy.get('.masthead-state.badge-state').invoke('text').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
}

genericWaitForAppToInstall(appName: string, isTerminalOp = true) {
if (isTerminalOp) {
cy.wait(20000); // eslint-disable-line cypress/no-unnecessary-waiting
terminal.closeTerminal();
}
installedApps.list().state(appName).should('contain', 'Deployed');

return cy.wait(10000); // eslint-disable-line cypress/no-unnecessary-waiting
}

sideMenuNavTo(label: string) {
const sideNav = new ProductNavPo();

sideNav.navToSideMenuEntryByExactLabel(label);
}

genericListView(): BaseResourceList {
return new BaseResourceList(this.self());
}

goToDetailsPage(elemName: string) {
const resourceTable = new ResourceTablePo(this.self());

return resourceTable.sortableTable().detailsPageLinkWithName(elemName).click();
}

createFromYamlClick(): Cypress.Chainable {
return this.genericListView().masthead().createYaml();
}

createClick(): Cypress.Chainable {
return this.genericListView().masthead().create();
}

genericNameInput() {
return LabeledInputPo.bySelector(this.self(), '[data-testid="name-ns-description-name"]');
}

genericNamespaceInput(): LabeledSelectPo {
return new LabeledSelectPo('[data-testid="name-ns-description-namespace"]');
}

genericLabeledInputByLabel(label:string): LabeledInputPo {
return LabeledInputPo.byLabel(this.self(), label);
}

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

saveEditYamlForm(): AsyncButtonPo {
return new AsyncButtonPo('[data-testid="action-button-async-button"]', this.self());
}

saveOrCreateResource(): AsyncButtonPo {
return new AsyncButtonPo('[data-testid="form-save"]', this.self());
}

saveOrCreateCluster(): AsyncButtonPo {
return new AsyncButtonPo('[data-testid="rke2-custom-create-save"]', this.self());
}

genericCheckboxByLabel(label:string): CheckboxInputPo {
return CheckboxInputPo.byLabel(this.self(), label);
}

clickGenericTab(selector: string) {
const tab = new TabbedPo();

return tab.clickTabWithSelector(selector);
}
}
Loading
Loading