231801_dev_to_test #52
|
@ -0,0 +1,33 @@
|
||||||
|
describe('WagonCreate', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/#/wagon/create');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create and delete a new wagon', () => {
|
||||||
|
cy.get('input').eq(0).type('1234');
|
||||||
|
cy.get('input').eq(1).type('1234ABCD');
|
||||||
|
cy.get('input').eq(2).type('100');
|
||||||
|
cy.get('input').eq(3).click();
|
||||||
|
cy.get('div[role="listbox"]').find('div.q-item').click();
|
||||||
|
|
||||||
|
// Save
|
||||||
|
cy.get('button[type="submit"]').click();
|
||||||
|
|
||||||
|
// Check data has been saved successfully
|
||||||
|
cy.get('div.text-h6').contains('1234').click();
|
||||||
|
cy.get('input').eq(0).should('have.value', '1234');
|
||||||
|
cy.get('input').eq(1).should('have.value', '1234ABCD');
|
||||||
|
cy.get('input').eq(2).should('have.value', '100');
|
||||||
|
cy.get('input').eq(3).should('have.value', 'Wagon Type #1');
|
||||||
|
|
||||||
|
// Delete wagon type created
|
||||||
|
cy.go('back');
|
||||||
|
cy.get('div.text-h6')
|
||||||
|
.contains('1234')
|
||||||
|
.parentsUntil('div.q-card')
|
||||||
|
.find('div.q-card__actions')
|
||||||
|
.find('button').last().click();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,57 @@
|
||||||
|
describe('WagonTypeCreate', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/#/wagon/type/create');
|
||||||
|
});
|
||||||
|
|
||||||
|
function chooseColor(color){
|
||||||
|
cy.get('div.shelving-down').eq(1).click();
|
||||||
|
cy.get('div.q-color-picker__cube').eq(color).click();
|
||||||
|
cy.get('div.q-card__section').find('button').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTray(position){
|
||||||
|
cy.get('div.action-button').last().find('button').click();
|
||||||
|
cy.focused().type(position);
|
||||||
|
cy.focused().blur();
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should create and delete a new wagon type', () => {
|
||||||
|
cy.get('input').first().type('Example for testing');
|
||||||
|
cy.get('div.q-checkbox__bg').click();
|
||||||
|
chooseColor(1);
|
||||||
|
|
||||||
|
// Insert invalid position (not minimal height)
|
||||||
|
addTray(20);
|
||||||
|
cy.get('div[role="alert"]').should('exist');
|
||||||
|
chooseColor(2);
|
||||||
|
addTray(150);
|
||||||
|
chooseColor(3);
|
||||||
|
addTray(100);
|
||||||
|
|
||||||
|
// Insert invalid position (max height reached)
|
||||||
|
addTray(210);
|
||||||
|
cy.get('div[role="alert"]').should('exist');
|
||||||
|
|
||||||
|
// Save
|
||||||
|
cy.get('button[type="submit"]').click();
|
||||||
|
|
||||||
|
// Check data has been saved successfully
|
||||||
|
cy.get('div.text-h6').contains('Example for testing').click();
|
||||||
|
cy.get('input').first().should('have.value', 'Example for testing');
|
||||||
|
cy.get('div.wagon-tray').should('have.length', 4);
|
||||||
|
cy.get('div.position').eq(0).find('input').should('have.value', '150');
|
||||||
|
cy.get('div.position').eq(1).find('input').should('have.value', '100');
|
||||||
|
cy.get('div.position').eq(2).find('input').should('have.value', '50');
|
||||||
|
|
||||||
|
// Delete wagon type created
|
||||||
|
cy.go('back');
|
||||||
|
cy.get('div.text-h6')
|
||||||
|
.contains('Example for testing')
|
||||||
|
.parentsUntil('div.q-card')
|
||||||
|
.find('div.q-card__actions')
|
||||||
|
.find('button').last().click();
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue