Skip to content

Commit d5639f2

Browse files
committed
Featured update db
1 parent 8e0d379 commit d5639f2

File tree

91 files changed

+2201
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+2201
-2
lines changed

README.md

Lines changed: 590 additions & 2 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## [How do you run Protractor tests in headless mode?](#how-to-run-protractor-tests-in-headless-mode)
2+
3+
### How do you run Protractor tests in headless mode?
4+
5+
To run Protractor tests in headless mode, you can configure the `protractor.conf.js` file to use a headless browser like Chrome.
6+
7+
Example configuration:
8+
9+
```javascript
10+
capabilities: {
11+
'browserName': 'chrome',
12+
'chromeOptions': {
13+
args: ['--headless', '--disable-gpu', '--window-size=800x600']
14+
}
15+
},
16+
```
17+
18+
**Tags**: [advanced](./level/advanced), [Protractor](./theme/protractor), [Headless Testing](./theme/headless_testing)
19+
20+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## [How do you check if a Queue is empty in JavaScript?](#how-to-check-if-a-queue-is-empty)
2+
3+
### How do you check if a Queue is empty in JavaScript?
4+
5+
To check if a queue is empty, you can verify if the queue's length is zero.
6+
7+
Example:
8+
9+
```javascript
10+
let queue = new Queue();
11+
console.log(queue.isEmpty()); // true
12+
```
13+
14+
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [Operations](./theme/operations)
15+
16+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## [How do you implement a Queue in JavaScript?](#how-to-implement-a-queue-in-javascript)
2+
3+
### How do you implement a Queue in JavaScript?
4+
5+
A queue can be implemented using an array or linked list. For simplicity, let's use an array.
6+
7+
Example of a queue implementation using an array:
8+
9+
```javascript
10+
class Queue {
11+
constructor() {
12+
this.items = [];
13+
}
14+
enqueue(element) {
15+
this.items.push(element);
16+
}
17+
dequeue() {
18+
return this.items.shift();
19+
}
20+
peek() {
21+
return this.items[0];
22+
}
23+
isEmpty() {
24+
return this.items.length === 0;
25+
}
26+
}
27+
```
28+
29+
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [Implementation](./theme/implementation)
30+
31+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## [How do you implement the dequeue operation in a Queue?](#how-to-implement-dequeue-operation-in-queue)
2+
3+
### How do you implement the dequeue operation in a Queue?
4+
5+
The dequeue operation removes an element from the front of the queue. In JavaScript, you can use the `shift()` method on an array to achieve this.
6+
7+
Example:
8+
9+
```javascript
10+
let queue = [1, 2, 3];
11+
let dequeued = queue.shift();
12+
console.log(dequeued); // 1
13+
console.log(queue); // [2, 3]
14+
```
15+
16+
**Tags**: [basic](./level/basic), [JavaScript](./theme/javascript), [Operations](./theme/operations)
17+
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## [How do you locate elements in Protractor?](#how-to-locate-elements-in-protractor)
2+
3+
### How do you locate elements in Protractor?
4+
5+
In Protractor, you can locate elements using various locators such as CSS selectors, XPath, and Angular-specific locators.
6+
- `by.id()`: Locate by ID.
7+
- `by.css()`: Locate by CSS selectors.
8+
- `by.xpath()`: Locate by XPath.
9+
10+
Example:
11+
12+
```javascript
13+
let button = element(by.css('.submit-button'));
14+
```
15+
16+
**Tags**: [basic](./level/basic), [Protractor](./theme/protractor), [Locators](./theme/locators)
17+
18+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [How do you run Jest tests from the command line?](#how-do-you-run-jest-tests-from-the-command-line)
2+
3+
### How do you run Jest tests from the command line?
4+
5+
You can run Jest tests from the command line using the `jest` command. Make sure Jest is installed, and you can run `npx jest` or `npm test` to run all the tests.
6+
7+
Example:
8+
9+
```bash
10+
npx jest
11+
```
12+
13+
**Tags**: [basic](./level/basic), [Jest](./theme/jest), [Command Line](./theme/command_line)
14+
15+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## [How do you set up Protractor for UI Testing?](#how-to-setup-protractor-for-ui-testing)
2+
3+
### How do you set up Protractor for UI Testing?
4+
5+
To set up Protractor, you need to install Node.js, install Protractor via npm, and configure the `protractor.conf.js` file. After the setup, you can use Protractor commands to interact with web pages in your tests.
6+
7+
**Tags**: [basic](./level/basic), [Protractor](./theme/protractor), [Setup](./theme/setup)
8+
9+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## [How do you write a simple Jest test?](#how-to-write-a-simple-jest-test)
2+
3+
### How do you write a simple Jest test?
4+
5+
To write a simple Jest test, use the `test` function, which accepts a description of the test and a callback function that contains the code to test.
6+
7+
Example:
8+
9+
```javascript
10+
test('adds 1 + 2 to equal 3', () => {
11+
expect(1 + 2).toBe(3);
12+
});
13+
```
14+
15+
**Tags**: [basic](./level/basic), [Jest](./theme/jest), [Testing](./theme/testing)
16+
17+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## [How do you write a simple Protractor test?](#how-to-write-a-simple-protractor-test)
2+
3+
### How do you write a simple Protractor test?
4+
5+
A simple Protractor test can be written by creating a `.spec.js` file that contains test cases using Jasmine or Mocha. You can then use `it()` to define the test case and `expect()` to assert conditions.
6+
7+
Example:
8+
9+
```javascript
10+
describe('Example test', () => {
11+
it('should have a title', () => {
12+
browser.get('http://example.com');
13+
expect(browser.getTitle()).toEqual('Example Domain');
14+
});
15+
});
16+
```
17+
18+
**Tags**: [basic](./level/basic), [Protractor](./theme/protractor), [Testing](./theme/testing)
19+
20+

0 commit comments

Comments
 (0)