Skip to content

Commit

Permalink
Fix add-product e2e and partially organize product profile e2e
Browse files Browse the repository at this point in the history
Category changed how the input was handled, so I had to adjust how cypress was handling category while trying to add a product
#35
  • Loading branch information
Kahnurd committed Apr 6, 2022
1 parent 6b1393d commit 9f31a4e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions client/cypress/integration/add-product.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ describe('Add product', () => {
page.getFormField('store').click().get('[data-test=clickWillies]').click();
page.addProductButton().should('be.disabled');
page.getFormField('brand').type('potatoBrand');
page.addProductButton().should('be.disabled');
page.getFormField('category').click().get('[data-test=clickGoods]').click();
page.addProductButton().should('be.enabled');
// page.getFormField('lifespan').type('number');
// page.addProductButton().should('be.disabled');
Expand Down Expand Up @@ -92,6 +94,7 @@ describe('Add product', () => {
name: 'Test Product',
brand: 'umm',
store: 'Willies',
category: 'Baked Goods',
lifespan: 20,
threshold: 20
};
Expand Down
11 changes: 11 additions & 0 deletions client/cypress/integration/product-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ describe('Product List' , () => {
it('Should list product', () => {
page.getProductProfile().get('.product-card-name').should('have.text', 'Sobe - Orange Carrot');
});
});

describe('Editing the Product' , () => {

before(() => {
cy.task('seed:database');
});

beforeEach(() => {
page.navigateTo();
});

it('Should type something in the name edit field and have it return correct changes', () => {
// Check the it has the name we are expecting
Expand Down
4 changes: 1 addition & 3 deletions client/cypress/support/add-product.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ export class AddProductPage {
this.getFormField('name').type(newProduct.name);
this.getFormField('brand').type(newProduct.brand);
this.getFormField('store').click().get('[data-test=clickWillies]').click();
this.getFormField('category').click().get('[data-test=clickGoods]').click();
if (newProduct.description) {
this.getFormField('description').type(newProduct.description);
}
if (newProduct.category) {
this.getFormField('category').type(newProduct.category);
}
if (newProduct.location) {
this.getFormField('location').type(newProduct.location);
}
Expand Down

0 comments on commit 9f31a4e

Please sign in to comment.