New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web Lab: Correct share links in different environments #19625
Web Lab: Correct share links in different environments #19625
Conversation
wait_short_until do | ||
share_link_input = @browser.find_element(:css, '#sharing-input') | ||
end | ||
expect(share_link_input.attribute('value')).to include(expected_text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}, | ||
|
||
/** | ||
* This method exists to be mocked for unit tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This made me sad :)
db585f0
to
93e4775
Compare
This is passing tests now that the Chrome 63 failures are worked out. Can I get a review? |
const re = /([-.]?studio)?\.?code.org/i; | ||
const environmentKey = location.hostname.replace(re, ''); | ||
const subdomain = environmentKey.length > 0 ? `${environmentKey}.` : ''; | ||
const port = 'localhost' === environmentKey ? `:${location.port}` : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gut says this kind of parsing could be more generically useful across our code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this should be extracted or reused somewhere right away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think okay for now; but it would be good to keep an eye out for chances to use shared code going forward. The Ruby side of the system has been somewhat good at using common code to deal with our various environments.
codeProjects: 'https://test.codeprojects.org', | ||
}, | ||
{ | ||
studio:'https://test.studio.code.org', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a domain we offer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh - I know there was a time in the past where we didn't care whether you wrote test-studio
or test.studio
, but maybe that's not true anymore? This is easy enough to tear out, I just wanted to make sure this utility handled that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to work for me, and I have a feeling some of our infrastructure changes stopped them from working a while ago. Same comment for the staging link in this file too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't get confirmation yet, agreed, it looks like we don't support these anymore. I've removed the tests.
@@ -1,3 +1,7 @@ | |||
# Which stage of allthethings.script contains the App Lab levels; this way we | |||
# only have to update in one place if this changes. | |||
APPLAB_ALLTHETHINGS_STAGE = 18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Can imagine a lot of UI tests benefitting from something like this.
@@ -36,6 +40,14 @@ def add_code_to_editor(code) | |||
STEPS | |||
end | |||
|
|||
Given /^I am on the (\d+)(?:st|nd|rd|th)? App ?Lab test level$/ do |level_index| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I look forward to testing the 3th level :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not particularly familiar part of the code base, but looks good to me!
Reverts #19623, restoring #19535 with fixes for sharing from CSD/CSP script project levels.
I added tests that catch the bad case, fixed the bad case, then totally reorganized the tests to reduce duplication, make the test names useful for spot-checking behavior, and easier to extend in the future. I've also added a UI test covering the regression, since in general unit test coverage over project stuff is not great and I still might have missed something.
Here's the new set of tests for
getShareUrl()
: