it('should be able to create a task for a product as a CTA', function () {
browser.sleep(6222);browser.sleep(6222);console.log("ss");
productPage.productsTab.click();
expect(productPage.myProductsTab.isDisplayed()).toBeTruthy();
//select checkbox
productPage.selectProduct.click();
browser.sleep(2222);
var elm = productDialogPage.createTaskButton;
var EC = protractor.ExpectedConditions;
//get count of checked checkboxes, count must 1 be because it selected one product
var checkedCount = productPage.selectedProducts.count();
expect(checkedCount).toBe(1);
browser.sleep(2222);
browser.wait(EC.elementToBeClickable(elm, 6222));
//click task create and expect confirm dialog to be displyed
productDialogPage.createTaskButton.click();
expect(ProductDialogPage.confirmDialog.isDisplayed()).toBe(true);
browser.sleep(2222);
//click yes to confirm creating task and expext dialog to displayed
productDialogPage.yesBtnForConfirmDialog.click();
//expect(taskPageObject.taskDialog.isDisplayed()).toBe(true);
browser.sleep(6222);
//put input areas to task create dialog
this.createTask();
browser.sleep(2222);
This is my test:
var elm = productDialogPage.createTaskButton;
var EC = protractor.ExpectedConditions;
//get count of checked checkboxes, count must 1 be because it selected one product
var checkedCount = productPage.selectedProducts.count();
expect(checkedCount).toBe(1);
browser.sleep(2222);
browser.wait(EC.elementToBeClickable(elm, 6222));
//click task create and expect confirm dialog to be displyed
productDialogPage.createTaskButton.click();
expect(ProductDialogPage.confirmDialog.isDisplayed()).toBe(true);
browser.sleep(2222);
After count is 1, it means I selected only one product (md-checbox
), it means product is selected so that button is active now. Earlier it was disabled.
disabled="disabled">
When I select, this is gone.
But as soon as it enters my test or my class page, it gives error. it doesn't run code because it doesn't wait.
It gives failure.
I used isvisible
ispresentof
but still I get the same error for this code:
Failed: Cannot read property 'isPresent' of undefined
But I don't have ispresent.
Before I had 2 classes only, now I separated classes according to dialog and tabs, this error started now. I can see ss
as output:
browser.sleep(6222);
console.log("ss");
but there is sleeping 6 seconds. It doesn't go there. It checks I think all variables before.
isPresent
is called byEC.elementToBeClickable
. It looks likeproductDialogPage.createTaskButton
is undefined or null. Make sure thatelm
is anElementFinder
.