-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
811 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
/** | ||
* @author: @AngularClass | ||
*/ | ||
'use strict'; | ||
|
||
// look in ./config for protractor.conf.js | ||
module.exports.config = require('./config/protractor.conf.js').config; | ||
exports.config = { | ||
seleniumAddress: 'http://127.0.0.1:4444/wd/hub', | ||
|
||
useAllAngular2AppRoots: true, | ||
|
||
baseUrl: 'http://localhost:3000/', | ||
|
||
multiCapabilities: [ | ||
{ | ||
browserName: 'chrome', | ||
shardTestFiles: true, | ||
maxInstances: 1 | ||
} | ||
|
||
/*{ | ||
browserName: 'firefox', | ||
shardTestFiles: true, | ||
maxInstances: 4 | ||
}*/ | ||
], | ||
|
||
specs: [ | ||
// './tests_e2e/tests/*.e2e.js' | ||
'./tests_e2e/tests/accordion-demo.e2e.js' | ||
// './tests_e2e/tests/modals-demo.e2e.js' | ||
], | ||
|
||
framework: 'jasmine', | ||
|
||
jasmineNodeOpts: { | ||
showColors: true, | ||
defaultTimeoutInterval: 80000 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { $ } from 'protractor'; | ||
import { ElementFinder } from 'protractor/built/index'; | ||
|
||
const getTabHeaderAccordionPage = (tabNumber:number) => { | ||
return $('accordion-group:nth-child(' + tabNumber + ') .panel-heading'); | ||
}; | ||
const getTabContentAccordionPage = (tabNumber:number) => { | ||
return $('accordion-group:nth-child(' + tabNumber + ') .panel-body'); | ||
}; | ||
|
||
export class DataProvider { | ||
|
||
public static accordionTableContent: any = { | ||
'1stTabHeaderText': {element: (): ElementFinder => getTabHeaderAccordionPage(1), actualResult: 'Static Header, initially expanded'}, | ||
'1stTabContentText': {element: (): ElementFinder => getTabContentAccordionPage(1), actualResult: 'This content is straight in the template.'}, | ||
'2stTabHeaderText': {element: (): ElementFinder => getTabHeaderAccordionPage(2), actualResult: 'Dynamic Group Header - 1'}, | ||
'2stTabContentText': {element: (): ElementFinder => getTabContentAccordionPage(2), actualResult: 'Dynamic Group Body - 1'}, | ||
'3stTabHeaderText': {element: (): ElementFinder => getTabHeaderAccordionPage(3), actualResult: 'Dynamic Group Header - 2'}, | ||
'3stTabContentText': {element: (): ElementFinder => getTabContentAccordionPage(3), actualResult: 'Dynamic Group Body - 2'}, | ||
'4stTabHeaderText': {element: (): ElementFinder => getTabHeaderAccordionPage(4), actualResult: 'Dynamic Body Content'}, | ||
'4stTabContentText1stString': {element: (): ElementFinder => $('accordion-group:nth-child(4) .panel-body>p'), actualResult: 'The body of the accordion group grows to fit the contents'}, | ||
'4stTabContentTextAddButton': {element: (): ElementFinder => $('accordion-group:nth-child(4) .panel-body>button'), actualResult: 'Add Item'}, | ||
'4stTabContentTextTableItem': {element: (): ElementFinder => $('accordion-group:nth-child(4) .panel-body :nth-child(4)'), actualResult: 'Item 2'}, | ||
'5stTabHeaderText': {element: (): ElementFinder => getTabHeaderAccordionPage(5), actualResult: 'I can have markup, too!'}, | ||
'5stTabContentText': {element: (): ElementFinder => getTabContentAccordionPage(5), actualResult: 'This is just some content to illustrate fancy headings.'} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { $, $$, browser } from 'protractor'; | ||
import { leftPanelTests } from './leftPanelTests.e2e'; | ||
import { DataProvider } from './../data-provider/data-provider.e2e'; | ||
|
||
const buttonToggleLastPanel = $('accordion-demo>p button:nth-child(1)'); | ||
const buttonEnableDisablePanel = $('accordion-demo>p button:nth-child(2)'); | ||
const buttonAddItem = $('.panel-body .btn'); | ||
const checkboxOnlyOne = $('.checkbox .ng-valid'); | ||
const getItemsCount = $$('accordion-group:nth-child(4) .panel-body > div'); | ||
const buttonArrow = $('.pull-right'); | ||
let using = require('jasmine-data-provider'); | ||
|
||
const getTabHeader = (tabNumber:number) => { | ||
return $('accordion-group:nth-child(' + tabNumber + ') .panel-heading'); | ||
}; | ||
const getTabContent = (tabNumber:number) => { | ||
return $('accordion-group:nth-child(' + tabNumber + ') .panel-body'); | ||
}; | ||
|
||
describe('Check the Accordion page in bootstrap 3', () => { | ||
beforeAll(() => { | ||
browser.get('#/accordion'); | ||
leftPanelTests.checkLeftPanelMini(); | ||
leftPanelTests.checkLeftPanelMaxi(); | ||
}); | ||
it('Close/open first tab by click', () => { | ||
getTabHeader(1).click(); | ||
expect(getTabContent(1).isDisplayed()).toBe(false); | ||
getTabHeader(1).click(); | ||
expect(getTabContent(1).isDisplayed()).toBe(true); | ||
}); | ||
it('Open/close last tab with button Toggle Last Panel', () => { | ||
buttonToggleLastPanel.click(); | ||
expect(getTabContent(5).isDisplayed()).toBe(true); | ||
expect(buttonArrow.getAttribute('class')).toContain('glyphicon-chevron-down'); | ||
buttonToggleLastPanel.click(); | ||
expect(getTabContent(5).isDisplayed()).toBe(false); | ||
expect(buttonArrow.getAttribute('class')).toContain('glyphicon-chevron-right'); | ||
}); | ||
it('Button Enable/Disable first panel is ON', () => { | ||
buttonEnableDisablePanel.click(); | ||
getTabHeader(1).click(); | ||
expect(getTabContent(1).isDisplayed()).toBe(false); | ||
}); | ||
it('Button Enable/Disable first panel is OFF', () => { | ||
buttonEnableDisablePanel.click(); | ||
getTabHeader(1).click(); | ||
expect(getTabHeader(1).isDisplayed()).toBe(true); | ||
}); | ||
it('Add items in 4th tab', () => { | ||
getTabHeader(4).click(); | ||
expect(getItemsCount.count()).toBe(3); | ||
buttonAddItem.click(); | ||
buttonAddItem.click(); | ||
expect(getItemsCount.count()).toBe(5); | ||
}); | ||
it('Open all tabs together', () => { | ||
checkboxOnlyOne.click(); | ||
getTabHeader(1).click(); | ||
getTabHeader(2).click(); | ||
getTabHeader(3).click(); | ||
getTabHeader(5).click(); | ||
expect(getTabHeader(1).isDisplayed()).toBe(true); | ||
expect(getTabHeader(2).isDisplayed()).toBe(true); | ||
expect(getTabHeader(3).isDisplayed()).toBe(true); | ||
expect(getTabHeader(4).isDisplayed()).toBe(true); | ||
expect(getTabHeader(5).isDisplayed()).toBe(true); | ||
}); | ||
using (DataProvider.accordionTableContent, (data:any, description:string) => { | ||
it ('Check table texts: ' + description, () => { | ||
expect(data.element().getText()).toBe(data.actualResult); | ||
}); | ||
}); | ||
}); | ||
describe('Check the Accordion page in bootstrap 4', () => { | ||
beforeAll(() => { | ||
browser.get('index-bs4.html#/accordion'); | ||
leftPanelTests.checkLeftPanelMini(); | ||
leftPanelTests.checkLeftPanelMaxi(); | ||
}); | ||
it('Close/open first tab by click', () => { | ||
getTabHeader(1).click(); | ||
expect(getTabContent(1).isDisplayed()).toBe(false); | ||
getTabHeader(1).click(); | ||
expect(getTabContent(1).isDisplayed()).toBe(true); | ||
}); | ||
it('Open/close last tab with button Toggle Last Panel', () => { | ||
buttonToggleLastPanel.click(); | ||
expect(getTabContent(5).isDisplayed()).toBe(true); | ||
expect(buttonArrow.getAttribute('class')).toContain('glyphicon-chevron-down'); | ||
buttonToggleLastPanel.click(); | ||
expect(getTabContent(5).isDisplayed()).toBe(false); | ||
expect(buttonArrow.getAttribute('class')).toContain('glyphicon-chevron-right'); | ||
}); | ||
it('Button Enable/Disable first panel is ON', () => { | ||
buttonEnableDisablePanel.click(); | ||
getTabHeader(1).click(); | ||
expect(getTabContent(1).isDisplayed()).toBe(false); | ||
}); | ||
it('Button Enable/Disable first panel is OFF', () => { | ||
buttonEnableDisablePanel.click(); | ||
getTabHeader(1).click(); | ||
expect(getTabHeader(1).isDisplayed()).toBe(true); | ||
}); | ||
it('Add items in 4th tab', () => { | ||
getTabHeader(4).click(); | ||
expect(getItemsCount.count()).toBe(3); | ||
buttonAddItem.click(); | ||
buttonAddItem.click(); | ||
expect(getItemsCount.count()).toBe(5); | ||
}); | ||
it('Open all tabs together', () => { | ||
checkboxOnlyOne.click(); | ||
getTabHeader(1).click(); | ||
getTabHeader(2).click(); | ||
getTabHeader(3).click(); | ||
getTabHeader(5).click(); | ||
expect(getTabHeader(1).isDisplayed()).toBe(true); | ||
expect(getTabHeader(2).isDisplayed()).toBe(true); | ||
expect(getTabHeader(3).isDisplayed()).toBe(true); | ||
expect(getTabHeader(4).isDisplayed()).toBe(true); | ||
expect(getTabHeader(5).isDisplayed()).toBe(true); | ||
}); | ||
using (DataProvider.accordionTableContent, (data:any, description:string) => { | ||
it ('Check table texts: ' + description, () => { | ||
expect(data.element().getText()).toBe(data.actualResult); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { $, $$, browser } from 'protractor/globals'; | ||
|
||
const leftPanelTests = require('./../data/leftPanelTests.e2e'); | ||
const buttonAddAlert = $('alert-demo .btn'); | ||
const alertWarning = $('.alert.alert-warning'); | ||
const getAlertCount = $$('alert > div'); | ||
const getCloseButton = (tabNumber:any) => { | ||
return 'alert-demo alert:nth-child(' + tabNumber + ') .close'; | ||
}; | ||
|
||
describe('Alerts page test on bootstrap 3', () => { | ||
beforeAll(() => { | ||
browser.get('#/alerts'); | ||
browser.ignoreSynchronization = true; | ||
leftPanelTests.checkLeftPanelMini(); | ||
leftPanelTests.checkLeftPanelMaxi(); | ||
}); | ||
beforeEach(() => { | ||
browser.refresh(); | ||
}); | ||
it('Warning alert is displayed', () => { | ||
expect(alertWarning.isDisplayed()).toBe(true); | ||
}); | ||
it('Warning alert is disappear', () => { | ||
browser.sleep(5000); | ||
expect(alertWarning.isPresent()).toBe(false); | ||
}); | ||
it('Default warnings count', () => { | ||
expect(getAlertCount.count()).toBe(3); | ||
}); | ||
it('Adding warnings', () => { | ||
buttonAddAlert.click(); | ||
buttonAddAlert.click(); | ||
expect(getAlertCount.count()).toBe(5); | ||
}); | ||
it('User can delete danger and success alerts', () => { | ||
$(getCloseButton(2)).click(); | ||
$(getCloseButton(1)).click(); | ||
expect(getAlertCount.count()).toBe(1); | ||
}); | ||
it('User can delete added alerts', () => { | ||
buttonAddAlert.click(); | ||
$(getCloseButton(3)).click(); | ||
expect(getAlertCount.count()).toBe(3); | ||
}); | ||
}); | ||
describe('Alerts page test on bootstrap 4', () => { | ||
beforeAll(() => { | ||
browser.get('index-bs4.html#/alerts'); | ||
browser.ignoreSynchronization = true; | ||
leftPanelTests.checkLeftPanelMini(); | ||
leftPanelTests.checkLeftPanelMaxi(); | ||
}); | ||
beforeEach(() => { | ||
browser.refresh(); | ||
}); | ||
it('Warning alert is displayed', () => { | ||
expect(alertWarning.isDisplayed()).toBe(true); | ||
}); | ||
it('Warning alert is disappear', () => { | ||
browser.sleep(5000); | ||
expect(alertWarning.isPresent()).toBe(false); | ||
}); | ||
it('Default warnings count', () => { | ||
expect(getAlertCount.count()).toBe(3); | ||
}); | ||
it('Adding warnings', () => { | ||
buttonAddAlert.click(); | ||
buttonAddAlert.click(); | ||
expect(getAlertCount.count()).toBe(5); | ||
}); | ||
it('User can delete danger and success alerts', () => { | ||
$(getCloseButton(1)).click(); | ||
$(getCloseButton(1)).click(); | ||
expect(getAlertCount.count()).toBe(1); | ||
}); | ||
it('User can delete added alerts', () => { | ||
buttonAddAlert.click(); | ||
$(getCloseButton(3)).click(); | ||
expect(getAlertCount.count()).toBe(3); | ||
}); | ||
}); |
Oops, something went wrong.