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

PB Banner UI test #3178

Merged
merged 35 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5b885a3
WIP initial commit
dpatil-magento Apr 7, 2021
18207c3
wip
dpatil-magento Apr 19, 2021
2704fcf
WIP
dpatil-magento Apr 27, 2021
7b8ca95
wip
dpatil-magento Apr 28, 2021
74d6ca8
wip...
dpatil-magento Apr 28, 2021
2fbb749
cleanup
dpatil-magento Apr 28, 2021
3d887d2
wip...
dpatil-magento Apr 28, 2021
c16af33
wip..
dpatil-magento Apr 28, 2021
540c40b
wip..
dpatil-magento Apr 29, 2021
e2d1f25
update
dpatil-magento Apr 30, 2021
885eec8
update test
dpatil-magento Apr 30, 2021
9ae6cb3
update test
dpatil-magento May 3, 2021
4215d13
update to default config
dpatil-magento May 4, 2021
f780ecf
Merge branch 'develop' into dev/wishlist-cypress
dpatil-magento May 11, 2021
c9a8237
merge develop
dpatil-magento May 11, 2021
af94826
wip
dpatil-magento May 13, 2021
0f2745a
updsate
dpatil-magento May 16, 2021
d5eaec4
update
dpatil-magento May 16, 2021
872b28e
revert local changes
dpatil-magento May 16, 2021
4679b69
revert local changes
dpatil-magento May 16, 2021
854a7d5
update
dpatil-magento May 17, 2021
c1ec8f9
Merge branch 'develop' into dev/banner-cypress
dpatil-magento May 25, 2021
034ea0f
update
dpatil-magento May 25, 2021
e41e4c2
Merge branch 'develop' into dev/banner-cypress
dpatil-magento May 26, 2021
dda099c
fix lint
dpatil-magento May 26, 2021
2ad48dc
update screens
dpatil-magento May 26, 2021
9293252
Merge branch 'develop' into dev/banner-cypress
dpatil-magento May 26, 2021
c54cdd5
update homepage route
dpatil-magento May 26, 2021
f92f48a
Merge branch 'develop' into dev/banner-cypress
dpatil-magento May 26, 2021
4c01a5b
Merge branch 'develop' into dev/banner-cypress
dpatil-magento May 27, 2021
082427f
update review comments
dpatil-magento May 27, 2021
8e22302
Fix prettier
dpatil-magento May 27, 2021
c30ef61
update feedback
dpatil-magento May 27, 2021
4953327
Merge branch 'develop' into dev/banner-cypress
sirugh Jun 1, 2021
1c21330
Merge branch 'develop' into dev/banner-cypress
sirugh Jun 1, 2021
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
8 changes: 6 additions & 2 deletions venia-integration-tests/cypress.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
"fixturesFolder": "src/fixtures",
"integrationFolder": "src/tests",
"screenshotsFolder": "src/snapshots",
"video": false,
"pageLoadTimeout": 30000,
"requestTimeout": 30000,
"testFiles": "**/*.spec.js",
"video": false,
"viewportHeight": 900,
"viewportWidth": 1440,
"scrollBehavior": "nearest",
"ignoreTestFiles": ["**/__snapshots__/*", "**/__image_snapshots__/*"],
"ignoreTestFiles": [
"**/__snapshots__/*",
"**/__image_snapshots__/*"
],
"env": {}
}
}
77 changes: 77 additions & 0 deletions venia-integration-tests/src/actions/accountAccess/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you'll have to update this PR after the wishlist PR merge.

accountTriggerButton,
createAccountInitiateButton,
firstNameTextField,
lastNameTextField,
createAccountEmailTextField,
createAccountPasswordTextField,
createAccountSubmitButton
} from '../../fields/accountAccess';

/**
* Utility function to open the login dialog
*/
export const openLoginDialog = () => {
// open the signin dialog
cy.get(accountTriggerButton).click();
};

/**
* Utility function to create account in Venia using the
* username and password provided.
*
* @param {String} firstName firstName to createAccount
* @param {String} lastName lastName to createAccount
* @param {String} accountEmail accountEmail to createAccount
* @param {String} accountPassword accountPassword to createAccount
*/
export const createAccount = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need these any more. We moved these to custom cypress actions. Or am I missing something?

firstName,
lastName,
accountEmail,
accountPassword
) => {
// click on create account button
cy.get(createAccountInitiateButton)
.contains('Create an Account')
.click();

// enter user name
cy.get(firstNameTextField).type(firstName);

// Enter password into the password field
cy.get(lastNameTextField).type(lastName);

// Enter username into the username field
cy.get(createAccountEmailTextField).type(accountEmail);

// Enter password into the password field
cy.get(createAccountPasswordTextField).type(accountPassword);

// Enter password into the password field
cy.get(createAccountSubmitButton)
.contains('Create an Account')
.click();
};

