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

Cypress landing page #2668

Closed
wants to merge 10 commits into from
Closed
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
221 changes: 220 additions & 1 deletion cypress/e2e/release-gate/landing-page.cy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,228 @@
// Declared variables to increase reusability if making breaking change!
const lastVisitedJSON =
'{"data":[{"id":210675,"createdAt":"2023-06-08T17:15:46.584521Z","updatedAt":"2023-06-08T17:30:55.424658Z","deletedAt":null,"bundle":"Home","pathname":"/","title":"console.redhat.com","userIdentityId":1},{"id":210678,"createdAt":"2023-06-08T17:16:31.970566Z","updatedAt":"2023-06-08T17:30:09.234024Z","deletedAt":null,"bundle":"Red Hat Insights","pathname":"/insights/remediations","title":"dashboard | console.redhat.com","userIdentityId":1},{"id":210677,"createdAt":"2023-06-08T17:16:25.350101Z","updatedAt":"2023-06-08T17:30:01.381218Z","deletedAt":null,"bundle":"Red Hat Insights","pathname":"/insights/dashboard","title":"console.redhat.com","userIdentityId":1},{"id":210696,"createdAt":"2023-06-08T17:26:20.174486Z","updatedAt":"2023-06-08T17:28:21.759746Z","deletedAt":null,"bundle":"OpenShift","pathname":"/openshift/cost-management/ocp","title":"OpenShift - Cost Management | OpenShift","userIdentityId":1},{"id":210695,"createdAt":"2023-06-08T17:25:45.152077Z","updatedAt":"2023-06-08T17:27:47.341141Z","deletedAt":null,"bundle":"OpenShift","pathname":"/openshift/cost-management/ocp/breakdown","title":"OpenShift - Cost Management | OpenShift","userIdentityId":1},{"id":210694,"createdAt":"2023-06-08T17:24:56.40512Z","updatedAt":"2023-06-08T17:24:56.40512Z","deletedAt":null,"bundle":"Red Hat Insights","pathname":"/insights/patch/templates","title":"Advisories - Patch | Red Hat Insights","userIdentityId":1},{"id":210693,"createdAt":"2023-06-08T17:24:49.401963Z","updatedAt":"2023-06-08T17:24:49.401963Z","deletedAt":null,"bundle":"Red Hat Insights","pathname":"/insights/patch/advisories","title":"dashboard | console.redhat.com","userIdentityId":1},{"id":210692,"createdAt":"2023-06-08T17:24:15.140323Z","updatedAt":"2023-06-08T17:24:15.140323Z","deletedAt":null,"bundle":"Red Hat Insights","pathname":"/insights/image-builder/manage-edge-images/9130","title":"console.redhat.com","userIdentityId":1},{"id":210690,"createdAt":"2023-06-08T17:22:45.51411Z","updatedAt":"2023-06-08T17:22:45.51411Z","deletedAt":null,"bundle":"Red Hat Insights","pathname":"/insights/remediations/6f638c4c-b6b4-48d6-bb30-3024c95b98a2","title":"console.redhat.com","userIdentityId":1},{"id":210689,"createdAt":"2023-06-08T17:20:45.769148Z","updatedAt":"2023-06-08T17:20:45.769148Z","deletedAt":null,"bundle":"OpenShift","pathname":"/openshift/insights/advisor/clusters/1a04eda5-cf73-43e7-88d7-6c7a50e6553f","title":"1a04eda5-cf73-43e7-88d7-6c7a50e6553f - Clusters - OCP Advisor | Red Hat Insights | OpenShift","userIdentityId":1}],"meta":{"count":10,"total":10}}';
const lastVisitedArray = [
{
id: 210675,
createdAt: '2023-06-08T17:15:46.584521Z',
updatedAt: '2023-06-08T17:30:55.424658Z',
deletedAt: null,
bundle: 'Home',
pathname: '/',
title: 'console.redhat.com',
userIdentityId: 1,
},
{
id: 210678,
createdAt: '2023-06-08T17:16:31.970566Z',
updatedAt: '2023-06-08T17:30:09.234024Z',
deletedAt: null,
bundle: 'Red Hat Insights',
pathname: '/insights/remediations',
title: 'dashboard | console.redhat.com',
userIdentityId: 1,
},
{
id: 210677,
createdAt: '2023-06-08T17:16:25.350101Z',
updatedAt: '2023-06-08T17:30:01.381218Z',
deletedAt: null,
bundle: 'Red Hat Insights',
pathname: '/insights/dashboard',
title: 'console.redhat.com',
userIdentityId: 1,
},
{
id: 210696,
createdAt: '2023-06-08T17:26:20.174486Z',
updatedAt: '2023-06-08T17:28:21.759746Z',
deletedAt: null,
bundle: 'OpenShift',
pathname: '/openshift/cost-management/ocp',
title: 'OpenShift - Cost Management | OpenShift',
userIdentityId: 1,
},
{
id: 210695,
createdAt: '2023-06-08T17:25:45.152077Z',
updatedAt: '2023-06-08T17:27:47.341141Z',
deletedAt: null,
bundle: 'OpenShift',
pathname: '/openshift/cost-management/ocp/breakdown',
title: 'OpenShift - Cost Management | OpenShift',
userIdentityId: 1,
},
{
id: 210694,
createdAt: '2023-06-08T17:24:56.40512Z',
updatedAt: '2023-06-08T17:24:56.40512Z',
deletedAt: null,
bundle: 'Red Hat Insights',
pathname: '/insights/patch/templates',
title: 'Advisories - Patch | Red Hat Insights',
userIdentityId: 1,
},
{
id: 210693,
createdAt: '2023-06-08T17:24:49.401963Z',
updatedAt: '2023-06-08T17:24:49.401963Z',
deletedAt: null,
bundle: 'Red Hat Insights',
pathname: '/insights/patch/advisories',
title: 'dashboard | console.redhat.com',
userIdentityId: 1,
},
{
id: 210692,
createdAt: '2023-06-08T17:24:15.140323Z',
updatedAt: '2023-06-08T17:24:15.140323Z',
deletedAt: null,
bundle: 'Red Hat Insights',
pathname: '/insights/image-builder/manage-edge-images/9130',
title: 'console.redhat.com',
userIdentityId: 1,
},
{
id: 210690,
createdAt: '2023-06-08T17:22:45.51411Z',
updatedAt: '2023-06-08T17:22:45.51411Z',
deletedAt: null,
bundle: 'Red Hat Insights',
pathname: '/insights/remediations/6f638c4c-b6b4-48d6-bb30-3024c95b98a2',
title: 'console.redhat.com',
userIdentityId: 1,
},
{
id: 210689,
createdAt: '2023-06-08T17:20:45.769148Z',
updatedAt: '2023-06-08T17:20:45.769148Z',
deletedAt: null,
bundle: 'OpenShift',
pathname: '/openshift/insights/advisor/clusters/1a04eda5-cf73-43e7-88d7-6c7a50e6553f',
title: '1a04eda5-cf73-43e7-88d7-6c7a50e6553f - Clusters - OCP Advisor | Red Hat Insights | OpenShift',
userIdentityId: 1,
},
];

