Skip to content

Commit 7988618

Browse files
authored
Merge pull request #17403 from IsaSih/bp-214-fix-about-e2e
[backport 2.14.2] fixed release notes test and flakiness caused by test isolation
2 parents a1eb246 + 33118f4 commit 7988618

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

cypress/e2e/tests/pages/generic/about.spec.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import DiagnosticsPagePo from '@/cypress/e2e/po/pages/diagnostics.po';
44

55
const aboutPage = new AboutPagePo();
66

7-
describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser', '@standardUser'] }, () => {
8-
before(() => {
7+
describe('About Page', { testIsolation: 'on', tags: ['@generic', '@adminUser', '@standardUser'] }, () => {
8+
beforeEach(() => {
99
cy.login();
1010
});
1111

@@ -16,15 +16,13 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser',
1616
});
1717

1818
it('no Prime info when community', { tags: '@noPrime' }, () => {
19-
HomePagePo.goToAndWaitForGet();
20-
AboutPagePo.navTo();
19+
aboutPage.goTo();
2120
aboutPage.waitForPage();
22-
2321
aboutPage.rancherPrimeInfo().should('not.exist');
2422
});
2523

2624
it('can navigate to Diagnostics page', () => {
27-
AboutPagePo.navTo();
25+
aboutPage.goTo();
2826
aboutPage.waitForPage();
2927
aboutPage.diagnosticsBtn().click();
3028

@@ -34,18 +32,24 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser',
3432
});
3533

3634
it('can View release notes', () => {
37-
AboutPagePo.navTo();
35+
aboutPage.goTo();
3836
aboutPage.waitForPage();
39-
40-
aboutPage.clickVersionLink('View release notes');
41-
cy.origin('https://github.com/rancher/rancher', () => {
42-
cy.url().should('include', 'https://github.com/rancher/rancher/releases/tag/');
37+
cy.getRancherVersion().then((version) => {
38+
const isPrime = version.RancherPrime === 'true';
39+
const expectedOrigin = isPrime ? 'https://documentation.suse.com' : 'https://github.com';
40+
const expectedUrlPattern = isPrime ? '/cloudnative/rancher-manager/.+/en/release-notes' : '/rancher/rancher/releases/tag/';
41+
42+
aboutPage.clickVersionLink('View release notes');
43+
cy.origin(expectedOrigin, { args: { expectedUrlPattern } }, ({ expectedUrlPattern }) => {
44+
cy.url().should('match', new RegExp(expectedUrlPattern));
45+
});
4346
});
4447
});
4548

4649
describe('Versions', () => {
4750
beforeEach(() => {
4851
aboutPage.goTo();
52+
aboutPage.waitForPage();
4953
});
5054

5155
it('can see rancher version', () => {
@@ -59,28 +63,28 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser',
5963

6064
it('can navigate to /rancher/rancher', () => {
6165
aboutPage.clickVersionLink('Rancher');
62-
cy.origin('https://github.com/rancher/rancher', () => {
66+
cy.origin('https://github.com', () => {
6367
cy.url().should('include', 'https://github.com/rancher/rancher');
6468
});
6569
});
6670

6771
it('can navigate to /rancher/dashboard', () => {
6872
aboutPage.clickVersionLink('Dashboard');
69-
cy.origin('https://github.com/rancher/dashboard', () => {
73+
cy.origin('https://github.com', () => {
7074
cy.url().should('include', 'https://github.com/rancher/dashboard');
7175
});
7276
});
7377

7478
it('can navigate to /rancher/helm', () => {
7579
aboutPage.clickVersionLink('Helm');
76-
cy.origin('https://github.com/rancher/helm', () => {
80+
cy.origin('https://github.com', () => {
7781
cy.url().should('include', 'https://github.com/rancher/helm');
7882
});
7983
});
8084

8185
it('can navigate to /rancher/machine', () => {
8286
aboutPage.clickVersionLink('Machine');
83-
cy.origin('https://github.com/rancher/machine', () => {
87+
cy.origin('https://github.com', () => {
8488
cy.url().should('include', 'https://github.com/rancher/machine');
8589
});
8690
});
@@ -93,6 +97,7 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser',
9397
// workaround to make the following CLI tests work https://github.com/cypress-io/cypress/issues/8089#issuecomment-1585159023
9498
beforeEach(() => {
9599
aboutPage.goTo();
100+
aboutPage.waitForPage();
96101
cy.intercept('GET', 'https://releases.rancher.com/cli2/**').as('download');
97102
});
98103

@@ -152,7 +157,6 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser',
152157
}
153158

154159
beforeEach(() => {
155-
cy.login();
156160
interceptVersionAndSetToPrime().as('rancherVersion');
157161
});
158162

0 commit comments

Comments
 (0)