export const assertCreateAccount = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move assertions to assertions folder.

firstName,
lastName,
accountEmail,
accountPassword
) => {
// Enter username into the username field
cy.get(firstNameTextField).type(firstName);

// Enter password into the password field
cy.get(lastNameTextField).type(lastName);

// Enter username into the username field
cy.get(createAccountEmailTextField).type(accountEmail);

// Enter password into the password field
cy.get(createAccountPasswordTextField).type(accountPassword);

// Enter password into the password field
cy.get(createAccountSubmitButton).click;
};
7 changes: 7 additions & 0 deletions venia-integration-tests/src/actions/routes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need this any more. We moved these to custom Cypress actions in the wishlist PR.

* Utility function to hit different routes
*/
export const visitPage = routeUrl => {
cy.visit(routeUrl);
cy.wait(5000);
};
85 changes: 85 additions & 0 deletions venia-integration-tests/src/actions/wishlist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import {
wishlistPageHeading,
wishlistRoot,
wishlistItemPrice,
wishlistItemAddToCartSection,
wishlistItemAddToCartButton,
wishlistItemMoreActionsButton,
removeProduct,
deleteProduct
} from '../../fields/wishlist';
import { wishlistRemove, removeProductMessage } from '../../fixtures/wishlist';

/**
* Utility function to assert empty wishlist
* @param {String} wishlistHeaderText wishlist page header text
*/
export const assertWishlistHeading = wishlistHeaderText => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move assertions to the assertions folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont know how I ended up here but updated all, thanks. Please re-check :)

// assert wishlist header text
cy.get(wishlistPageHeading).contains(wishlistHeaderText);
};

/**
* Utility function to assert empty wishlist
*/
export const assertEmptyWishlist = () => {
// assert product container does not exists
cy.get(wishlistRoot).should('not.exist');
};

/**
* Utility function to assert product exists in wishlist
* @param {String} productName product to verify it exist in wishlist
*/
export const assertProductInWishlist = productName => {
// assert Product container exists
cy.get(wishlistRoot).should('exist');

// assert Product exists
cy.contains(productName).should('exist');

// assert Product Price exists
cy.contains('div', productName)
.children(wishlistItemPrice)
.should('exist');

// assert Add To Cart Section exists
cy.contains('div', productName)
.children(wishlistItemAddToCartSection)
.should('exist');

// assert Add to Cart button exists
cy.contains('div', productName)
.children()
.find(wishlistItemAddToCartButton)
.should('exist');

// assert more actions button exists
cy.contains('div', productName)
.children()
.find(wishlistItemMoreActionsButton)
.should('exist');
};

/**
* Utility function to remove given product from wishlist
* @param {String} productName product to be removed
*/
export const removeProductFromWishlist = productName => {
// click on More actions button
cy.contains('div', productName)
.children()
.find(wishlistItemMoreActionsButton)
.click();

// click on Remove button
cy.get(removeProduct)
.contains(wishlistRemove)
.click();

// verfiy message is displayed
cy.contains(removeProductMessage).should('exist');

// click on Delete button
cy.get(deleteProduct).click();
};

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
// TODO add tags CE, EE to test to filter and run tests as needed
describe('verify pagebuilder banner content', () => {
it('verify banner content', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});
Copy link
Contributor

@revanth0212 revanth0212 May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
});
});

Just for consistency.

it('verify banner content2', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner2.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page2',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});

it('verify banner content3', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner3.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page3',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});

it('verify banner content4', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner4.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page4',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});

it('verify banner content5', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner5.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page5',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});

it('verify banner content6', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner6.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page6',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});

it('verify banner content7', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner7.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page7',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});

it('verify banner content8', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner8.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page8',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});

it('verify banner content9', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner9.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page9',
timeout: 60000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});

it('verify banner content10', () => {
cy.intercept('GET', '**/graphql?query=query+GetCmsPage*', {
fixture: 'pageBuilder/banner/banner10.json'
}).as('getCMSMockData');
cy.visitHomePage();
cy.wait(['@getCMSMockData']).its('response.body');
cy.loadFullPage().then(() => {
cy.captureFullPageScreenshot({
name: 'Page Builder Home Page10',
timeout: 180000,
failureThreshold: 5,
failureThresholdType: 'percent'
});
});
});
});