// NUM_CHILDREN_ELEMENTS are VISIBLE cards under "Get started with Hybrid Cloud Console capabilities"
const NUM_CHILDREN_ELEMENTS = 10;

describe('Landing page', () => {
it('visit landing page', () => {
cy.visit('/');
cy.login();
cy.visit('/');
cy.reload();
cy.intercept('POST', '/api/chrome-service/v1/last-visited', lastVisitedJSON);
cy.intercept('GET', '/api/chrome-service/v1/user', {
data: {
id: 24353452,
createdAt: '2023-05-15T18:08:27.38611Z',
updatedAt: '2023-06-06T15:04:05.366605Z',
deletedAt: null,
accountId: '56118163',
firstLogin: true,
dayOne: true,
lastLogin: '2023-05-15T18:08:27.376277Z',
lastVisitedPages: lastVisitedArray,
favoritePages: [
{
id: 1957,
createdAt: '2023-06-05T18:17:26.849084Z',
updatedAt: '2023-06-06T19:23:32.813832Z',
deletedAt: null,
pathname: '/application-services/api-management',
favorite: true,
userIdentityId: 453245,
},
{
id: 1960,
createdAt: '2023-06-05T18:17:26.849084Z',
updatedAt: '2023-06-06T19:23:32.813832Z',
deletedAt: null,
pathname: '/application-services/service-accounts',
favorite: true,
userIdentityId: 453245,
},
{
id: 1961,
createdAt: '2023-06-05T18:17:26.849084Z',
updatedAt: '2023-06-06T19:23:32.813832Z',
deletedAt: null,
pathname: '/application-services/trusted-content',
favorite: true,
userIdentityId: 453245,
},
{
id: 1958,
createdAt: '2023-06-05T18:17:26.849084Z',
updatedAt: '2023-06-06T19:23:32.813832Z',
deletedAt: null,
pathname: '/ansible/automation-hub',
favorite: true,
userIdentityId: 453245,
},
{
id: 1959,
createdAt: '2023-06-05T18:17:26.849084Z',
updatedAt: '2023-06-06T19:23:32.813832Z',
deletedAt: null,
pathname: '/ansible/inventory',
favorite: true,
userIdentityId: 453245,
},
{
id: 1979,
createdAt: '2023-06-05T18:17:26.849084Z',
updatedAt: '2023-06-06T19:23:32.813832Z',
deletedAt: null,
pathname: '/ansible/remediations',
favorite: true,
userIdentityId: 453245,
},
],
selfReport: {
createdAt: '0001-01-01T00:00:00Z',
updatedAt: '0001-01-01T00:00:00Z',
deletedAt: null,
productsOfInterest: null,
jobRole: '',
userIdentityID: 0,
},
visitedBundles: {
apps: true,
ansible: true,
landing: true,
staging: true,
insights: true,
internal: true,
openshift: true,
allservices: true,
favoritedservices: true,
'application-services': true,
},
},
});
cy.wait(3000);
cy.contains('API Management').should('exist');
cy.contains('My favorite services').should('exist');
cy.contains('Recently visited').should('exist');
// Verify that the photo slides exist
cy.get('.slick-list').should('exist');
cy.get('.pf-l-gallery.pf-m-gutter').eq(1).children().should('have.length', NUM_CHILDREN_ELEMENTS);
cy.screenshot();
});

it('View favorited services', () => {
cy.visit('/');
cy.wait(4000);
cy.login();

cy.intercept({
method: 'GET',
url: '**/services/services.json',
}).as('services');

cy.wait('@services').its('response.statusCode').should('equal', 200);

// check if a favorites link exists on the page
cy.contains('My favorite services').should('exist');
Expand Down