Skip to content

Commit 289d987

Browse files
ci-botAniket-Engg
authored andcommitted
reload login
1 parent 17ddb3c commit 289d987

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

apps/remix-ide-e2e/src/tests/dgit_github.test.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ module.exports = {
4444
.waitForElementVisible('*[data-id="connected-link-bunsenstraat"]')
4545
.waitForElementVisible('*[data-id="remotes-panel"]')
4646
},
47+
'check the FE shows logged in user #group1 #group2': function (browser: NightwatchBrowser) {
48+
browser
49+
.waitForElementVisible({
50+
selector: '//*[@data-id="github-dropdown-toggle-login"]//span[contains(text(), "bunsenstraat")]',
51+
locateStrategy: 'xpath'
52+
})
53+
},
4754
// 'check the FE for the auth user #group1 #group2': function (browser: NightwatchBrowser) {
4855
// browser
4956
// .clickLaunchIcon('filePanel')
@@ -213,16 +220,39 @@ module.exports = {
213220
locateStrategy: 'xpath'
214221
})
215222
},
216-
'disconnect github #group1': function (browser: NightwatchBrowser) {
223+
'reload page and check login persistence #group1': function (browser: NightwatchBrowser) {
217224
browser
225+
.refresh()
226+
.pause(5000) // Wait for page to fully reload
227+
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
228+
.clickLaunchIcon('dgit')
218229
.waitForElementVisible('*[data-id="github-panel"]')
219-
.pause(1000)
220230
.click('*[data-id="github-panel"]')
231+
.waitForElementVisible('*[data-id="connected-as-bunsenstraat"]')
232+
.waitForElementVisible('*[data-id="connected-img-bunsenstraat"]')
233+
.waitForElementVisible('*[data-id="connected-link-bunsenstraat"]')
234+
},
235+
'check the FE shows logged in user after reload #group1': function (browser: NightwatchBrowser) {
236+
browser
237+
.waitForElementVisible({
238+
selector: '//*[@data-id="github-dropdown-toggle-login"]//span[contains(text(), "bunsenstraat")]',
239+
locateStrategy: 'xpath'
240+
})
241+
},
242+
'disconnect github #group1': function (browser: NightwatchBrowser) {
243+
browser
221244
.waitForElementVisible('*[data-id="disconnect-github"]')
222245
.pause(1000)
223246
.click('*[data-id="disconnect-github"]')
224247
.waitForElementNotPresent('*[data-id="connected-as-bunsenstraat"]')
225248
},
249+
'check the FE for the disconnected auth user #group1': function (browser: NightwatchBrowser) {
250+
browser
251+
.waitForElementNotPresent({
252+
selector: '//*[@data-id="github-dropdown-toggle-login"]//span[contains(text(), "bunsenstraat")]',
253+
locateStrategy: 'xpath'
254+
})
255+
},
226256
// 'check the FE for the disconnected auth user #group1': function (browser: NightwatchBrowser) {
227257
// browser
228258
// .clickLaunchIcon('filePanel')

libs/remix-ui/git/src/lib/listeners.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
4747
// Initialize the login plugin reference
4848
setLoginPlugin(viewPlugin)
4949

50+
plugin.call('manager', 'isActive', 'dgitApi').then( (isActive) => {
51+
if (isActive) {
52+
loadGitHubUserFromToken();
53+
}
54+
});
55+
5056
plugin.on("fileManager", "fileSaved", async (file: string) => {
5157
loadFileQueue.enqueue(async () => {
5258
loadFiles()

0 commit comments

Comments
 (0)