Repository: oppia/oppia

Issue:
New tab is not opened when new topic/skill is created in Firefox
**Describe the bug**
When a new topic/skill is created the pop-up window is blocked.

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to 'Topic and Skills Dashboard'
 2. Click on 'CREATE TOPIC'
 3. Enter the topic name and click on 'Create Topic'
 4. The topic is created but new tab is not opened and a warning bar about blocking a pop-up window is shown.

**Observed behavior**
The topic/skill is created, a new tab is not opened, blocked pop-up window warning bar is shown.

**Expected behavior**
The topic/skill is created, a new tab is opened.

**Screenshots**
![image](https://user-images.githubusercontent.com/10142938/80872155-844d1b80-8cb0-11ea-8aa6-1bec99624bc5.png)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Ubuntu 18.04.3
 - Browser: Firefox
 - Version: 75


Change skill description char limit to 100
<!--
  - Thanks for taking the time to report a bug in the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->

**Describe the bug**
Currently, the skill names have a char limit of 64. This is preventing lesson creators from specifying meaningful descriptions.
![image](https://user-images.githubusercontent.com/11008603/80943763-8eccf980-8e05-11ea-8dec-a5b99fa90283.png)


**To Reproduce**
Steps to reproduce the behavior:
 1. Go to Topic and skills dashboard.
 2. Create a skill with a long description.
 3. Observe that descriptions > 64 chars cannot be input.

**Observed behavior**
Only 64 chars can be entered.

**Expected behavior**
Should allow upto 100 chars.



**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Ubuntu 18.04
 - Browser: Chrome 79

Change skill description char limit to 100
<!--
  - Thanks for taking the time to report a bug in the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->

**Describe the bug**
Currently, the skill names have a char limit of 64. This is preventing lesson creators from specifying meaningful descriptions.
![image](https://user-images.githubusercontent.com/11008603/80943763-8eccf980-8e05-11ea-8dec-a5b99fa90283.png)


**To Reproduce**
Steps to reproduce the behavior:
 1. Go to Topic and skills dashboard.
 2. Create a skill with a long description.
 3. Observe that descriptions > 64 chars cannot be input.

**Observed behavior**
Only 64 chars can be entered.

**Expected behavior**
Should allow upto 100 chars.



**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Ubuntu 18.04
 - Browser: Chrome 79



Discussion:
@aks681, is this an expected behavior? 
@DubeySandeep No, it's not expected, but I don't encounter this locally on Chrome.
@vojtechjelinek Was this on the local server or on the prod server?
Production testing server
> @aks681, is this an expected behavior?

@aks681, by this I mean whether we expect to open the topic editor page in a separate window once the user fillups the topic name and clicks "Create topic"?
 



Resolving patch:
diff --git a/core/domain/android_validation_constants.py b/core/domain/android_validation_constants.py
--- a/core/domain/android_validation_constants.py
+++ b/core/domain/android_validation_constants.py
@@ -38,6 +38,7 @@
 MAX_CHARS_IN_ABBREV_TOPIC_NAME = 12
 MAX_CHARS_IN_TOPIC_DESCRIPTION = 240
 MAX_CHARS_IN_SUBTOPIC_TITLE = 64
-MAX_CHARS_IN_SKILL_DESCRIPTION = 64
+MAX_CHARS_IN_SKILL_DESCRIPTION = 100
 MAX_CHARS_IN_STORY_TITLE = 39
 MAX_CHARS_IN_CHAPTER_TITLE = 36
+MAX_CHARS_IN_MISCONCEPTION_NAME = 100
diff --git a/core/domain/skill_domain.py b/core/domain/skill_domain.py
--- a/core/domain/skill_domain.py
+++ b/core/domain/skill_domain.py
@@ -249,8 +249,13 @@ def validate(self):
             raise utils.ValidationError(
                 'Expected misconception name to be a string, received %s' %
                 self.name)
-        utils.require_valid_name(
-            self.name, 'misconception_name', allow_empty=False)
+
+        misconception_name_length_limit = (
+            android_validation_constants.MAX_CHARS_IN_MISCONCEPTION_NAME)
+        if len(self.name) > misconception_name_length_limit:
+            raise utils.ValidationError(
+                'Misconception name should be less than %d chars, received %s'
+                % (misconception_name_length_limit, self.name))
 
         if not isinstance(self.notes, python_utils.BASESTRING):
             raise utils.ValidationError(


Test patch:
diff --git a/core/domain/android_validation_constants_test.py b/core/domain/android_validation_constants_test.py
--- a/core/domain/android_validation_constants_test.py
+++ b/core/domain/android_validation_constants_test.py
@@ -46,3 +46,6 @@ def test_that_character_limits_in_both_files_are_equal(self):
         self.assertEqual(
             android_validation_constants.MAX_CHARS_IN_CHAPTER_TITLE,
             constants.MAX_CHARS_IN_CHAPTER_TITLE)
+        self.assertEqual(
+            android_validation_constants.MAX_CHARS_IN_MISCONCEPTION_NAME,
+            constants.MAX_CHARS_IN_MISCONCEPTION_NAME)
diff --git a/core/domain/skill_domain_test.py b/core/domain/skill_domain_test.py
--- a/core/domain/skill_domain_test.py
+++ b/core/domain/skill_domain_test.py
@@ -96,12 +96,13 @@ def test_valid_misconception_name(self):
         misconception_name = 'This string is smaller than 50'
         self.skill.update_misconception_name(0, misconception_name)
         self.skill.validate()
-        misconception_name = ('This string is a larger string'
-                              'and it is greater than 50 chars.')
+        misconception_name = (
+            'etiam non quam lacus suspendisse faucibus interdum posuere lorem '
+            'ipsum dolor sit amet consectetur adipiscing elit duis tristique '
+            'sollicitudin nibh sit amet commodo nulla facilisi')
         self.skill.update_misconception_name(0, misconception_name)
         self._assert_validation_error(
-            'The length of misconception_name should '
-            'be between 1 and 50 characters'
+            'Misconception name should be less than 100 chars'
         )
 
     def test_valid_misconception_must_be_addressed(self):
@@ -178,10 +179,11 @@ def test_description_validation(self):
         self._assert_validation_error('Description should be a string')
 
         self.skill.description = (
-            'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza'
-            'bcdefghijklmnopqrstuvwxyz')
+            'etiam non quam lacus suspendisse faucibus interdum posuere lorem '
+            'ipsum dolor sit amet consectetur adipiscing elit duis tristique '
+            'sollicitudin nibh sit amet commodo nulla facilisi')
         self._assert_validation_error(
-            'Skill description should be less than 64 chars')
+            'Skill description should be less than 100 chars')
 
     def test_prerequisite_skill_ids_validation(self):
         self.skill.prerequisite_skill_ids = 0
diff --git a/core/tests/protractor_utils/TopicsAndSkillsDashboardPage.js b/core/tests/protractor_utils/TopicsAndSkillsDashboardPage.js
--- a/core/tests/protractor_utils/TopicsAndSkillsDashboardPage.js
+++ b/core/tests/protractor_utils/TopicsAndSkillsDashboardPage.js
@@ -152,7 +152,8 @@ var TopicsAndSkillsDashboardPage = function() {
       topicNameField.sendKeys(topicName);
       confirmTopicCreationButton.click();
 
-      waitFor.newTabToBeCreated('Creating topic takes too long');
+      waitFor.newTabToBeCreated(
+        'Creating topic takes too long', '/topic_editor/');
       return browser.getAllWindowHandles().then(function(handles) {
         var newHandle = handles.filter(
           handle => initialHandles.indexOf(handle) === -1)[0];
@@ -239,7 +240,8 @@ var TopicsAndSkillsDashboardPage = function() {
         'Create skill button takes too long to be clickable');
       confirmSkillCreationButton.click();
 
-      waitFor.newTabToBeCreated('Creating skill takes too long');
+      waitFor.newTabToBeCreated(
+        'Creating skill takes too long', '/skill_editor/');
       return browser.getAllWindowHandles().then(function(handles) {
         var newHandle = handles.filter(
           handle => initialHandles.indexOf(handle) === -1)[0];
diff --git a/core/tests/protractor_utils/waitFor.js b/core/tests/protractor_utils/waitFor.js
--- a/core/tests/protractor_utils/waitFor.js
+++ b/core/tests/protractor_utils/waitFor.js
@@ -87,18 +87,20 @@ var visibilityOf = function(element, errorMessage) {
 /**
 * Wait for new tab is opened
 */
-var newTabToBeCreated = function(errorMessage) {
+var newTabToBeCreated = function(errorMessage, urlToMatch) {
   var currentHandles = [];
 
-  return browser.driver.getAllWindowHandles().then(function(handles) {
-    currentHandles = handles;
-  }).then(function() {
-    return browser.wait(function() {
-      return browser.driver.getAllWindowHandles().then(function(handles) {
-        return (handles.length > currentHandles.length);
+  return browser.wait(function() {
+    return browser.driver.getAllWindowHandles().then(function(handles) {
+      browser.waitForAngularEnabled(false);
+      return browser.switchTo().window(handles.pop()).then(function() {
+        return browser.getCurrentUrl().then(function(url) {
+          browser.waitForAngularEnabled(true);
+          return url.match(urlToMatch);
+        });
       });
-    }, DEFAULT_WAIT_TIME_MSECS, errorMessage);
-  });
+    });
+  }, DEFAULT_WAIT_TIME_MSECS, errorMessage);
 };
 
 exports.alertToBePresent = alertToBePresent;