Skip to content

Commit

Permalink
Merge branch 'develop' into dev/merge-branches
Browse files Browse the repository at this point in the history
  • Loading branch information
dpatil-magento authored Apr 6, 2021
2 parents 2c57504 + 26eaada commit 37af9a5
Show file tree
Hide file tree
Showing 11 changed files with 1,531 additions and 0 deletions.
3 changes: 3 additions & 0 deletions venia-integration-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.DS_Store
.idea
8 changes: 8 additions & 0 deletions venia-integration-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Running Venia Integration Tests

## Setup

1. Clone the repo and change directory to pwa-studio/venia-integration-tests
2. Run `yarn install`
3. Run `yarn test`
4. Now select test to Run from Cypress UI.
12 changes: 12 additions & 0 deletions venia-integration-tests/cypress.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"baseUrl": "https://develop.pwa-venia.com/",
"defaultCommandTimeout": 10000,
"env": {},
"fixturesFolder": "src/fixtures",
"integrationFolder": "src/tests",
"pageLoadTimeout": 30000,
"requestTimeout": 30000,
"testFiles": "**/*.spec.js",
"viewportHeight": 900,
"viewportWidth": 1440
}
17 changes: 17 additions & 0 deletions venia-integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "pwa-integration-tests",
"version": "0.0.1",
"description": "Venia Integration Automation Tests",
"author": "Magento Commerce",
"license": "MIT",
"devDependencies": {
"cypress": "~6.8.0"
},
"scripts": {
"test": "cypress open --browser chrome --config-file cypress.config.json",
"test:firefox": "cypress open --browser firefox --config-file cypress.config.json",
"test:headless": "cypress open --browser chrome --headless --config-file cypress.config.json",
"test:run": "cypress run --browser chrome --config-file cypress.config.json",
"test:debug": "node --inspect-brk ./node_modules/cypress/bin/cypress open --browser chrome --config-file cypress.config.json"
}
}
32 changes: 32 additions & 0 deletions venia-integration-tests/src/actions/login/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {
usernameField,
passwordField,
loginTriggerField
} from '../../fields/login';

/**
* Utility function to login to Venia using the
* username and password provided.
*
* @param {String} username username to login
* @param {String} password password to login
*/
export const login = (username, password) => {
// Enter username into the username field
cy.get(usernameField).type(username);

// Enter password into the password field
cy.get(passwordField).type(password);
};

/**
* Utility function to open the login dialog
*/
export const openLoginDialog = () => {
cy.visit('/');

cy.wait(500);

// open the signin dialog
cy.get(loginTriggerField).click();
};
3 changes: 3 additions & 0 deletions venia-integration-tests/src/fields/accountMenu/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const accountMenuItemsField = 'div[data-id="account-menu-items"]';

export const orderHistoryLink = 'a[data-id="account-menu-order-history"]';
5 changes: 5 additions & 0 deletions venia-integration-tests/src/fields/login/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const usernameField = 'input[data-id^="username"]';

export const passwordField = 'input[data-id^="password"]';

export const loginTriggerField = 'button[data-id^="loginTrigger"]';
3 changes: 3 additions & 0 deletions venia-integration-tests/src/fixtures/login/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const username = 'gooston@gmail.com';

export const password = '**********';
16 changes: 16 additions & 0 deletions venia-integration-tests/src/tests/accountMenu/accountMenu.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { username, password } from '../../fixtures/login';

import { login, openLoginDialog } from '../../actions/login';

import { orderHistoryLink } from '../../fields/accountMenu';

describe('testing account menu items', () => {
it('should render order history link', () => {
openLoginDialog();

login(username, password);

// asset that order history link is visible
cy.get(orderHistoryLink).should('be.visible');
});
});
16 changes: 16 additions & 0 deletions venia-integration-tests/src/tests/login/login.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { username, password } from '../../fixtures/login';

import { login, openLoginDialog } from '../../actions/login';

import { accountMenuItemsField } from '../../fields/accountMenu';

describe('testing login trigger', () => {
it('should login', () => {
openLoginDialog();

login(username, password);

// asset that login was successful
cy.get(accountMenuItemsField).should('be.visible');
});
});
Loading

0 comments on commit 37af9a5

Please sign in to comment.