Looking for a method to delay my e2e test (angular2 project) until the targeted element receives a specific css class.
Is there an alternative approach without using browser.wait()
or browser.sleep()
?
Looking for a method to delay my e2e test (angular2 project) until the targeted element receives a specific css class.
Is there an alternative approach without using browser.wait()
or browser.sleep()
?
In the question, you mentioned avoiding built-in waiting functions and asking for a solution without them, even though the word "wait" is used. This approach may seem confusing.
Previously, we encountered a similar issue and created a custom wait function that can serve as an Expected Condition within browser.wait()
:
function waitForCssClass(elementFinder, desiredClass) {
return function () {
return elementFinder.getAttribute('class').then(function (classValue) {
return classValue && classValue.indexOf(desiredClass) >= 0;
});
};
};
browser.wait(waitForCssClass($("#myid"), "desiredClass"), 5000);
This function is designed to wait until a specific CSS class disappears from an element. It takes in the element object (ElementFinder) and the CSS class that you want to monitor for removal.
static async waitForCssClassToVanish(element: ElementFinder, cssClass: string, timeout?: number) {
await browser.wait(() => {
return element.getAttribute('class').then((value) => {
return value.indexOf(cssClass) < 0;
});
}, timeout ? timeout : Utils.defaultTimeout, 'The specified CSS class did not vanish within the given timeframe.');
}
I've been trying to create a lambda function with a layer, but I'm stuck on how to get it running locally. Here's the current directory structure: - projectDir/ | - lambdas/ | | - match-puller/ | | | - scr/... | | | - index.ts | | ...
I have a set of class values that I need to store in another class. function retainValues(data1,data2){ this.first = data1; this.second = data2; } I am looking for a way to save these class values in a different class like this -> let other = N ...
When trying to access the socket endpoint from my frontend, I encounter this error message: chat:1 Access to XMLHttpRequest at 'http://localhost:3000/socket.io/?EIO=3&transport=polling&t=NOAlAsz' from origin 'http://localhost:4200& ...
Is there a way to retain and add information to an Error object in typescript/javascript without losing the existing details? Currently, I handle it like this: try { // code that may throw an error } catch (e) { throw new Error(`Error while process ...
Whenever I try to send a post request to an api endpoint, I keep encountering an error with status code 500. name: "HttpErrorResponse" ok: false status: 500 statusText: "Internal Server Error" Below is the code I am using: var selected ...
I have a component that inherits from a base component. Now, I would like to expand on the template of the base component within the derived component. For example: Template in base component: <div> <button>1</button> </div> ...
I am looking to create a functionality where, upon clicking on multiple lists, the color changes from grey to pink. Clicking again will revert the color back to grey. How can I achieve this using class binding? Below is the code snippet I have tried with ...
Purpose There is a form with various input elements (el1, el2 ...) el1 may or may not have initial focus when a keydown event occurs, the following actions should be taken: If none of the input elements are in focus, move focus to the first non-empty e ...
In my TypeScript file, there are three classes within a single file. I am attempting to transfer a value from the MainComponent class to the TableContent class. I initially tried using super() inside the TableContent class which did not work, and then att ...
I am currently running my project using vue-cli by executing the following command: vue-cli-service serve --open Is there a way to stop all linting? It seems like it's re-linting every time I save, and it significantly slows down the process of ma ...
Consider the following scenario: export abstract class AbstractButton { // Must always provide this method abstract someRequiredMethod(): void; // The successor must implement one of these (or both) abstract setInnerText?(): void; abst ...
Currently, I am facing an issue while writing a unit test in Typescript to check a Typescript class. The problem arises when the test is executed as it is unable to recognize the class. To provide some context, my setup includes Typescript (1.4) with Node ...
Recently, I've been developing a multi-language Angular application and successfully deployed it to Firebase hosting. If you visit , you'll see the German version. On the other hand, displays the English version of the app. One challenge I enc ...
Currently, I have a function that generates input fields dynamically based on data received from the backend. To ensure proper typing, I've defined interfaces for each type of input field: interface TPField { // CRM id as a hash. id: string nam ...
https://i.stack.imgur.com/P1dr1.png https://i.stack.imgur.com/ktmB3.png Permissions Disappear after Page Refresh Is there a way to prevent permissions from being deleted upon refresh? ...
Looking to include a CSS selector as an @Input in my component. To achieve this, I need to use the following syntax for passing a css selector: <mds-datetime-picker [inLine]="true" [targetSelector]='[data-name="target"]'></mds-datet ...
I have been struggling to display the fetched data in my Angular 6 project. I have tried using ngIf and ngFor but nothing seems to work. My goal is to show data from movies on the HTML page, but for some reason, the data appears to be empty. Despite tryin ...
How can we iterate through interface keys to create a new interface where the value is dependent on the key? type IParse<T> = { [K in keyof T as K extends string ? K : never]: string // How can we specify that if K === 'a', the type sho ...
In my current work environment, the only image processing library available is NodeJS's Sharp for scaling images. It has been reliable due to its pipe-based nature, but now I have been given the task of converting it to TypeScript and utilizing Async/ ...
I am brand new to using protractor and currently working on fixing some tests that were written by previous team members. The challenge I'm encountering is that all the test scripts are running smoothly, except for three of them. I am struggling to fi ...